How do I install the MDM agent inside the Knox container?

  1. Install the MDM agent in the personal space
  2. Create a Knox container
  3. Install the MDM agent inside the container as an admin
  4. Uninstall the MDM agent that was in the personal space

Call the API method KnoxContainerManager.createContainer(String type, String adminPackageName) and pass the MDM agent as an adminPackage parameter. Once the container is created, it installs the MDM agent inside the container. Then, ownership of the container transfers from the creator to the admin inside the container. The creator of the container loses all claim on the container and cannot apply any of the policies. Hence true BYOD separation is achieved, as the admin resides only inside container.

After creating the container, you call the API method KnoxContainerManager.doSelfUninstall() to uninstall the device admin, thus removing the MDM agent from device.