-
- 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.
-
-
Constructor Summary
Constructors Constructor Description PermissionsModule(ReactApplicationContext reactContext)
-
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
-
-
Constructor Detail
-
PermissionsModule
PermissionsModule(ReactApplicationContext reactContext)
-
-
Method Detail
-
checkPermission
void checkPermission(String permission, Promise promise)
Check if the app has the permission given. successCallback is called with true if thepermission had been granted, false otherwise. See checkSelfPermission.
-
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)
-
requestMultiplePermissions
void requestMultiplePermissions(ReadableArray permissions, Promise promise)
-
onRequestPermissionsResult
boolean onRequestPermissionsResult(int requestCode, Array<String> permissions, Array<int> grantResults)
Method called by the activity with the result of the permission request.
-
-
-
-