Sayaji Kadam
Jan 03, 2019
12:06 pm

Disable Hard Keys of device using KioskMode and KioskSetting -

I used below code -

KioskMode kioskMode = edm.getKioskMode();
KioskSetting kioskSetting = new KioskSetting();
kioskSetting.multiWindow = false;
List<Integer> availableHwKeys;
availableHwKeys = new ArrayList<Integer>();
availableHwKeys.add(new Integer(3));
availableHwKeys.add(new Integer(24));
availableHwKeys.add(new Integer(25));
availableHwKeys.add(new Integer(79));
availableHwKeys.add(new Integer(187));
kioskSetting.hardwareKey = availableHwKeys;
kioskMode.enableKioskMode();

But getting following error at last statment - "kioskMode.enableKioskMode();"

Error  -

01-03 17:15:41.650 21373-21452/com.*****.*****x E/AndroidRuntime: FATAL EXCEPTION: Thread-1676
                                                                       Process: com.datavsn.EFTMobile, PID: 21373
                                                                       java.lang.SecurityException: Admin  does not have android.permission.sec.MDM_KIOSK_MODE
                                                                           at android.os.Parcel.readException(Parcel.java:1472)
                                                                           at android.os.Parcel.readException(Parcel.java:1426)
                                                                           at android.app.enterprise.kioskmode.IKioskMode$Stub$Proxy.enableKioskMode(IKioskMode.java:444)
                                                                           at android.app.enterprise.kioskmode.KioskMode$1.run(KioskMode.java:239)
                                                                           at java.lang.Thread.run(Thread.java:841)

 

Permission is also present in AndroidManifest.xml

Try with both permission -

com.samsung.android.knox.permission.KNOX_RESTRICTION_MGMT and android.permission.sec.MDM_KIOSK_MODE

Used Knox SDK and Device Knox API - 11 and Android Device - SM-T231

 

Thanks,

Similar topics

No similar topics found.
Konrad Sobczak
Jan 03, 2019
2:38 pm

Hello Sayaji Kadam,

Can you confirm that Knox SDK license key was succesfully activated prior to using kioskMode.enableKioskMode() ? Your app can only gain Knox permissions once license key was succesfully verified and activated.

 

Best regards, Konrad.

 

Sayaji Kadam
Jan 04, 2019
6:16 am

Thanks Konrad.

I used Backwards Compatible Key for activate license. I used support lib because my device not support Knox SDK.

Konrad Sobczak
Jan 04, 2019
8:37 am

Hello Sayaji Kadam,

You need to activate both Knox license and Backward Compatible Key to use Knox SDK features on your device. For more information please refer to below link:

https://seap.samsung.com/html-docs/android/Content/knox-licenses.htm -> Knox licenses guide

https://seap.samsung.com/html-docs/android/Content/tutorial-activate-lic... -> Tutorial on license activation

 

Best regards, Konrad.

 

 

Sayaji Kadam
Jan 04, 2019
9:54 am

Thanks.

If my device knox api level below 24, then we need to activate both Knox license and Backward Compatible Key.