@@ -4,9 +4,11 @@ The **adminManager** module provides enterprise device management capabilities s
...
@@ -4,9 +4,11 @@ The **adminManager** module provides enterprise device management capabilities s
> **NOTE**
> **NOTE**
>
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts).
> The APIs of this module can be used only in the stage model.
>
> The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts).
## Modules to Import
## Modules to Import
...
@@ -18,7 +20,7 @@ import adminManager from '@ohos.enterprise.adminManager';
...
@@ -18,7 +20,7 @@ import adminManager from '@ohos.enterprise.adminManager';
Enables a device administrator application of the current user. This API uses an asynchronous callback to return the result. The super administrator application can be enabled only by the administrator.
Enables a device administrator application for the current user. The super device administrator application can be activated only by the administrator. This API uses an asynchronous callback to return the result.
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator application to enable. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
Enables a device administrator application of the user specified by **userId**. This API uses an asynchronous callback to return the result. The super administrator application can be enabled only by the administrator.
Enables a device administrator application for the specified user. The super device administrator application can be activated only by the administrator. This API uses an asynchronous callback to return the result.
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator application to enable. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | Yes | User ID, which must be greater than or equal to 0.<br>The default value is the user ID of the caller. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
Enables a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in). This API uses a promise to return the result. The super administrator application can be enabled only by the administrator.
Enables a device administrator application for the current or specified user. The super device administrator application can be activated only by the administrator. This API uses a promise to return the result.
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| type | [AdminType](#admintype) | Yes | Type of the device administrator application to enable. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | No | User ID, which must be greater than or equal to 0.<br> - If **userId** is passed in, the application of the specified user is enabled.<br> - If **userId** is not passed in, the application of the current user is enabled.|
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ----------------- | ----------------- |
| ----------------- | ----------------- |
| Promise\<void> | Promise that returns no value. If the operation fails, an error object is thrown.|
| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Common administrator application to disable. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Common administrator application to disable. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | Yes | User ID, which must be greater than or equal to 0.<br>The default value is the user ID of the caller. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
Disables a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in). This API uses a promise to return the result.
Disables a common administrator application for the current or specified user. This API uses a promise to return the result.
| admin | [Want](js-apis-app-ability-want.md) | Yes | Common administrator application to disable. |
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | No | User ID, which must be greater than or equal to 0.<br> - If **userId** is passed in, the application of the specified user is disabled.<br> - If **userId** is not passed in, the application of the current user is disabled.|
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ----------------- | ----------------- |
| ----------------- | ----------------- |
| Promise\<void> | Promise that returns no value. If the operation fails, an error object is thrown.|
| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown.|
| bundleName | String | Yes | Bundle name of the super device administrator application. |
| bundleName | String | Yes | Bundle name of the super administrator application to disable. |
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
Checks whether a device administrator application of the user specified by **userId** is enabled. This API uses an asynchronous callback to return the result.
Checks whether a device administrator application of the specified user is enabled. This API uses an asynchronous callback to return the result.
| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | Yes | User ID, which must be greater than or equal to 0.<br> The default value is the user ID of the caller. |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object. |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object. |
Checks whether a device administrator application of the specified user (if **userId** is passed in) or the current user (if **userId** is not passed in) is enabled. This API uses a promise to return the result.
Checks whether a device administrator application of the current or specified user is enabled. This API uses a promise to return the result.
| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
| userId | number | No | User ID, which must be greater than or equal to 0.<br> - If **userId** is passed in, the application of the specified user is checked.<br> - If **userId** is not passed in, the application of the current user is checked.|
**Return value**
**Return value**
| Type | Description |
| Type | Description |
| ----------------- | ------------------- |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. If **true** is returned, the device administrator application is enabled. If **false** is returned, the device administrator application is not enabled.|
| Promise\<boolean> | Promise used to return the result. The value **true** means the device administrator application is enabled; the value **false** means the opposite.|
Checks whether a super device administrator application is enabled based on the specified bundle name. This API uses an asynchronous callback to return the result.
Checks whether a super administrator application of the administrator is enabled based on **bundleName**. This API uses an asynchronous callback to return the result.
| bundleName | String | Yes | Super administrator application to check. |
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the super device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
| callback | AsyncCallback\<boolean> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** means that the device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
Checks whether a super device administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
Checks whether a super administrator application of the administrator is enabled based on **bundleName**. This API uses a promise to return the result.
| bundleName | String | Yes | Super administrator application to check.|
**Return value**
**Return value**
| ID | Error Message |
| ID | Error Message |
| ----------------- | ------------------- |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. If **true** is returned, the super device administrator application is enabled. If **false** is returned, the super device administrator application is not enabled.|
| Promise\<boolean> | Promise used to return the result. The value **true** means the super administrator application is enabled; the value **false** means the opposite. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information to set. |
| callback | AsyncCallback\<void>; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| callback | AsyncCallback\<void>; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| Promise<[EnterpriseInfo](#enterpriseinfo)> | Promise used to return the enterprise information of the specified device administrator application obtained.|
| Promise<[EnterpriseInfo](#enterpriseinfo)> | Promise used to return the enterprise information obtained.|
Subscribes to system management events through the specified device administrator application. This API uses an asynchronous callback to return the result.
Subscribes to system management events of a device administrator application. This API uses an asynchronous callback to return the result.
Unsubscribes from system management events through the specified device administrator application. This API uses an asynchronous callback to return the result.
Unsubscribes from system management events of a device administrator application. This API uses an asynchronous callback to return the result.