Menu
NOTE: Dual Persona and Corporate Liable (CL) containers are not longer supported on the Note 10 and later devices. If you are using any of these devices, use the new KPE Knox Workspace. KPE Workspace can be deployed by itself (P.O only) or as Fully Managed Device with Workspace (D.O + P.O). For more information, see this SEAP bulletin.
NOTE: COM containers are deprecated in S10's running Knox 3.3 and above. Trying to create a COM on these devices will not work. COM containers created on existing devices in your fleet will continue to work until the official end of life (EOL) of the devices they are running on, for example, S7 or S8. For more information, see this SEAP bulletin.

Manage COM and CL Workspaces

Create a container

To create a Knox container, you only need to call one API as follows.

KnoxContainerManager.createContainer("knox-b2b");

There are different types of containers you can create, depending on your needs. To change the container type, replace the knox-b2b string with your required container type.

When you push the container, the user must complete a series of steps on the phone to complete to process.

Remove a container

To remove a Knox container do as follows.

EnterpriseContainerManager.removeContainer(containerId, new RemoteStatusCallback());

Choose the container UI layout

You can customize the "knox-b2b" UI to appear as a folder containing apps or as a desktop with app launcher icons.

To do this, use setContainerLayout, which accepts the layout types:

  • CONTAINER_LAYOUT_TYPE_FOLDER
  • CONTAINER_LAYOUT_TYPE_CLASSIC

To prevent end users from changing this UI layout through the Knox Settings menu, use allowLayoutSwitching(boolean allow).

Handle container error messages

Register a broadcast receiver.

By default, the container creation process does not provide any error messages. To see error messages, you must create a broadcast receiver and receive INTENT_CONTAINER_CREATION_STATUS through a toast message.

This call returns the CREATION_STATUS_CODE, which you can use to determine the type of error you are receiving.

Examples

Create a container with custom settings

Here is a sample use case that creates a Knox container and sets up an email account.

  1. Create Knox container.
  2. Create the EnterpriseKnoxManager and Knox Container Manager objects.
  3. Call emailAccountPolicy.addNewAccount with required configurations.
KnoxContainerManager.createContainer("knox-b2b");
EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(ctx);
KnoxContainerManager kcm = ekm.getKnoxContainerManager(KnoxContainerManager.getContainers().get(0));

EmailAccountPolicy emailAccountPolicy = kcm.getEmailAccountPolicy()
emailAccountPolicy.addNewAccount(new EmailAccount(
	"testemail@gmail.com","pop3","pop.gmail.com", 995,
	"testemail@gmail.com", null,"smtp", "smtp.gmail.com",465,
	"testemail@gmail.com",null));

Create COM container with default settings

This sample use case creates a COM container with the default settings.

  1. Create a Knox container using the Container Only Mode.
  2. Call hideSystemBar() to hide the system bar.
KnoxContainerManager.createContainer("knox-b2b-com");
KnoxContainerManager kcm = EnterpriseKnoxManager.getInstance().getKnoxContainerManager(context, containerid);
KioskMode kMode = kcm.getKioskMode();
kMode.hideSystemBar(true);

Clone a COM container

You can also create and customize a container with the clone method. When you clone a container, you select one of the default container types and then add your desired features to it. For example, you may want to change the default password length from 8 characters to 4, or add some custom apps upon creation.

  1. Create a new KnoxConfigurationType.
  2. Install the Calendar and Contacts apps:
  3. Hide the system bar:
  4. Create the custom COM container:
  5. Disable an app such that it is not visible on the launcher:
  6. Install an app from SD card:
  7. Install an app that is already downloaded or sideloaded onto the device:
KnoxConfigurationType typeobj = KnoxContainerManager.getConfigurationTypeByName("knox-b2b-com");
KnoxConfigurationType  newType  = typeobj.clone("custom-b2b-com");


List<String> appList = new ArrayList<String>();
appList.add("com.android.calendar");
appList.add("com.android.contacts");
newType.setAppInstallationList(appList);

if(newType instanceOf ContainerModeConfigurationType){
newType.setHideSystemBar(true); }

KnoxContainerManager.addConfigurationType(Context, newType);
KnoxContainerManager.createContainer("custom-b2b-com");

KnoxContainerManager kcm = EnterpriseKnoxManager.getInstance().getKnoxContainerManager(context, containerid);
ApplicationPolicy aPolicy = mcm.getApplicationPolicy();
aPolicy.setDisableApplication("<app package name>");

KnoxContainerManager mcm = EnterpriseKnoxManager.getInstance().getKnoxContainerManager(context, containerid);
ApplicationPolicy aPolicy = mcm.getApplicationPolicy();
aPolicy.installApplication("/mnt/sdcard/test.apk", true/false);

KnoxContainerManager mcm = EnterpriseKnoxManager.getInstance().getKnoxContainerManager(context, containerid);
ApplicationPolicy aPolicy = mcm.getApplicationPolicy();
aPolicy.installApplication("package name");