Menu

Why are app shortcuts not showing up in Kiosk mode for the Knox SDK?

The Knox SDK method addHomeShortcut() is used to add shortcut icons to the Kiosk mode default home screen while Kiosk mode is enabled (com.samsung.android.knox.application.ApplicationPolicy). When adding two icons to the home screen, they could be stacked (one on top of the other), making that the first icon inaccessible. The Kiosk mode home screen does not allow the user to reposition the icons, the launcher home screen will choose where to position the icons.

Adding some delay (a few seconds) between the addition of shortcut icons is the best solution for the icons to be installed next to each other rather than on top of each other. There is no callback or intent to know the result of the addHomeShortcut() API method.

The following code snippet demonstrates how to add time delay while adding shortcut icons:

 // administrator wants to add a browser shortcut on the home screen
 String packageName = "com.android.browser";
 String homePkgName = null;
 EnterpriseDeviceManager edm = EnterpriseDeviceManager.getInstance(context);
 ApplicationPolicy appPolicy = edm.getApplicationPolicy();

 try {
     boolean result = applicationPolicy.addHomeShortcut(packageName, homePkgName);

     if (result == true) {
         Log.d(TAG, "addHomeShortcut has succeeded!");
     } else {
         Log.d(TAG, "addHomeShortcut has failed.");
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }
		
Share it: