×

Informative message

The Knox namespaces are changing

In July 2019, we are phasing out the old Knox namespaces to align with current Android conventions.
To do this, you will need to migrate to the Knox SDK. For more information on how to update your app(s), read our migration guide.

Knox Premium SDK

FAQs

There are two methods. You can:

  • call an API to do a one-time check if a container exists
  • set up an intent to detect in real-time when container creation completes (recommended)

Call API

To check if a Knox container was created and to get the container ID, call this API method:

KnoxContainerManager.getContainers()

This API was introduced with the Knox Premium SDK v2.0. This API method can be called by the app which created the container.

Note: In Knox Premium SDK v1.0, this deprecated API method was used:

EnterpriseContainerManager.getOwnContainers()

Set up intent

With the Knox Premium SDK v2.0, you can register for the intent:

com.samsung.knox.container.creation.status

This intent is sent after you create a container by calling the API method:

KnoxContainerManager.createContainer()

The intent is generated regardless of whether container creation succeeds or fails, and for both Knox v1.0 as well as v2.0.

The intent uses CONTAINER_CREATION_STATUS_CODE to return either a:

  • positive non-zero value - This is a container ID.
  • negative value - This is an error code, as described in the Javadocs for createContainer.

The intent also uses CONTAINER_CREATION_REQUEST_ID so that you can match a createContainer request with a result.

Handle intent

In the Android manifest file:

<receiver android:name=".ContainerReceiver" android:exported="true" > <intent-filter> <action android:name=" com.samsung.knox.container.creation.status " /> </intent-filter> </receiver>

In the broadcast receiver:

public class KnoxContainerCreationReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent ){ //do something } }

Rate this article


Related Items