Package 

Class PermissionsModule

  • All Implemented Interfaces:
    com.facebook.react.bridge.NativeModule , com.facebook.react.bridge.ReactModuleWithSpec , com.facebook.react.modules.core.PermissionListener , com.facebook.react.turbomodule.core.interfaces.TurboModule

    
    public class PermissionsModule
    extends NativePermissionsAndroidSpec implements PermissionListener
                        

    Module that exposes the Android M Permission system to JS.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static String NAME
    • Method Summary

      Modifier and Type Method Description
      String getName()
      void checkPermission(String permission, Promise promise) Check if the app has the permission given.
      void shouldShowRequestPermissionRationale(String permission, Promise promise) Check whether the app should display a message explaining why a certain permission is needed.successCallback is called with true if the app should display a message, false otherwise.
      void requestPermission(String permission, Promise promise) Request the given permission.
      void requestMultiplePermissions(ReadableArray permissions, Promise promise)
      boolean onRequestPermissionsResult(int requestCode, Array<String> permissions, Array<int> grantResults) Method called by the activity with the result of the permission request.
      • Methods inherited from class com.facebook.fbreact.specs.NativePermissionsAndroidSpec

        checkPermission, requestMultiplePermissions, requestPermission, shouldShowRequestPermissionRationale
      • Methods inherited from class com.facebook.react.bridge.BaseJavaModule

        canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
      • Methods inherited from class com.facebook.react.modules.core.PermissionListener

        onRequestPermissionsResult
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • shouldShowRequestPermissionRationale

         void shouldShowRequestPermissionRationale(String permission, Promise promise)

        Check whether the app should display a message explaining why a certain permission is needed.successCallback is called with true if the app should display a message, false otherwise. Thismessage is only displayed if the user has revoked this permission once before, and if thepermission dialog will be shown to the user (the user can choose to not be shown that dialogagain). For devices before Android M, this always returns false. See .

      • requestPermission

         void requestPermission(String permission, Promise promise)

        Request the given permission. successCallback is called with GRANTED if the permission had beengranted, DENIED or NEVER_ASK_AGAIN otherwise. For devices before Android M, this checks if theuser has the permission given or not and resolves with GRANTED or DENIED. See .