androidkiosk-modesamsung-knox

Enabling KIOSK mode using Samsung MDM 5.0 Knox


I was trying to run the sample knox app using MDM 5.0 SDK. I am trying to implement KIOSK Mode/ Enable Camera/ Disable Camera but every time I run my app it throws me a security exception

01-02 00:56:07.219: E/AndroidRuntime(8142): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.newkiosk/com.example.newkiosk.MainActivity}: 
java.lang.SecurityException: Admin does not have android.permission.sec.MDM_KIOSK_MODE

In my manifest file I am declaring the uses permissions for all the operations but still not able to implement KIOSK Mode/ Enable Camera/ Disable Camera.

Do I need a license key or sign my app just like we do it for Google Maps or am I doing something wrong ?


Solution

  • To enable kiosk mode with MDM 5.0 Knox, you need:

    You must activate the license with this code:

    EnterpriseLicenseManager.getInstance(context).activateLicense("<knox key here>");
    

    Once the license is successfully activated, you can enable the kiosk mode with this call:

     KioskMode kioskMode = KioskMode.getInstance(context);
     kioskMode.enableKioskMode("<the package name of the kiosk app>");
    

    To enable/disable camera you must use the DeviceRestrictionPolicy api:

    EnterpriseDeviceManager enterpriseDeviceManager = new EnterpriseDeviceManager(context);
    DeviceRestrictionPolicy deviceRestrictionPolicy = enterpriseDeviceManager.getDeviceRestrictionPolicy();
    deviceRestrictionPolicy.setCameraState(false); //disable camera