未验证 提交 c2a0aabc 编写于 作者: O openharmony_ci 提交者: Gitee

!19520 [翻译完成】#I76J75

Merge pull request !19520 from Annie_wang/PR18357
......@@ -4,7 +4,8 @@ The **accountManager** module provides APIs for account management of enterprise
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. 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 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -48,7 +49,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
accountManager.disallowAddLocalAccount(admin, true, (error) => {
accountManager.disallowAddLocalAccount(wantTemp, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
......
......@@ -31,7 +31,7 @@ Enables a device administrator application of the current user. This API uses an
| admin | [Want](js-apis-app-ability-want.md) | Yes | 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. |
| callback | AsyncCallback\<void> | Yes | Callback used 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**
......@@ -82,8 +82,8 @@ Enables a device administrator application of the user specified by **userId**.
| admin | [Want](js-apis-app-ability-want.md) | Yes | 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. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
| 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**.|
| 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**
......@@ -119,7 +119,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_
enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise\<void>
Enables a device administrator application of the user specified by **userId** (if any) or the current user. 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 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.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -134,7 +134,7 @@ Enables a device administrator application of the user specified by **userId** (
| admin | [Want](js-apis-app-ability-want.md) | Yes | 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. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| 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**.|
**Return value**
......@@ -173,7 +173,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_
disableAdmin(admin: Want, callback: AsyncCallback\<void>): void
Disables a device common administrator application of the current user. This API uses an asynchronous callback to return the result.
Disables a device administrator application of the current user. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -185,8 +185,8 @@ Disables a device common administrator application of the current user. This API
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback used 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 | Device administrator application. |
| 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**
......@@ -216,7 +216,7 @@ adminManager.disableAdmin(wantTemp, error => {
disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void
Disables a device common administrator application of the user specified by **userId**. This API uses an asynchronous callback to return the result.
Disables a device administrator application of the user specified by **userId**. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -228,9 +228,9 @@ Disables a device common administrator application of the user specified by **us
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<void> | Yes | Callback used 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 | Device administrator application. |
| 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**.|
| 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**
......@@ -260,7 +260,7 @@ adminManager.disableAdmin(wantTemp, 100, error => {
disableAdmin(admin: Want, userId?: number): Promise\<void>
Disables a device administrator application of the user specified by **userId** (if any) or the current user. This API uses a promise to return the result.
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.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -272,8 +272,8 @@ Disables a device administrator application of the user specified by **userId**
| Name | Type | Mandatory | Description |
| ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device common administrator application. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| 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**.|
**Return value**
......@@ -305,7 +305,7 @@ adminManager.disableAdmin(wantTemp, 100).catch(error => {
disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void
Disables a device super administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
Disables a super device administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -317,8 +317,8 @@ Disables a device super administrator application based on the specified bundle
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | Yes | Bundle name of the device super administrator application. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| bundleName | String | Yes | Bundle name of the super device administrator application. |
| 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**
......@@ -345,7 +345,7 @@ adminManager.disableSuperAdmin(bundleName, error => {
disableSuperAdmin(bundleName: String): Promise\<void>
Disables a device super administrator application based on the specified bundle name. This API uses a promise to return the result.
Disables a super device administrator application based on the specified bundle name. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
......@@ -357,7 +357,7 @@ Disables a device super administrator application based on the specified bundle
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
| bundleName | String | Yes | Bundle name of the device super administrator application.|
| bundleName | String | Yes | Bundle name of the super device administrator application.|
**Return value**
......@@ -397,7 +397,7 @@ Checks whether a device administrator application of the current user is enabled
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | -------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used 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.|
**Example**
......@@ -430,8 +430,8 @@ Checks whether a device administrator application of the user specified by **use
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<boolean> | Yes | Callback used 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. |
| 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**.|
| 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. |
**Example**
......@@ -453,7 +453,7 @@ adminManager.isAdminEnabled(wantTemp, 100, (error, result) => {
isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
Checks whether a device administrator application of the user specified by **userId** (if any) or the current user is enabled. This API uses a promise to return the result.
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.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -464,7 +464,7 @@ Checks whether a device administrator application of the user specified by **use
| Name | Type | Mandatory | Description |
| ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| 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**.|
**Return value**
......@@ -490,7 +490,7 @@ adminManager.isAdminEnabled(wantTemp, 100).then((result) => {
isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
Checks whether a device super administrator application is enabled based on the specified bundle name. This API uses an asynchronous callback to return the result.
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.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -501,7 +501,7 @@ Checks whether a device super administrator application is enabled based on the
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used 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 super device administrator application is enabled; and **false** means the opposite). If the operation fails, **err** is an error object.|
**Example**
......@@ -520,7 +520,7 @@ adminManager.isSuperAdmin(bundleName, (error, result) => {
isSuperAdmin(bundleName: String): Promise\<boolean>
Checks whether a device super administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
Checks whether a super device administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -530,13 +530,13 @@ Checks whether a device super administrator application is enabled based on the
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | --------- |
| bundleName | String | Yes | Device super administrator application.|
| bundleName | String | Yes | Super device administrator application.|
**Return value**
| ID | Error Message |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. If **true** is returned, the device super administrator application is enabled. If **false** is returned, the device super administrator application is not enabled.|
| 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.|
**Example**
......@@ -567,7 +567,7 @@ Sets the enterprise information of a device administrator application. This API
| -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| callback | AsyncCallback\<void>; | Yes | Callback used 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**
......@@ -661,7 +661,7 @@ Obtains the enterprise information of a device administrator application. This A
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the enterprise information of the device administrator application. If the operation fails, **err** is an error object.|
| callback | AsyncCallback&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the enterprise information of the device administrator application obtained. If the operation fails, **err** is an error object.|
**Error codes**
......@@ -708,7 +708,7 @@ Obtains the enterprise information of a device administrator application. This A
| Type | Description |
| ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Callback used to return the enterprise information of the device administrator application.|
| Promise&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Promise used to return the enterprise information of the specified device administrator application obtained.|
**Error codes**
......@@ -737,7 +737,7 @@ adminManager.getEnterpriseInfo(wantTemp).then((result) => {
subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void
Configures a device administrator application to subscribe to system management events. This API uses an asynchronous callback to return the result.
Subscribes to system management events through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -751,7 +751,7 @@ Configures a device administrator application to subscribe to system management
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| managedEvents | Array\<[ManagedEvent](#managedevent)> | Yes| Array of events to subscribe to.|
| callback | AsyncCallback\<void> | Yes| Callback used 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**
......@@ -781,7 +781,7 @@ adminManager.subscribeManagedEvent(wantTemp, events, (error) => {
subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>
Configures a device administrator application to subscribe to system management events. This API uses a promise to return the result.
Subscribes to system management events through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -829,7 +829,7 @@ adminManager.subscribeManagedEvent(wantTemp, events).then(() => {
unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void
Configures a device administrator application to unsubscribe from system management events. 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.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -843,7 +843,7 @@ Configures a device administrator application to unsubscribe from system managem
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| managedEvents | Array\<[ManagedEvent](#managedevent)> | Yes| Array of events to unsubscribe from.|
| callback | AsyncCallback\<void> | Yes| Callback used 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**
......@@ -873,7 +873,7 @@ adminManager.unsubscribeManagedEvent(wantTemp, events, (error) => {
unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>
Configures a device administrator application to unsubscribe from system management events. This API uses a promise to return the result.
Unsubscribes from system management events through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT
......@@ -919,7 +919,7 @@ adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
## EnterpriseInfo
Describes the enterprise information of a device administrator application.
Defines the enterprise information of a device administrator application.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -953,7 +953,7 @@ Enumerates the system management events that can be subscribed to.
| Name | Value | Description |
| -------------------------- | ---- | ------------- |
| MANAGED_EVENT_BUNDLE_ADDED | 0 | Bundle added.|
| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Bundle removed.|
| MANAGED_EVENT_BUNDLE_ADDED | 0 | Application installed.|
| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Application uninstalled.|
| MANAGED_EVENT_APP_START<sup>10+</sup> | 2 | Application started.|
| MANAGED_EVENT_APP_STOP<sup>10+</sup> | 3 | Application stopped.|
# @ohos.enterprise.applicationManager (Application Management)
The **applicationManager** module provides application management capabilities, including adding applications to or removing applications from an application blocklist, and obtaining the application blocklist. The application blocklist contains the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
The **applicationManager** module provides application management capabilities, including adding, removing, and obtaining the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
> **NOTE**
>
......@@ -17,7 +17,7 @@ import applicationManager from '@ohos.enterprise.applicationManager';
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds applications to the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the administrator user.
Adds a list of applications that are forbidden to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -37,7 +37,7 @@ Adds applications to the application blocklist using the specified device admini
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -63,7 +63,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds applications to the application list for a user using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the user specified by **userId**.
Adds a list of applications that are forbidden to run by a given user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -84,7 +84,7 @@ Adds applications to the application list for a user using the specified device
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -109,7 +109,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) =>
addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds applications to the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the added applications cannot run under the specified user. If **userId** is not passed in, the added applications cannot run under the current user.
Adds a list of applications that are forbiddedn to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -135,7 +135,7 @@ Adds applications to the application blocklist using the specified device admini
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -160,7 +160,7 @@ applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() =>
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes applications from the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the current user.
Removes a list of applications that are forbiddedn to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -180,7 +180,7 @@ Removes applications from the application blocklist using the specified device a
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -205,7 +205,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes applications from the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the user specified by **userId**.
Removes a list of applications that are forbiddedn to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -226,7 +226,7 @@ Removes applications from the application blocklist of a user using the specifie
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -251,7 +251,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error)
removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes applications from the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called to remove applications from the blocklist, the applications in the blocklist cannot run under the specified user. If **userId** is not passed in, the applications in the blocklist cannot run under the current user.
Removes a list of applications that are forbiddedn to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -277,7 +277,7 @@ Removes applications from the application blocklist using the specified device a
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -302,7 +302,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(()
getDisallowedRunningBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the application blocklist of the administrator user using the specified device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of applications that are firbidded to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -321,7 +321,7 @@ Obtains the application blocklist of the administrator user using the specified
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -345,7 +345,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of applications that are firbidded to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -365,7 +365,7 @@ Obtains the application blocklist of a user using the specified device administr
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -389,7 +389,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
getDisallowedRunningBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the device administrator application obtains the application blocklist of the specified user. If **userId** is not passed in, the device administrator application obtains the application blocklist of the current user.
Obtains the list of applications that are firbidded to run by the specified user (if **userId** is passed in) or current user (if **userId** is not passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
......@@ -408,13 +408,13 @@ Obtains the application blocklist using the specified device administrator appli
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the application blocklist of the administrator user.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the application blocklist of the current user.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......
......@@ -4,8 +4,8 @@ The **bundleManager** module provides APIs for bundle management, including addi
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -17,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager';
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -29,20 +29,20 @@ Adds a list of bundles that are allowed to be installed by the current administr
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -62,7 +62,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -74,21 +74,21 @@ Adds a list of bundles that are allowed to be installed by the given user (speci
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -108,7 +108,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Adds a list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -120,9 +120,9 @@ Adds a list of bundles that are allowed to be installed by the current administr
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the allowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
**Return value**
......@@ -134,12 +134,12 @@ Adds a list of bundles that are allowed to be installed by the current administr
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -159,7 +159,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are allowed to be installed by the current user through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -171,20 +171,20 @@ Removes a list of bundles that are allowed to be installed by the current admini
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -204,7 +204,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -216,21 +216,21 @@ Removes a list of bundles that are allowed to be installed by the given user (sp
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -250,7 +250,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result.
Removes a list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -262,9 +262,9 @@ Removes a list of bundles that are allowed to be installed by the current admini
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed from the allowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
**Return value**
......@@ -276,12 +276,12 @@ Removes a list of bundles that are allowed to be installed by the current admini
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -301,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
getAllowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -313,19 +313,19 @@ Obtains the list of bundles that are allowed to be installed by the current admi
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used 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 | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -344,7 +344,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, (error) => {
getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -356,20 +356,20 @@ Obtains the list of bundles that are allowed to be installed by the given user (
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used 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 | Device administrator application. |
| 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**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -388,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
getAllowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Obtains the list of bundles that are allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -400,25 +400,25 @@ Obtains the list of bundles that are allowed to be installed by the current admi
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| 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**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the allowed bundle list.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the list of the bundles obtained.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -436,7 +436,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -448,20 +448,20 @@ Adds a list of bundles that are not allowed to be installed by the current admin
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -481,7 +481,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, (error) => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Adds a list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -493,21 +493,21 @@ Adds a list of bundles that are not allowed to be installed by the given user (s
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -527,7 +527,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Adds a list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -539,9 +539,9 @@ Adds a list of bundles that are not allowed to be installed by the current admin
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
**Return value**
......@@ -553,12 +553,12 @@ Adds a list of bundles that are not allowed to be installed by the current admin
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -578,7 +578,7 @@ bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -590,20 +590,20 @@ Removes a list of bundles that are not allowed to be installed by the current ad
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -623,7 +623,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Removes a list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -635,21 +635,21 @@ Removes a list of bundles that are not allowed to be installed by the given user
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used 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 | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -669,7 +669,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Removes a list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -681,9 +681,9 @@ Removes a list of bundles that are not allowed to be installed by the current ad
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
**Return value**
......@@ -695,12 +695,12 @@ Removes a list of bundles that are not allowed to be installed by the current ad
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -720,7 +720,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are not allowed to be installed by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -732,19 +732,19 @@ Obtains the list of bundles that are not allowed to be installed by the current
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used 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 | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -763,7 +763,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, (error) => {
getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
Obtains the list of bundles that are not allowed to be installed by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -775,20 +775,20 @@ Obtains the list of bundles that are not allowed to be installed by the given us
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used 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 | Device administrator application. |
| 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**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -807,7 +807,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
getDisallowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
Obtains the list of bundles that are not allowed to be installed by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
......@@ -819,27 +819,26 @@ Obtains the list of bundles that are not allowed to be installed by the current
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| 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**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the allowed bundle list.|
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the list of the bundles obtained.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
......@@ -849,3 +848,427 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void
Adds a list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void
Adds a list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;
Adds a list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added. |
| 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**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void
Removes a list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void
Removes a list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;
Removes a list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed. |
| 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**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains the list of bundles that are not allowed to be uninstalled by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains the list of bundles that are not allowed to be uninstalled by the given user (specified by **userId**) through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| 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**.|
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;
Obtains the list of bundles that are not allowed to be uninstalled by the current user (if **userId** is not passed in) or the given user (if **userId** is passed in) through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| 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**.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the bundle list obtained.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((data) => {
console.log("success: " + data);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
......@@ -4,7 +4,8 @@ The **dateTimeManager** module provides APIs for system time management. Only th
> **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 of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import dateTimeManager from '@ohos.enterprise.dateTimeManager'
setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
Configures a device administrator application to set the system time. This API uses an asynchronous callback to return the result.
Sets the system time through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -29,8 +30,8 @@ Configures a device administrator application to set the system time. This API u
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
| time | number | Yes| Timestamp to set, in ms.|
| 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**
......@@ -59,7 +60,7 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => {
setDateTime(admin: Want, time: number): Promise\<void>
Configures a device administrator application to set the system time. This API uses a promise to return the result.
Sets the system time through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -72,7 +73,7 @@ Configures a device administrator application to set the system time. This API u
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| time | number | Yes| Timestamp to set, in ms.|
**Return value**
......@@ -106,7 +107,7 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<void>): void
Configures a device administrator application to disable modification of the system time. This API uses an asynchronous callback to return the result.
Disallows modification of the system time through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -120,7 +121,7 @@ Configures a device administrator application to disable modification of the sys
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disallow | boolean | Yes| Whether to disable modification of the system time. The value **true** means to disable modification of the system time, and **false** means the opposite.|
| callback | AsyncCallback\<void> | Yes| Callback used 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**
......@@ -149,7 +150,7 @@ dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
Configures a device administrator application to disable modification of the system time. This API uses a promise to return the result.
Disallows modification of the system time through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -168,7 +169,7 @@ Configures a device administrator application to disable modification of the sys
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | that returns no value. If the operation fails, an error object is thrown.|
| Promise\<void> | Promise that returns no value. An error object is thrown if the operation fails.|
**Error codes**
......@@ -196,7 +197,7 @@ dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
Configures a device administrator application to check whether modification of the system time is disabled. This API uses an asynchronous callback to return the result.
Checks whether the modification of the system time is disallowed through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -209,7 +210,7 @@ Configures a device administrator application to check whether modification of t
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
| callback | AsyncCallback\<boolean> | Yes| Callback invoked to return the result. The value **true** means that modification of the system time is disallowed, and **false** means the opposite.|
**Error codes**
......@@ -238,7 +239,7 @@ dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
Configures a device administrator application to check whether modification of the system time is disabled. This API uses a promise to return the result.
Checks whether the modification of the system time is disallowed through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_DATETIME
......@@ -256,7 +257,7 @@ Configures a device administrator application to check whether modification of t
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **true** means that modification of the system time is disabled, and **false** means the opposite.|
| Promise\<boolean> | Promise used to return the result. The value **true** means that modification of the system time is disallowed, and **false** means the opposite.|
**Error codes**
......@@ -274,7 +275,7 @@ let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
dateTimeManager.disallowModifyDateTime(wantTemp).then(() => {
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
......
# @ohos.enterprise.deviceControl (Device Control Management)
# @ohos.enterprise.deviceControl (Device Control)
The **deviceControl** module provides APIs for device control, which can only be called by device administrator applications.
The **deviceControl** module provides APIs for device control, which can be called only by device administrator applications.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. 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 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -18,6 +19,7 @@ resetFactory(admin: Want, callback: AsyncCallback\<void>): void
Restores factory settings. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESET_DEVICE
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -28,8 +30,8 @@ Restores factory settings. This API uses an asynchronous callback to return the
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the setting is successful, **err** is **null**. Otherwise, **err** is an error object.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application used to restore the factory settings.|
| 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**
......@@ -40,7 +42,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......@@ -70,13 +72,13 @@ Restores factory settings. This API uses a promise to return the result.
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application used to restore the factory settings.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | Promise that returns no value.|
| Promise\<void> | Promise that returns no value. If the operation fails, an error object is thrown.|
**Error codes**
......@@ -87,7 +89,7 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
**Example**
```js
let wantTemp = {
......
# @ohos.enterprise.deviceInfo (Device Information Management)
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. These APIs can only be called by device administrator applications.
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. Only the enterprise device administrator applications can call the APIs provided by this module.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. 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 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import deviceInfo from '@ohos.enterprise.deviceInfo';
getDeviceSerial(admin: Want, callback: AsyncCallback&lt;string&gt;): void
Configures a device administrator application to obtain the device serial number. This API uses an asynchronous callback to return the result.
Obtains the device serial number through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -29,13 +30,13 @@ Configures a device administrator application to obtain the device serial number
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device serial number obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device serial number obtained. If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -60,7 +61,7 @@ deviceInfo.getDeviceSerial(wantTemp, (error, result) => {
getDeviceSerial(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device serial number. This API uses a promise to return the result.
Obtains the device serial number through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -84,7 +85,7 @@ Configures a device administrator application to obtain the device serial number
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -107,7 +108,7 @@ deviceInfo.getDeviceSerial(wantTemp).then((result) => {
getDisplayVersion(admin: Want, callback: AsyncCallback&lt;string&gt;): void;
Configures a device administrator application to obtain the device version number. This API uses an asynchronous callback to return the result.
Obtains the device version number through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -120,13 +121,13 @@ Configures a device administrator application to obtain the device version numbe
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device version number obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device version number obtained. If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -151,7 +152,7 @@ deviceInfo.getDisplayVersion(wantTemp, (error, result) => {
getDisplayVersion(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device version number. This API uses a promise to return the result.
Obtains the device version number through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -175,7 +176,7 @@ Configures a device administrator application to obtain the device version numbe
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -198,7 +199,7 @@ deviceInfo.getDisplayVersion(wantTemp).then((result) => {
getDeviceName(admin: Want, callback: AsyncCallback&lt;string&gt;): void
Configures a device administrator application to obtain the device name. This API uses an asynchronous callback to return the result.
Obtains the device name through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -211,13 +212,13 @@ Configures a device administrator application to obtain the device name. This AP
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.<br> If the operation is successful, **err** is **null** and **data** is the device name obtained. If the operation fails, **err** is an error object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device name obtained. If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -242,7 +243,7 @@ deviceInfo.getDeviceName(wantTemp, (error, result) => {
getDeviceName(admin: Want): Promise&lt;string&gt;
Configures a device administrator application to obtain the device name. This API uses a promise to return the result.
Obtains the device name through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_DEVICE_INFO
......@@ -266,7 +267,7 @@ Configures a device administrator application to obtain the device name. This AP
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......
......@@ -4,7 +4,8 @@ The **networkManager** module provides APIs for network management of enterprise
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. 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 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,9 +17,9 @@ import networkManager from '@ohos.enterprise.networkManager';
getAllNetworkInterfaces(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
Obtains all active network interfaces through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains all active network interfaces through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -47,7 +48,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.getAllNetworkInterfaces(admin, (error, result) => {
networkManager.getAllNetworkInterfaces(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
......@@ -60,7 +61,7 @@ networkManager.getAllNetworkInterfaces(admin, (error, result) => {
getAllNetworkInterfaces(admin: Want): Promise&lt;Array&lt;string&gt;&gt;
Obtains all active network interfaces through a device administrator application. This API uses a promise to return the result.
Obtains all active network interfaces through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -107,9 +108,9 @@ networkManager.getAllNetworkInterfaces(wantTemp).then((result) => {
getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the device IP address based on the given network interface through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains the device IP address based on the given network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_NETWORK_INFO
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -152,7 +153,7 @@ networkManager.getIpAddress(wantTemp, "eth0", (error, result) => {
getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
Obtains the device IP address based on the given network interface through a device administrator application. This API uses a promise to return the result.
Obtains the device IP address based on the given network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -200,7 +201,7 @@ networkManager.getIpAddress(wantTemp, "eth0").then((result) => {
getMac(admin: Want, networkInterface: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the device MAC address based on the given network interface through a device administrator application. This API uses an asynchronous callback to return the result.
Obtains the device MAC address based on the given network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -245,7 +246,7 @@ networkManager.getMac(wantTemp, "eth0", (error, result) => {
getIpAddress(admin: Want, networkInterface: string): Promise&lt;string&gt;
Obtain the device MAC address based on the given network interface through a device administrator application. This API uses a promise to return the result.
Obtain the device MAC address based on the given network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
......@@ -288,3 +289,191 @@ networkManager.getMac(wantTemp, "eth0").then((result) => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## networkManager.isNetworkInterfaceDisabled
isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether a network interface is disabled through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information. |
| networkInterface | string | Yes | Network interface. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**, and **data** indicates whether the network interface is disabled. The value **true** means the network interface is disabled; and **false** means the opposite. If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0", (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("result:" + result);
});
```
## networkManager.isNetworkInterfaceDisabled
isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise&lt;boolean&gt;
Checks whether a network interface is disabled through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information.|
| networkInterface | string | Yes | Network interface. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result. The value **true** means the network interface is disabled, and the value **false** means the opposite. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.isNetworkInterfaceDisabled(wantTemp, "eth0").then((result) => {
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## networkManager.setNetworkInterfaceDisabled
setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean, callback: AsyncCallback&lt;void&gt;): void
Sets a network interface through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_NETWORK
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information. |
| networkInterface | string | Yes | Network interface. |
| isDisabled | boolean | Yes | Network interface status to set. The value **true** means to disable the network interface, and **false** means to enable the network interface. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("setNetworkInterfaceDisabled success!");
});
```
## networkManager.setNetworkInterfaceDisabled
setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: boolean): Promise&lt;void&gt;
Sets a network interface through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_NETWORK
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that obtains the information.|
| networkInterface | string | Yes | Network interface. |
| isDisabled | boolean | Yes | Network interface status to set. The value **true** means to disable the network interface, and **false** means to enable the network interface. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. An error object is thrown if the network interface fails to be disabled. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device.|
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
networkManager.setNetworkInterfaceDisabled(wantTemp, "eth0", true).then(() => {
console.log("setNetworkInterfaceDisabled success!");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
......@@ -4,7 +4,8 @@ The **wifiManager** module provides APIs for Wi-Fi management of enterprise devi
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. 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 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import
......@@ -16,7 +17,7 @@ import wifiManager from '@ohos.enterprise.wifiManager';
isWifiActive(admin: Want, callback: AsyncCallback&lt;boolean&gt;): void
Checks whether Wi-Fi is active through a device administrator application. This API uses an asynchronous callback to return the result.
Checks whether Wi-Fi is active through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
......@@ -52,7 +53,7 @@ wifiManager.isWifiActive(wantTemp, (error, result) => {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
console.log("result:" + result);
});
```
......@@ -60,7 +61,7 @@ wifiManager.isWifiActive(wantTemp, (error, result) => {
isWifiActive(admin: Want): Promise&lt;boolean&gt;
Checks whether Wi-Fi is active through a device administrator application. This API uses a promise to return the result.
Checks whether Wi-Fi is active through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI
......@@ -97,7 +98,7 @@ let wantTemp = {
abilityName: "EntryAbility",
};
wifiManager.isWifiActive(wantTemp).then((result) => {
console.log(result);
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
......@@ -139,7 +140,7 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
......@@ -194,12 +195,12 @@ let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let profile : WifiProfile = {
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.isWifiActive(wantTemp, profile).then(() => {
wifiManager.setWifiProfile(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册