java.lang.Object | |
↳ | com.samsung.android.knox.license.EnterpriseLicenseManager |
This class provides APIs to handle Enterprise license (ELM or BCK licenses) on device.
API level 6 |
MDM 4.0 |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_LICENSE_STATUS | Broadcast Action : Sent to inform about result of License activation or validation result. | |||||||||
int | ERROR_ANOTHER_PROCESS_IN_PLACE | The package is already activating/deactivating a license key and must wait the result to try again. | |||||||||
int | ERROR_INTERNAL | Indicates that an unexpected error occurred during operation. | |||||||||
int | ERROR_INTERNAL_SERVER | Indicates that an unexpected error occurred in license server during operation. | |||||||||
int | ERROR_INVALID_LICENSE | Indicates that an invalid license was used in the operation. | |||||||||
int | ERROR_INVALID_PACKAGE_NAME | Indicates that the license is missing binding to the calling application. | |||||||||
int | ERROR_LICENSE_TERMINATED | Indicates that the license used in the operation is in the terminated status and could not be used. | |||||||||
int | ERROR_NETWORK_DISCONNECTED | Indicates whether device network connectivity does not exist. | |||||||||
int | ERROR_NETWORK_GENERAL | Indicates that a network error occurred during the operation. | |||||||||
int | ERROR_NONE | Indicates that the operation was successfully performed. | |||||||||
int | ERROR_NOT_CURRENT_DATE | Indicates that device date is different than current date. | |||||||||
int | ERROR_NULL_PARAMS | Indicates that some operation parameter is invalid. | |||||||||
int | ERROR_SIGNATURE_MISMATCH | Indicates that the caller package has an invalid signature. | |||||||||
int | ERROR_UNKNOWN | Indicates that an unexpected error occurred during operation. | |||||||||
int | ERROR_USER_DISAGREES_LICENSE_AGREEMENT | Indicates that Knox End User License Agreement was not accepted. | |||||||||
int | ERROR_VERSION_CODE_MISMATCH | Caller package version code mismatch. | |||||||||
String | EXTRA_LICENSE_ATTESTATION_STATUS | Deprecated in API level 29 | |||||||||
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 |
Deprecated
Not supported since KNOX 3.2. Use EXTRA_LICENSE_ERROR_CODE to check status.
|
|||||||||
String | LICENSE_LOG_API | The lookup key for log data in JSON array returned by getApiCallDataByAdmin(String) |
|||||||||
String | LICENSE_LOG_DATE | The lookup key for log date in JSON array returned by getApiCallDataByAdmin(String) |
|||||||||
int | LICENSE_RESULT_TYPE_ACTIVATION | Indicates that this result refers to a Enterprise license activation. | |||||||||
int | LICENSE_RESULT_TYPE_VALIDATION | Indicates that this result refers to a Enterprise license validation. | |||||||||
int | STATUS_ATTESTED | Deprecated in API level 29 | |||||||||
int | STATUS_DEVICE_NOT_SUPPORTED | Deprecated in API level 29 | |||||||||
int | STATUS_NOT_ATTESTED | Deprecated in API level 29 | |||||||||
int | STATUS_UNKNOWN_ERROR | Deprecated in API level 29 |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Deprecated
in API level 37
NOTE: Applications can use activateLicense(String, LicenseResultCallback) since Android 14 to achieve the same result of this API.
| |||||||||||
API to activate an Enterprise license to the calling application with result sent via broadcast.
| |||||||||||
API to activate an Enterprise license to the calling application with result sent via callback.
| |||||||||||
Deprecated
in API level 37
NOTE: Applications can use activateLicense(String) since Android 14 to achieve the same result of this API.
| |||||||||||
API to retrieve API call data for the given packagename on device.
| |||||||||||
API to create an instance of EnterpriseLicenseManager class.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Broadcast Action : Sent to inform about result of License activation or validation result.
This targeted broadcast is sent only to the application who called the activateLicense(String)
API.
Also system does periodic validation of Enterprise 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_INVALID_PACKAGE_NAME
ERROR_NOT_CURRENT_DATE
EXTRA_LICENSE_RESULT_TYPE
:
LICENSE_RESULT_TYPE_ACTIVATION
LICENSE_RESULT_TYPE_VALIDATION
EXTRA_LICENSE_GRANTED_PERMISSIONS
EXTRA_LICENSE_ATTESTATION_STATUS
:
STATUS_ATTESTED
STATUS_NOT_ATTESTED
STATUS_DEVICE_NOT_SUPPORTED
STATUS_UNKNOWN_ERROR
API level 6 |
MDM 4.0 |
The package is already activating/deactivating a license key and must wait the result to try again.
API level 35 |
KNOX 3.8 |
Indicates that an unexpected error occurred during operation.
API level 6 |
MDM 4.0 |
Indicates that an unexpected error occurred in license server during operation.
API level 6 |
MDM 4.0 |
Indicates that an invalid license was used in the operation.
API level 6 |
MDM 4.0 |
Indicates that the license is missing binding to the calling application.
API level 9 |
MDM 4.1 |
Indicates that the license used in the operation is in the terminated status and could not be used.
API level 6 |
MDM 4.0 |
Indicates whether device network connectivity does not exist.
API level 6 |
MDM 4.0 |
Indicates that a network error occurred during the operation.
API level 6 |
MDM 4.0 |
Indicates that the operation was successfully performed.
API level 6 |
MDM 4.0 |
Indicates that device date is different than current date.
API level 9 |
MDM 4.1 |
Indicates that some operation parameter is invalid.
API level 6 |
MDM 4.0 |
Indicates that the caller package has an invalid signature. Check license binding.
API level 20 |
MDM 5.7 |
Indicates that an unexpected error occurred during operation.
API level 6 |
MDM 4.0 |
Indicates that Knox End User License Agreement was not accepted.
API level 6 |
MDM 4.0 |
Caller package version code mismatch.
API level 20 |
MDM 5.7 |
Deprecated in API level 29
Used as integer extra field with ACTION_LICENSE_STATUS
. Contains
the Remote Attestation status during license activation.
API level 20 |
MDM 5.7 |
Used as an integer extra field with ACTION_LICENSE_STATUS
. Contains
the error code of license activation or validation result. In case of success, this extra will contain ERROR_NONE
.
API level 6 |
MDM 4.0 |
Used as StringArrayList
extra field with ACTION_LICENSE_STATUS
.
Contains the list of permissions given after an activation or validation.
API level 30 |
KNOX 3.4.1 |
Used as integer extra field with ACTION_LICENSE_STATUS
.
This will tell whether this is activation or validation result.
API level 9 |
MDM 4.1 |
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 license activation or validation result.
API level 6 |
MDM 4.0 |
The lookup key for log data in JSON array returned by getApiCallDataByAdmin(String)
API level 6 |
MDM 4.0 |
The lookup key for log date in JSON array returned by getApiCallDataByAdmin(String)
API level 6 |
MDM 4.0 |
Indicates that this result refers to a Enterprise license activation.
API level 9 |
MDM 4.1 |
Indicates that this result refers to a Enterprise license validation.
API level 9 |
MDM 4.1 |
Deprecated in API level 29
Device is attested.
API level 20 |
MDM 5.7 |
Deprecated in API level 29
Device does not support Attestation
API level 20 |
MDM 5.7 |
Deprecated in API level 29
Device is not attested.
API level 20 |
MDM 5.7 |
Deprecated in API level 29
Attestation unknown error
API level 20 |
MDM 5.7 |
Deprecated
in API level 37
NOTE: Applications can use activateLicense(String, LicenseResultCallback)
since Android 14 to achieve the same result of this API.
API to activate an Enterprise license to the calling application with result sent via callback.
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); String licenseKey = "ELMLICENSEKEY"; mgr.activateLicense(licenseKey, context.getPackageName(), (licenseResult) -> { Log.w("License result arrived."); });
licenseKey | provided by the caller application |
---|---|
pkgName | package name of the application calling this API. |
callback | called when results are ready |
API level 35 |
KNOX 3.8 |
API to activate an Enterprise license to the calling application with result sent via broadcast. This targeted broadcast is sent only to the application who called this API.
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); String licenseKey = "ELMLICENSEKEY"; mgr.activateLicense(licenseKey);
The result of license activation is then notified through
an intent ACTION_LICENSE_STATUS
.
licenseKey | provided by the calling application |
---|
API level 6 |
MDM 4.0 |
API to activate an Enterprise license to the calling application with result sent via callback.
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); String licenseKey = "ELMLICENSEKEY"; mgr.activateLicense(licenseKey, (licenseResult) -> { Log.w("License result arrived."); });
licenseKey | provided by the caller application |
---|---|
callback | called when results are ready |
API level 35 |
KNOX 3.8 |
Deprecated
in API level 37
NOTE: Applications can use activateLicense(String)
since Android 14 to achieve the same result of this API.
API to activate an Enterprise license to the calling application with result sent via broadcast. This targeted broadcast is sent only to the application who called this API.
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); String licenseKey = "ELMLICENSEKEY"; mgr.activateLicense(licenseKey, context.getPackageName());
The result of license activation is then notified through
an intent ACTION_LICENSE_STATUS
.
licenseKey | provided by the caller application |
---|---|
pkgName | package name of the application calling this API. |
API level 11 |
MDM 5.0 |
API to retrieve API call data for the given packagename on device.
packageName | Packagename for which api data to be retrieved |
---|
null
, if no logs exist for that
packageNameUsed to get API call data in JSONArray in below key value format. [{ "log_date" :"DATE1" , "api_call" : {"API_1" : "CALLS_VALUE" , ... , "API_n" : "CALLS_VALUE"} "log_date" :"DATE2" , "api_call" : {"API_1" : "CALLS_VALUE" , ... , "API_n" : "CALLS_VALUE"} }]
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); String pkgName = "com.xyz.testadmin"; JSONArray arr = mgr.getApiCallDataByAdmin(pkgName); if (arr == null){ Log.w("EnterpriseLicenseManager.getApiCallDataByAdmin() failed"); return; } String result = arr.toString(); Log.w("EnterpriseLicenseManager.getApiCallDataByAdmin() result = " + result); |
The use of this API requires the caller to have the "com.samsung.android.knox.permission.KNOX_LICENSE_LOG" permission which has a protection level of signature. |
API level 6 |
MDM 4.0 |
API to create an instance of EnterpriseLicenseManager class.
context | context of the application or service using this class |
---|
EnterpriseLicenseManager
object, else null
Used to get access to EnterpriseLicenseManager object
EnterpriseLicenseManager mgr = EnterpriseLicenseManager.getInstance(context); |
API level 6 |
MDM 4.0 |