Menu

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 show a simple pop-up upon installation. Here, only the necessary permissions to run your app are presented to the use instead of the entire Knox Permission set inherited by your KPE from older Knox versions. These permissions are what you include in you Android manifest.

If you choose to use the Selective Knox Permission feature, the Knox system only grants your app access to the permissions you declared in your Android manifest.

Declare permissions

In your Android Manifest file, write:

  1. The required Knox permissions.
    • RestrictionPolicy.setCameraState() requires "com.samsung.android.knox.permission.KNOX_HW_CONTROL".
  2. The optional selective permissions.
    • <meta-data android:name="com.samsung.knoxlicense.permissions" android:value="true"/>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.samsung.knoxsdksample">

    <!-- Declare the Knox permissions used by this app -->
    <uses-permission android:name="com.samsung.android.knox.permission.KNOX_HW_CONTROL"/>

    <application>
        <!-- Enable selective Knox permissions(optional)-->
        <meta-data android:name="com.samsung.knoxlicense.permissions" android:value="true"/>
    </application>
</manifest>

The Selective permissions meta-tag is optional for all types of licenses, (ELM,KLM, KPE).

  • If your app doesn’t declare the meta tag, it will get all permissions by default.
  • If your app declares the meta tag, it will get and display only the selected permissions.

Note – the license key is stored in constantsfile. Copy this over from the sample app or create your own.

See also: