Since: Knox API Level 7
public class

KnoxEnterpriseLicenseManager

extends Object
java.lang.Object
   ↳ com.samsung.android.knox.license.KnoxEnterpriseLicenseManager

Class Overview

This class provides APIs to activate Knox Enterprise license on device.

Since
API level 7
KNOX 1.0.1

Summary

Constants
String ACTION_LICENSE_STATUS Broadcast Action : Sent to inform administrator about result of Knox License activation or validation.
int ERROR_INTERNAL Internal error.
int ERROR_INTERNAL_SERVER Internal server error.
int ERROR_INVALID_BINDING Application binding is invalid.
int ERROR_INVALID_LICENSE Invalid license.
int ERROR_INVALID_PACKAGE_NAME Invalid package name.
int ERROR_LICENSE_ACTIVATION_NOT_FOUND License not found, used for deactivation result
int ERROR_LICENSE_DEACTIVATED License deactivated.
int ERROR_LICENSE_EXPIRED License expired.
int ERROR_LICENSE_QUANTITY_EXHAUSTED License quantity exhausted.
int ERROR_LICENSE_QUANTITY_EXHAUSTED_ON_AUTO_RELEASE License quantity exhausted after automatic seat count release (ASR).
int ERROR_LICENSE_TERMINATED License terminated.
int ERROR_NETWORK_DISCONNECTED Network disconnected.
int ERROR_NETWORK_GENERAL General network error.
int ERROR_NONE Success.
int ERROR_NOT_CURRENT_DATE Not current date.
int ERROR_NULL_PARAMS null parameter.
int ERROR_UNKNOWN Unknown error.
int ERROR_USER_DISAGREES_LICENSE_AGREEMENT User disagrees License agreement.
String EXTRA_LICENSE_ERROR_CODE Used as an integer extra field with ACTION_LICENSE_STATUS.
String EXTRA_LICENSE_GRANTED_PERMISSIONS Used as StringArrayList extra field with ACTION_LICENSE_STATUS.
String EXTRA_LICENSE_RESULT_TYPE Used as integer extra field with ACTION_LICENSE_STATUS.
String EXTRA_LICENSE_STATUS This constant is deprecated. Not supported since KNOX 3.2. Use EXTRA_LICENSE_ERROR_CODE to check status.
int LICENSE_RESULT_TYPE_ACTIVATION Result Activation.
int LICENSE_RESULT_TYPE_DEACTIVATION Result De-Activation.
int LICENSE_RESULT_TYPE_VALIDATION Result Validation.
Public Methods
void activateLicense(String knoxLicenseKey)
API to activate Knox enterprise license.
void activateLicense(String knoxLicenseKey, String pkgName)
API to activate Knox enterprise license.
void deActivateLicense(String knoxLicenseKey)
API to de-activate Knox enterprise license.
void deActivateLicense(String knoxLicenseKey, String pkgName)
API to de-activate Knox enterprise license.
static KnoxEnterpriseLicenseManager getInstance(Context context)
API to create an instance of KnoxEnterpriseLicenseManager class.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String ACTION_LICENSE_STATUS

Since: Knox API Level 7

Broadcast Action : Sent to inform administrator about result of Knox License activation or validation. This targeted broadcast is sent only to the administrator who calls the activateLicense(String) API. Also system does periodic validation of KNOX license, administrator continuously needs to listen for this intent after activation. The intent will have the following extra value:
EXTRA_LICENSE_STATUS:
"success", "fail".

EXTRA_LICENSE_ERROR_CODE:
ERROR_NONE
ERROR_NULL_PARAMS
ERROR_UNKNOWN
ERROR_INVALID_LICENSE
ERROR_LICENSE_TERMINATED
ERROR_INTERNAL
ERROR_INTERNAL_SERVER
ERROR_NETWORK_DISCONNECTED
ERROR_NETWORK_GENERAL
ERROR_USER_DISAGREES_LICENSE_AGREEMENT
ERROR_LICENSE_DEACTIVATED
ERROR_LICENSE_EXPIRED
ERROR_LICENSE_QUANTITY_EXHAUSTED
ERROR_INVALID_PACKAGE_NAME
ERROR_LICENSE_ACTIVATION_NOT_FOUND

EXTRA_LICENSE_RESULT_TYPE:
LICENSE_RESULT_TYPE_ACTIVATION
LICENSE_RESULT_TYPE_VALIDATION
LICENSE_RESULT_TYPE_DEACTIVATION

EXTRA_LICENSE_GRANTED_PERMISSIONS

Since
API level 7
KNOX 1.0.1
Constant Value: "com.samsung.android.knox.intent.action.KNOX_LICENSE_STATUS"

