PermissionsModule

class PermissionsModule(reactContext: ReactApplicationContext?) : NativePermissionsAndroidSpec, PermissionListener

Module that exposes the Android M Permission system to JS.

Constructors

Link copied to clipboard
constructor(reactContext: ReactApplicationContext?)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun canOverrideExistingModule(): Boolean

Return true if you intend to override some other native module that was registered e.g. as part of a different package (such as the core one). Trying to override without returning true from this method is considered an error and will throw an exception during initialization. By default all modules return false.

Link copied to clipboard
open override fun checkPermission(permission: String, promise: Promise)

Check if the app has the permission given. successCallback is called with true if the permission had been granted, false otherwise. See Activity.checkSelfPermission.

Link copied to clipboard
Link copied to clipboard
open override fun getName(): String
Link copied to clipboard
open override fun initialize()

This method is called after ReactApplicationContext has been created.

Link copied to clipboard
open override fun invalidate()

Allow NativeModule to clean up. Called before React Native instance is destroyed.

Link copied to clipboard

Allow NativeModule to clean up. Called before {CatalystInstance#onHostDestroy}

Link copied to clipboard
open override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray): Boolean

Method called by the activity with the result of the permission request.

Link copied to clipboard
open override fun requestMultiplePermissions(permissions: ReadableArray, promise: Promise)
Link copied to clipboard
open override fun requestPermission(permission: String, promise: Promise)

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

Link copied to clipboard
open override fun shouldShowRequestPermissionRationale(permission: String, 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. This message is only displayed if the user has revoked this permission once before, and if the permission dialog will be shown to the user (the user can choose to not be shown that dialog again). For devices before Android M, this always returns false. See permissionAwareActivity.shouldShowRequestPermissionRationale.