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

!8082 翻译完成 7024:js-apis-enterprise-device-manager.md

Merge pull request !8082 from ester.zhou/TR-7024
# Enterprise Device Management
> **NOTE**<br>
> 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\<boolean>): void
enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback\<boolean>): 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
ohos.permission.MANAGE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System capability**
**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\<boolean> | Yes | Callback used to return the result.|
SystemCapability.Customation.EnterpriseDeviceManager
**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\<boolean>): 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**: 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. |
| 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 | 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. |
**Example**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -51,7 +87,7 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -61,32 +97,28 @@ 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. |
| 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\<boolean> | Promise used to return the result. |
| Type | Description |
| ----------------- | ----------------- |
| Promise\<boolean> | Promise used to return the result.|
**Example**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -97,7 +129,7 @@ let enterpriseInfo = {
}
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);
});
......@@ -105,80 +137,103 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa
## enterpriseDeviceManager.disableAdmin
disableAdmin(admin: Want, userId?: number, callback: AsyncCallback\<boolean>): void
disableAdmin(admin: Want, callback: AsyncCallback\<boolean>): 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
ohos.permission.MANAGE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System capability**
**Parameters**
SystemCapability.Customation.EnterpriseDeviceManager
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | ------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application. |
| callback | AsyncCallback\<boolean> | 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\<boolean>): 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**: 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. |
| 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 | 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. |
**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;
}
console.log(result);
console.log("result is " + result);
});
```
## enterpriseDeviceManager.disableAdmin
disableAdmin(admin: Want, userId?: number): Promise\<boolean>
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**
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 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. |
| 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\<boolean> | Promise used to return the result. |
| Type | Description |
| ----------------- | ----------------- |
| Promise\<boolean> | Promise used to return the result.|
**Example**
```
```js
let wantTemp = {
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);
});
......@@ -190,27 +245,25 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): 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\<boolean> | Yes | Callback used to return the result. |
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | Yes | Bundle name of the device super administrator application. |
| callback | AsyncCallback\<boolean> | 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;
}
console.log(result);
console.log("result is " + result);
});
```
......@@ -220,28 +273,26 @@ disableSuperAdmin(bundleName: String): Promise\<boolean>
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\<boolean> | Promise used to return the result. |
| Type | Description |
| ----------------- | ----------------- |
| Promise\<boolean> | 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);
});
......@@ -249,72 +300,97 @@ enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => {
## enterpriseDeviceManager.isAdminEnabled
isAdminEnabled(admin: Want, userId?: number, callback: AsyncCallback\<boolean>): void
isAdminEnabled(admin: Want, callback: AsyncCallback\<boolean>): 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**
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ----------------------------------- | ---- | -------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
SystemCapability.Customation.EnterpriseDeviceManager
**Example**
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.isAdminEnabled(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
});
```
## enterpriseDeviceManager.isAdminEnabled
isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\<boolean>): 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 | 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 | 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. |
**Example**
```
```js
let wantTemp = {
bundleName: elementName.bundleName,
abilityName: elementName.abilityName,
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result);
console.log("result is " + result);
});
```
## enterpriseDeviceManager.isAdminEnabled
isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
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. |
| 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\<boolean> | Promise used to return the result. |
| Type | Description |
| ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result.|
**Example**
```
```js
let wantTemp = {
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);
});
......@@ -326,60 +402,54 @@ 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.
**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\<boolean> | Yes | Callback used to return the result. |
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | 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;
}
console.log(result);
console.log("result is " + result);
});
```
## enterpriseDeviceManager.isSuperAdmin
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.
**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\<boolean> | Promise used to return the result. |
| Type | Description |
| ----------------- | ------------------- |
| Promise\<boolean> | 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);
});
......@@ -391,19 +461,17 @@ getDeviceSettingsManager(callback: AsyncCallback&lt;DeviceSettingsManager&gt;):
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<DeviceSettingsManager&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained. |
| Name | Type | Mandatory | Description |
| -------- | --------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback<DeviceSettingsManager&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained.|
**Example**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
......@@ -423,31 +491,28 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
});
```
## enterpriseDeviceManager.getDeviceSettingsManager
getDeviceSettingsManager(): Promise&lt;DeviceSettingsManager&gt;
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&lt;DeviceSettingsManager&gt; | Promise used to return the **DeviceSettingsManager** object obtained. |
| Type | Description |
| ------------------------------------ | ---------------------------------- |
| Promise&lt;DeviceSettingsManager&gt; | Promise used to return the **DeviceSettingsManager** object obtained.|
**Example**
```
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
mgr.getDeviceSettingsManager().then((mgr) => {
enterpriseDeviceManager.getDeviceSettingsManager().then((mgr) => {
mgr.setDateTime(wantTemp, 1526003846000).then((value) => {
console.log(value);
}).catch((error) => {
......@@ -464,21 +529,19 @@ 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\<boolean&gt; | 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. |
| callback | AsyncCallback\<boolean&gt; | Yes | Callback used to return the result.|
**Example**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -489,39 +552,36 @@ let enterpriseInfo = {
}
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
```
## enterpriseDeviceManager.setEnterpriseInfo
setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise&lt;boolean&gt;
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\<boolean>; | Callback used to return the result. |
| Type | Description |
| ----------------- | --------------------- |
| Promise\<boolean> | Promise used to return the result.|
**Example**
```
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility",
......@@ -532,7 +592,7 @@ let enterpriseInfo = {
}
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => {
console.log(result);
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
});
......@@ -544,20 +604,18 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback&lt;EnterpriseInfo&gt;): 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&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 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&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 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",
......@@ -572,32 +630,29 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp, (error, result) => {
});
```
## enterpriseDeviceManager.getEnterpriseInfo
getEnterpriseInfo(admin: Want): Promise&lt;EnterpriseInfo&gt;
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&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise used to return the enterprise information of the device administrator application. |
| Type | Description |
| ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | 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",
......@@ -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.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册