public static final int ERROR_INTERNAL

Since: Knox API Level 7

Internal error.

Since
API level 7
KNOX 1.0.1
Constant Value: 301 (0x0000012d)

public static final int ERROR_INTERNAL_SERVER

Since: Knox API Level 7

Internal server error.

Since
API level 7
KNOX 1.0.1
Constant Value: 401 (0x00000191)

public static final int ERROR_INVALID_BINDING

Since: Knox API Level 26

Application binding is invalid. Either the application product type does not match with license product type or application is not bound to the given license key.

Since
API level 26
KNOX 3.2
Constant Value: 208 (0x000000d0)

public static final int ERROR_INVALID_LICENSE

Since: Knox API Level 7

Invalid license.

Since
API level 7
KNOX 1.0.1
Constant Value: 201 (0x000000c9)

public static final int ERROR_INVALID_PACKAGE_NAME

Since: Knox API Level 10

Invalid package name.

Since
API level 10
KNOX 1.2.0
Constant Value: 204 (0x000000cc)

public static final int ERROR_LICENSE_ACTIVATION_NOT_FOUND

Since: Knox API Level 10

License not found, used for deactivation result

Since
API level 10
KNOX 1.2.0
Constant Value: 703 (0x000002bf)

public static final int ERROR_LICENSE_DEACTIVATED

Since: Knox API Level 7

License deactivated.

Since
API level 7
KNOX 1.0.1
Constant Value: 700 (0x000002bc)

public static final int ERROR_LICENSE_EXPIRED

Since: Knox API Level 7

License expired.

Since
API level 7
KNOX 1.0.1
Constant Value: 701 (0x000002bd)

public static final int ERROR_LICENSE_QUANTITY_EXHAUSTED

Since: Knox API Level 7

License quantity exhausted.

Since
API level 7
KNOX 1.0.1
Constant Value: 702 (0x000002be)

public static final int ERROR_LICENSE_QUANTITY_EXHAUSTED_ON_AUTO_RELEASE

Since: Knox API Level 26

License quantity exhausted after automatic seat count release (ASR). Seats are automatically released if device has not validated license for a long time.

Since
API level 26
KNOX 3.2
Constant Value: 704 (0x000002c0)

public static final int ERROR_LICENSE_TERMINATED

Since: Knox API Level 7

License terminated.

Since
API level 7
KNOX 1.0.1
Constant Value: 203 (0x000000cb)

public static final int ERROR_NETWORK_DISCONNECTED

Since: Knox API Level 7

Network disconnected.

Since
API level 7
KNOX 1.0.1
Constant Value: 501 (0x000001f5)

public static final int ERROR_NETWORK_GENERAL

Since: Knox API Level 7

General network error.

Since
API level 7
KNOX 1.0.1
Constant Value: 502 (0x000001f6)

public static final int ERROR_NONE

Since: Knox API Level 7

Success.

Since
API level 7
KNOX 1.0.1
Constant Value: 0 (0x00000000)

public static final int ERROR_NOT_CURRENT_DATE

Since: Knox API Level 10

Not current date.

Since
API level 10
KNOX 1.2.0
Constant Value: 205 (0x000000cd)

public static final int ERROR_NULL_PARAMS

Since: Knox API Level 7

null parameter.

Since
API level 7
KNOX 1.0.1
Constant Value: 101 (0x00000065)

public static final int ERROR_UNKNOWN

Since: Knox API Level 7

Unknown error.

Since
API level 7
KNOX 1.0.1
Constant Value: 102 (0x00000066)

public static final int ERROR_USER_DISAGREES_LICENSE_AGREEMENT

Since: Knox API Level 7

User disagrees License agreement.

Since
API level 7
KNOX 1.0.1
Constant Value: 601 (0x00000259)

public static final String EXTRA_LICENSE_ERROR_CODE

Since: Knox API Level 7

Used as an integer extra field with ACTION_LICENSE_STATUS. Contains the error code of Knox license activation or validation result. In case of success, this extra will contain ERROR_NONE.

Since
API level 7
KNOX 1.0.1
Constant Value: "com.samsung.android.knox.intent.extra.KNOX_LICENSE_ERROR_CODE"

public static final String EXTRA_LICENSE_GRANTED_PERMISSIONS

Since: Knox API Level 30

Used as StringArrayList extra field with ACTION_LICENSE_STATUS. Contains the list of permissions given after an activation or validation.

Since
API level 30
KNOX 3.4.1
Constant Value: "com.samsung.android.knox.intent.extra.LICENSE_GRANTED_PERMISSIONS"

public static final String EXTRA_LICENSE_RESULT_TYPE

Since: Knox API Level 7

Used as integer extra field with ACTION_LICENSE_STATUS. This will tell whether this is activation or validation result.

Since
API level 7
KNOX 1.0.1
Constant Value: "com.samsung.android.knox.intent.extra.KNOX_LICENSE_RESULT_TYPE"

public static final String EXTRA_LICENSE_STATUS

Since: Knox API Level 7

This constant is deprecated.
Not supported since KNOX 3.2. Use EXTRA_LICENSE_ERROR_CODE to check status.

Used as String extra field with ACTION_LICENSE_STATUS. Contains the result of the Knox license activation or validation.

Since
API level 7
KNOX 1.0.1
Constant Value: "com.samsung.android.knox.intent.extra.KNOX_LICENSE_STATUS"

public static final int LICENSE_RESULT_TYPE_ACTIVATION

Since: Knox API Level 7

Result Activation.

Since
API level 7
KNOX 1.0.1
Constant Value: 800 (0x00000320)

public static final int LICENSE_RESULT_TYPE_DEACTIVATION

Since: Knox API Level 10

Result De-Activation.

Since
API level 10
KNOX 1.2.0
Constant Value: 802 (0x00000322)

public static final int LICENSE_RESULT_TYPE_VALIDATION

Since: Knox API Level 7

Result Validation.

Since
API level 7
KNOX 1.0.1
Constant Value: 801 (0x00000321)

Public Methods

public void activateLicense (String knoxLicenseKey)

Since: Knox API Level 7

API to activate Knox enterprise license.

Parameters
knoxLicenseKey provided by the MDM administrator
Usage
Administrator can use this API to activate Knox Enterprise license on device. MDM will broadcast intent with action ACTION_LICENSE_STATUS with string EXTRA_LICENSE_STATUS, integer EXTRA_LICENSE_ERROR_CODE and string EXTRA_LICENSE_RESULT_TYPE as extras in intent upon calling this API. This is a targeted broadcast intent, sent only to the administrator calling the activateLicense(String).

NOTE:

Administrator must be active before calling this API.

Since
API level 7
KNOX 1.0.1

public void activateLicense (String knoxLicenseKey, String pkgName)

Since: Knox API Level 11

API to activate Knox enterprise license.

Parameters
knoxLicenseKey provided by the MDM administrator
pkgName package name of the MDM administrator
Usage
Administrator can use this API to activate Knox Enterprise license on device. MDM will broadcast intent with action ACTION_LICENSE_STATUS with string EXTRA_LICENSE_STATUS, integer EXTRA_LICENSE_ERROR_CODE, and string EXTRA_LICENSE_RESULT_TYPE as extras in intent upon calling this API. This is a targeted broadcast intent, sent only to the administrator calling the activateLicense(String, String).

NOTE:

Active/non-active administrator can call this API.

Since
API level 11
KNOX 2.0

public void deActivateLicense (String knoxLicenseKey)

Since: Knox API Level 10

API to de-activate Knox enterprise license.

Parameters
knoxLicenseKey provided by the MDM administrator
Usage
Administrator can use this API to de-activate Knox Enterprise license on device. MDM will broadcast intent with action ACTION_LICENSE_STATUS with string EXTRA_LICENSE_STATUS and integer EXTRA_LICENSE_ERROR_CODE as an extra in intent upon calling this API. This is a targeted broadcast intent, sent only to the administrator calling the deActivateLicense(String).

NOTE:

Administrator must be active before calling this API.

Since
API level 10
KNOX 1.2.0

public void deActivateLicense (String knoxLicenseKey, String pkgName)

Since: Knox API Level 11

API to de-activate Knox enterprise license.

Parameters
knoxLicenseKey provided by the MDM administrator
pkgName package name of the MDM administrator
Throws
SecurityException If caller does not have required permissions
Usage
Administrator can use this API to de-activate Knox Enterprise license on device. MDM will broadcast intent with action ACTION_LICENSE_STATUS with string EXTRA_LICENSE_STATUS and integer EXTRA_LICENSE_ERROR_CODE as an extra in intent upon calling this API. This is a targeted broadcast intent, sent only to the administrator calling the deActivateLicense(String).

NOTE:

Active/non-active administrator can call this API.

Since
API level 11
KNOX 2.0

public static KnoxEnterpriseLicenseManager getInstance (Context context)

Since: Knox API Level 7

API to create an instance of KnoxEnterpriseLicenseManager class.

Parameters
context context of the application or service using this class
Returns
Usage
Used to get access to KnoxEnterpriseLicenseManager object

 KnoxEnterpriseLicenseManager mgr = KnoxEnterpriseLicenseManager.getInstance(context);
 
Since
API level 7
KNOX 1.0.1