New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-permission

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-permission

Verify and request grants for Android app permissions

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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 = window.plugins.Permission

var permission = 'android.permission.RECORD_AUDIO'

Permission.has(permission, function(results) {
    if (!results[permission]) {
        Permission.request(permission, function(results) {
            if (result[permission]) {
                // permission is granted
            }
        }, alert)
    }
}, alert)

API

Modules

Permission

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

ParamTypeDescription
permissionsString | Array.<String>A permission or an array of permissions.
successCallbacksuccessCallback
errorCallbackerrorCallback

Example

var Permission = window.plugins.Permission

// verify grant for a permission
var permission = 'android.permission.RECORD_AUDIO'
Permission.has(permission, function(results) {
    if (results[permission]) {
        // permission is granted
    }
}, alert)

// verify grant for multiple permissions
var permissions = ['android.permission.RECORD_AUDIO', 'android.permission.READ_CONTACTS']
Permission.has(permissions, function(results) {
    if (results['android.permission.RECORD_AUDIO']) {
        // permission is granted
    }
}, alert)

Permission.request(permissions, successCallback, errorCallback)

Requests permissions and asynchronously returns an object indicating whether given permissions are granted.

Kind: static method of Permission

ParamTypeDescription
permissionsString | Array.<String>A permission or an array of permissions.
successCallbacksuccessCallback
errorCallbackerrorCallback

Example

var Permission = window.plugins.Permission

// request grant for a permission
var permission = 'android.permission.RECORD_AUDIO'
Permission.request(permission, function(results) {
    if (results[permission]) {
        // permission is granted
    }
}, alert)

// request grant for multiple permissions
var permissions = ['android.permission.RECORD_AUDIO', 'android.permission.READ_CONTACTS']
Permission.request(permissions, function(results) {
    if (results['android.permission.RECORD_AUDIO']) {
        // permission is granted
    }
}, alert)

successCallback : function

Kind: global typedef

ParamTypeDescription
resultsObject.<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.

errorCallback : function

Kind: global typedef

ParamType
errError

License

This project is MIT-licensed

Keywords

FAQs

Package last updated on 02 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc