Declare Knox permissions
With Knox v3.0, we introduced selective permissions, so that you can declare only the permissions that your app uses. This topic shows how to declare these permissions, and also how to handle app permissions dynamically at runtime as opposed to all at once when the application is installed.
Selective permissions allow you to present app users with a simple pop-up listing only the permissions needed to run your app. These permissions are what you include in your Android manifest. The Knox system grants your app access to only the permissions you declared in your Android manifest.
Declare permissions
The selective permissions feature is optional.
- If your app does not declare the meta tag, it gets all permissions by default. MDM apps that support the Knox Service Plugin must use this option as KSP needs all the Knox permissions.
- If your app does declare the meta tag, it gets only the selected permissions.
To use selective permissions:
- Look up the required Knox permissions in the API reference. For example, the API method
RestrictionPolicy.setCameraState()
requires the permissioncom.samsung.android.knox.permission.KNOX_HW_CONTROL
. - Update the Android manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.samsung.knox.example.gettingstarted">
<!-- Declare the Knox permissions used by this app -->
<uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL"/>
<application>
<!-- Enable the selective Knox permissions -->
<meta-data android:name="com.samsung.knoxlicense.permissions" android:value="true"/>
</application>
</manifest>
See also:
Tutorial progress
You’ve completed 5/7 steps!
NextOn this page
Is this page helpful?