Skip to main content

Set Permissions

You must inform the extension which permissions you wish to request. This is done by passing an array of Strings each being the permission required.

For example to set the camera permission:

Permissions.service.setPermissions( 
[
"android.permission.CAMERA"
]
);

A complete list of the possible permissions is found here.

Adding Permissions

In addition to informing the extension of the permissions you must add these permissions to your application's manifest.

Permissions are represented with a tag like the following:

<uses-permission android:name="android.permission.CAMERA" />

To add these permissions you need to add some additional configuration to apm. Firstly add a custom Android configuration file by running:

apm generate config android

Edit the config/android/AndroidManifest.xml file that was generated to resemble the following, adding the required permissions, eg:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.CAMERA" />

</manifest>

You can add any other additions you require in your application here and these will be merged by apm when you generate your application descriptor.

info

Make sure you regenerate your application descriptor after modifying this file. See the section in add the extension for details.