Mikayla N.Samsung SEAP Moderator
Jan 25, 2019
7:21 pm

Hi George,

To add a shortcut within the container, try running addHomeShortcut from the ApplicationPolicy class of the Knox SDK, found here.

The code should look something like this: 

// administrator wants to add a browser shortcut on the home screen
 String packageName = "com.android.browser";
 String homePkgName = null;
 // When you create container successfully, containerID will be returned via intent.
 // Use this containerID in below API.
 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
 KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
 ApplicationPolicy appPolicy = kcm.getApplicationPolicy();

 try {
     boolean result = appPolicy.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);
 }

Please let me know if you need anymore help with this.

Best,

Mikayla

Updated: Jan 25, 2019 at 7:22 pm

George Mabley
Jan 25, 2019
7:43 pm

This is what we are currently using. However, I wanted to use SystemManager.addShortcut(). The parameters of this method allow us to specify an X and Y grid location to place the shortcut.   From your response, it leads me to believe SystemManager.addShortcut() is not available in the container.

Thank you for help!

Updated: Jan 25, 2019 at 7:44 pm

Comments

Hi George,

Yes, to confirm, it is not possible to use SystemManager.addShortcut() within the container. addShortcut is a global scope method, which does not work within the container. 

Best,

Mikayla

Mikayla N.Jan 25, 2019 at 9:16 pm