Android Permissions

Improve this doc

This plugin is designed to support Android new permissions checking mechanism.

You can find all permissions here: https://developer.android.com/reference/android/Manifest.permission.html

Repo: https://github.com/NeoLSN/cordova-plugin-android-permissions

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ ionic cordova plugin add cordova-plugin-android-permissions
    $ npm install --save @ionic-native/android-permissions
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { AndroidPermissions } from '@ionic-native/android-permissions';


constructor(private androidPermissions: AndroidPermissions) { }

...

this.androidPermissions.checkPermission(this.androidPermissions.PERMISSION.CAMERA).then(
  success => console.log('Permission granted'),
  err => this.androidPermissions.requestPermission(this.androidPermissions.PERMISSION.CAMERA)
);

this.androidPermissions.requestPermissions([this.androidPermissions.PERMISSION.CAMERA, this.androidPermissions.PERMISSION.GET_ACCOUNTS]);

Instance Members

PERMISSION

checkPermission(permission)

Check permission

Param Type Details
permission string

The name of the permission

Returns: Promise<any> Returns a promise

requestPermission(permission)

Request permission

Param Type Details
permission string

The name of the permission to request

Returns: Promise<any>

requestPermissions(permissions)

Request permissions

Param Type Details
permissions Array<string>

An array with permissions

Returns: Promise<any> Returns a promise

hasPermission(permission)

This function still works now, will not support in the future.

Param Type Details
permission string

The name of the permission

Returns: Promise<any> Returns a promise

API

Native

General