cordova-plugin-permission
This plugin provides the ability to verify and request grants for Android app permissions.
Installation
cordova plugin add cordova-plugin-permission
Supported platforms
- Android
Usage
var Permission = windowpluginsPermission var permission = 'android.permission.RECORD_AUDIO' Permission
API
Modules
Typedefs
- successCallback :
function
- errorCallback :
function
Permission
Permission.has(permissions, successCallback, errorCallback)
Asynchronously returns an object indicating whether given permissions are granted.
Kind: static method of Permission
Param | Type | Description |
---|---|---|
permissions | String | Array.<String> |
A permission or an array of permissions. |
successCallback | successCallback |
|
errorCallback | errorCallback |
Example
var Permission = windowpluginsPermission // verify grant for a permissionvar permission = 'android.permission.RECORD_AUDIO'Permission // verify grant for multiple permissionsvar permissions = 'android.permission.RECORD_AUDIO' 'android.permission.READ_CONTACTS'Permission
Permission.request(permissions, successCallback, errorCallback)
Requests permissions and asynchronously returns an object indicating whether given permissions are granted.
Kind: static method of Permission
Param | Type | Description |
---|---|---|
permissions | String | Array.<String> |
A permission or an array of permissions. |
successCallback | successCallback |
|
errorCallback | errorCallback |
Example
var Permission = windowpluginsPermission // request grant for a permissionvar permission = 'android.permission.RECORD_AUDIO'Permission // request grant for multiple permissionsvar permissions = 'android.permission.RECORD_AUDIO' 'android.permission.READ_CONTACTS'Permission
function
successCallback : Kind: global typedef
Param | Type | Description |
---|---|---|
results | Object.<String, Boolean> |
Each property of the object is a string indicating an app permission. Each value is a boolean indicating whether the app permission is granted. |
function
errorCallback : Kind: global typedef
Param | Type |
---|---|
err | Error |
License
This project is MIT-licensed