diff --git a/en/application-dev/reference/apis/js-apis-enterprise-device-manager.md b/en/application-dev/reference/apis/js-apis-enterprise-device-manager.md
index 25c0dbf964cc82eaddc85ff1114c440afbd00d2d..1849150107a5922136403a0c01cb24eb1152d675 100644
--- a/en/application-dev/reference/apis/js-apis-enterprise-device-manager.md
+++ b/en/application-dev/reference/apis/js-apis-enterprise-device-manager.md
@@ -1,57 +1,93 @@
# Enterprise Device Management
-> **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 **enterpriseDeviceManager** module provides enterprise device management capabilities so that devices have the customization capabilities required in enterprise scenarios.
+> **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.
## Modules to Import
-```
+```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager';
```
-
## enterpriseDeviceManager.enableAdmin
-enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number, callback: AsyncCallback\): void
+enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback\): void
Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
-**Required permissions**
+**Required permissions**: ohos.permission.MANAGE_ADMIN
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ----------------------------------- | ---- | ------------------ |
+| admin | [Want](js-apis-application-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\ | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
+};
+let enterpriseInfo = {
+ name: "enterprise name",
+ description: "enterprise description"
+}
+enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, (error, result) => {
+ if (error != null) {
+ console.log("error occurs" + error);
+ return;
+ }
+ console.log("result is " + result);
+});
+```
+
+## enterpriseDeviceManager.enableAdmin
+
+enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback\): void
-ohos.permission.MANAGE_ADMIN
+Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
-**System capability**
+**Required permissions**: ohos.permission.MANAGE_ADMIN
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------- | -------- | -------- |
-| admin | [Want](js-apis-application-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. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| -------------- | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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\ | Yes | Callback used to return the result. |
**Example**
-```
+```js
let wantTemp = {
- bundleName: "com.example.myapplication",
- abilityName: "com.example.myapplication.MainAbility",
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
};
let enterpriseInfo = {
- name: "enterprise name",
- description: "enterprise description"
+ name: "enterprise name",
+ description: "enterprise description"
}
enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, 100, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
- console.log(result);
+ console.log("result is " + result);
});
```
@@ -61,126 +97,145 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
Enables a device administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
-**Required permissions**
-
-ohos.permission.MANAGE_ADMIN
+**Required permissions**: ohos.permission.MANAGE_ADMIN
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------------- | ---------------------------------------------- | ---- | ------------------------ |
-| admin | [Want](js-apis-application-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. |
+| Name | Type | Mandatory | Description |
+| -------------- | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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.|
**Return value**
- | Type | Description |
- | ----------------- | --------------------------- |
- | Promise\ | Promise used to return the result. |
+| Type | Description |
+| ----------------- | ----------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "com.example.myapplication",
- abilityName: "com.example.myapplication.MainAbility",
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
};
let enterpriseInfo = {
- name: "enterprise name",
- description: "enterprise description"
+ name: "enterprise name",
+ description: "enterprise description"
}
enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, 100)
.then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
## enterpriseDeviceManager.disableAdmin
-disableAdmin(admin: Want, userId?: number, callback: AsyncCallback\): void
+disableAdmin(admin: Want, callback: AsyncCallback\): void
Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
-**Required permissions**
+**Required permissions**: ohos.permission.MANAGE_ADMIN
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | ------------------- |
+| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "bundleName",
+ abilityName: "abilityName",
+};
+enterpriseDeviceManager.disableAdmin(wantTemp, (error, result) => {
+ if (error != null) {
+ console.log("error occurs" + error);
+ return;
+ }
+ console.log("result is " + result);
+});
+```
+
+## enterpriseDeviceManager.disableAdmin
+
+disableAdmin(admin: Want, userId: number, callback: AsyncCallback\): void
-ohos.permission.MANAGE_ADMIN
+Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
-**System capability**
+**Required permissions**: ohos.permission.MANAGE_ADMIN
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------------- | ---- | ------------------------------ |
-| admin | [Want](js-apis-application-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. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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\ | Yes | Callback used to return the result. |
**Example**
-```
+```js
let wantTemp = {
- bundleName: elementName.bundleName,
- abilityName: elementName.abilityName,
+ bundleName: "bundleName",
+ abilityName: "abilityName",
};
enterpriseDeviceManager.disableAdmin(wantTemp, 100, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
- console.log(result);
+ console.log("result is " + result);
});
```
-
-
## enterpriseDeviceManager.disableAdmin
disableAdmin(admin: Want, userId?: number): Promise\
Disables a device common administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
-**Required permissions**
+**Required permissions**: ohos.permission.MANAGE_ADMIN
-ohos.permission.MANAGE_ADMIN
-
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ---------------------------------------------- | ---- | ------------------ |
-| admin | [Want](js-apis-application-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. |
+| Name | Type | Mandatory | Description |
+| ------ | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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.|
**Return value**
- | Type | Description |
- | ----------------- | --------------------------- |
- | Promise\ | Promise used to return the result. |
+| Type | Description |
+| ----------------- | ----------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "bundleName",
- abilityName: "abilityName",
+ bundleName: "bundleName",
+ abilityName: "abilityName",
};
enterpriseDeviceManager.disableAdmin(wantTemp, 100).then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
@@ -190,27 +245,25 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\): void
Disables a device super administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ----------------------- | ---- | ------------------------------ |
- | bundleName | String | Yes | Bundle name of a device super administrator application. |
- | callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| ---------- | ----------------------- | ---- | ------------------- |
+| bundleName | String | Yes | Bundle name of the device super administrator application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
-```
+```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.disableSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
- console.log(result);
+ console.log("result is " + result);
});
```
@@ -220,68 +273,93 @@ disableSuperAdmin(bundleName: String): Promise\
Disables a device super administrator application based on the specified bundle name. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------ | ---- | ------------------------ |
- | bundleName | String | Yes | Bundle name of a device super administrator application. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ---- | ------------ |
+| bundleName | String | Yes | Bundle name of the device super administrator application.|
**Return value**
- | Type | Description |
- | ----------------- | --------------------------- |
- | Promise\ | Promise used to return the result. |
+| Type | Description |
+| ----------------- | ----------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
## enterpriseDeviceManager.isAdminEnabled
-isAdminEnabled(admin: Want, userId?: number, callback: AsyncCallback\): void
+isAdminEnabled(admin: Want, callback: AsyncCallback\): void
Checks whether a device administrator application is enabled based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------------- | ---- | -------------------------------- |
-| admin | [Want](js-apis-application-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. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | -------------------- |
+| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: elementName.bundleName,
- abilityName: elementName.abilityName,
+ bundleName: "bundleName",
+ abilityName: "abilityName",
};
-enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => {
+enterpriseDeviceManager.isAdminEnabled(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
- console.log(result);
+ console.log("result is " + result);
});
```
+## enterpriseDeviceManager.isAdminEnabled
+
+isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\): void
+
+Checks whether a device administrator application is enabled based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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\ | Yes | Callback used to return the result. |
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "bundleName",
+ abilityName: "abilityName",
+};
+enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => {
+ if (error != null) {
+ console.log("error occurs" + error);
+ return;
+ }
+ console.log("result is " + result);
+});
+```
## enterpriseDeviceManager.isAdminEnabled
@@ -289,34 +367,32 @@ isAdminEnabled(admin: Want, userId?: number): Promise\
Checks whether a device administrator application is enabled based on the specified bundle name and class name. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ---------------------------------------------- | ---- | -------------- |
-| admin | [Want](js-apis-application-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. |
+| Name | Type | Mandatory | Description |
+| ------ | ----------------------------------- | ---- | ---------------------------- |
+| admin | [Want](js-apis-application-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.|
**Return value**
- | Type | Description |
- | ----------------- | ------------------------------- |
- | Promise\ | Promise used to return the result. |
+| Type | Description |
+| ----------------- | ------------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "bundleName",
- abilityName: "abilityName",
+ bundleName: "bundleName",
+ abilityName: "abilityName",
};
enterpriseDeviceManager.isAdminEnabled(wantTemp, 100).then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
@@ -326,62 +402,56 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\): 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.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ----------------------- | ---- | -------------------------------- |
- | bundleName | String | Yes | Bundle name of a device super administrator application. |
- | callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| ---------- | ----------------------- | ---- | -------------------- |
+| bundleName | String | Yes | Device administrator application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Example**
-```
+```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
- console.log(result);
+ console.log("result is " + result);
});
```
-
-
## enterpriseDeviceManager.isSuperAdmin
isSuperAdmin(bundleName: String): Promise\
Checks whether a device super administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------ | ---- | ------------------ |
- | bundleName | String | Yes | Bundle name of a device super administrator application. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ---- | --------- |
+| bundleName | String | Yes | Device super administrator application.|
**Return value**
- | Type | Description |
- | ----------------- | ------------------------------- |
- | Promise\ | Promise used to return the result. |
+| Type | Description |
+| ----------------- | ------------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
@@ -391,27 +461,25 @@ getDeviceSettingsManager(callback: AsyncCallback<DeviceSettingsManager>):
Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callback to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
mgr.setDateTime(wantTemp, 1526003846000, (error, value) => {
if (error != null) {
@@ -423,31 +491,28 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
});
```
-
## enterpriseDeviceManager.getDeviceSettingsManager
getDeviceSettingsManager(): Promise<DeviceSettingsManager>
Obtains a **DeviceSettingsManager** object. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Return value**
- | Type | Description |
- | -------- | -------- |
- | Promise<DeviceSettingsManager> | Promise used to return the **DeviceSettingsManager** object obtained. |
+| Type | Description |
+| ------------------------------------ | ---------------------------------- |
+| Promise<DeviceSettingsManager> | Promise used to return the **DeviceSettingsManager** object obtained.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "bundleName",
- abilityName: "abilityName",
+ bundleName: "bundleName",
+ abilityName: "abilityName",
};
-mgr.getDeviceSettingsManager().then((mgr) => {
+enterpriseDeviceManager.getDeviceSettingsManager().then((mgr) => {
mgr.setDateTime(wantTemp, 1526003846000).then((value) => {
console.log(value);
}).catch((error) => {
@@ -464,77 +529,72 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa
Sets the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | ---------------------------------------------- | ---- | ------------------------------------ |
- | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
- | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. |
- | callback | AsyncCallback\ {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
-
## enterpriseDeviceManager.setEnterpriseInfo
setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise<boolean>
Sets the enterprise information of a device administrator application. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | ---------------------------------------------- | ---- | ------------------------ |
- | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
- | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. |
+| Name | Type | Mandatory | Description |
+| -------------- | ----------------------------------- | ---- | ------------ |
+| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
+| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.|
**Return value**
- | Type | Description |
- | ------------------ | ----------------------------------- |
- | Promise\; | Callback used to return the result. |
+| Type | Description |
+| ----------------- | --------------------- |
+| Promise\ | Promise used to return the result.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "com.example.myapplication",
- abilityName: "com.example.myapplication.MainAbility",
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
};
let enterpriseInfo = {
- name: "enterprise name",
- description: "enterprise description"
+ name: "enterprise name",
+ description: "enterprise description"
}
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => {
- console.log(result);
+ console.log("result is " + result);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
@@ -544,69 +604,64 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v
Obtains the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------------------------------------ | ---- | ---------------------------------------- |
- | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
- | callback | AsyncCallback<[EnterpriseInfo](#EnterpriseInfo)> | Yes | Callback used to return the enterprise information of the device administrator application. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------ |
+| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
+| callback | AsyncCallback<[EnterpriseInfo](#EnterpriseInfo)> | Yes | Callback used to return the enterprise information of the device administrator application.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "com.example.myapplication",
- abilityName: "com.example.myapplication.MainAbility",
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
};
enterpriseDeviceManager.getEnterpriseInfo(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
- return;
+ return;
}
console.log(result.name);
- console.log(result.description);
+ console.log(result.description);
});
```
-
## enterpriseDeviceManager.getEnterpriseInfo
getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo>
Obtains the enterprise information of a device administrator application. This API uses a promise to return the result.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
- | Name | Type | Mandatory | Description |
- | ------ | ---------------------------------------------- | ---- | -------------- |
- | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
**Return value**
- | Type | Description |
- | ------------------------------------------------ | ------------------------------------------- |
- | Promise<[EnterpriseInfo](#EnterpriseInfo)> | Promise used to return the enterprise information of the device administrator application. |
+| Type | Description |
+| ---------------------------------------- | ------------------------- |
+| Promise<[EnterpriseInfo](#EnterpriseInfo)> | Promise used to return the enterprise information of the device administrator application.|
**Example**
-```
+```js
let wantTemp = {
- bundleName: "com.example.myapplication",
- abilityName: "com.example.myapplication.MainAbility",
+ bundleName: "com.example.myapplication",
+ abilityName: "com.example.myapplication.MainAbility",
};
enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
- console.log(result.name);
- console.log(result.description);
+ console.log(result.name);
+ console.log(result.description);
}).catch(error => {
- console.log("error occurs" + error);
+ console.log("error occurs" + error);
});
```
@@ -614,25 +669,20 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
Describes the enterprise information of a device administrator application.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
-
- | Name | Readable/Writable | Type | Mandatory | Description |
- | ----------- | -------- | ------ | ---- | ---------------------------------- |
- | name | Read only | string | Yes | Name of the enterprise to which the device administrator application belongs. |
- | description | Read only | string | Yes | Description of the enterprise to which the device administrator application belongs. |
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+| Name | Readable/Writable| Type | Mandatory | Description |
+| ----------- | ---- | ------ | ---- | ----------------- |
+| name | Read only | string | Yes | Name of the enterprise to which the device administrator application belongs.|
+| description | Read only | string | Yes | Description of the enterprise to which the device administrator application belongs.|
## AdminType
Enumerates the administrator types of the device administrator application.
-**System capability**
-
-SystemCapability.Customation.EnterpriseDeviceManager
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
- | Name | Default Value | Description |
- | -------- | -------- | -------- |
- | ADMIN_TYPE_NORMAL | 0x00 | Common administrator. |
- | ADMIN_TYPE_SUPER | 0x01 | Super administrator. |
+| Name | Default Value | Description |
+| ----------------- | ---- | ----- |
+| ADMIN_TYPE_NORMAL | 0x00 | Common administrator.|
+| ADMIN_TYPE_SUPER | 0x01 | Super administrator.|