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.

Create containers

This topic shows how to create a Knox Platform for Enterprise Workspace container.

Create Workspace

To support the new container, EMM agents leverage Androids method to create a Work Profile. After a manged profile is created, simply activating a Knox license converts the profile to a Knox Workspace.

Here is a sample code snippet on provisioning a P.O from our KPE Workspace sample app.

 // Provision an Android Profile Owner
    private void createAndroidProfile() {

        Activity provisioningActivity = this;
        // Set up the provisioning intent
        Intent provisioningIntent = new Intent("android.app.action.PROVISION_MANAGED_PROFILE");
        provisioningIntent.putExtra(EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,getPackageName());
        if (provisioningIntent.resolveActivity(provisioningActivity.getPackageManager()) == null) {
            // No handler for intent! Can't provision this device.
            // Show an error message and cancel.
        } else {
            // REQUEST_PROVISION_MANAGED_PROFILE is defined
            startActivityForResult(provisioningIntent, 1);
            provisioningActivity.finish();
        }
    }

Next, you activate a Knox license. This upgrades your Android profile to a Knox Workspace. Here is an example from the KPE Workspace sample app.

private void activateLicence() {

        // Instantiate the EnterpriseLicenseManager class to use the activateLicense method
        KnoxEnterpriseLicenseManager klmManager = KnoxEnterpriseLicenseManager.getInstance(this);

        try {
            // ELM License Activation TODO Add license key to Constants.java
            klmManager.activateLicense(Constants.KLM_LICENSE_KEY);
            mUtils.log(getResources().getString(R.string.license_progress));

        } catch (Exception e) {
            mUtils.processException(e,TAG);
        }
    }

Remove container

When a Knox license is deactivate, the KPE container will be locked. Here is an example from the KPE Workspace sample app.

private void deActivateLicence() {

        // Instantiate the EnterpriseLicenseManager class to use the activateLicense method
        KnoxEnterpriseLicenseManager klmManager = KnoxEnterpriseLicenseManager.getInstance(this);

        try {
            // License Activation TODO Add license key to Constants.java
            klmManager.deActivateLicense(Constants.KLM_LICENSE_KEY);
            mUtils.log(getResources().getString(R.string.deactivate_license_progress));

        } catch (Exception e) {
            mUtils.processException(e,TAG);
        }
    }
See Upgrade Android Work Profile to Knox Workspace for a full walk through of this process using a Knox Sample app.
Read this page if you are looking to create a container for CL / COM.

Customize tab names

Knox 3.2.1 introduced a tabbed UI view for the Personal and Workspace apps.

Knox 3.4 introduces customized names for the Personal and Workspace tabs, using the API setCustomResource().

Through new parameter values, you can set custom container resources like tab names.

In the sample code below, we change the name of the Personal tab to Out of Workspace:

 EnterpriseKnoxManager ekm = EnterpriseKnoxManager.getInstance(context);
 try {
     Bitmap bitmap = // generate a Bitmap object from resource
     KnoxContainerManager kcm = ekm.getKnoxContainerManager(containerID);
     ContainerConfigurationPolicy ccp = kcm.getContainerConfigurationPolicy();
     Bundle data = new Bundle();
     data.putParcelable(KEY_IMAGE, bitmap);
     boolean result = ccp.setCustomResource(ContainerConfigurationPolicy.RES_TYPE_PROFILE_ICON, data);
	 Bundle data2 = new Bundle();
	 data2.putParcelable(KEY_NAME, "Out of Workspace");
	 boolean result2 = ccp.setCustomResource(ContainerConfigurationPolicy.RES_TYPE_PERSONAL_MODE_NAME, data2);
     if (true == result) {
         // set succeeded.
     } else {
         // set failed.
     }
 } catch (SecurityException e) {
     Log.w(TAG, "SecurityException: " + e);
 }