提交 23bfd4e2 编写于 作者: E ester.zhou

update js-apis-enterprise-device-manager.md (7024)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 d281652b
# Enterprise Device Management # Enterprise Device Management
> **NOTE**<br> The **enterpriseDeviceManager** module provides enterprise device management capabilities so that devices have the customization capabilities required in enterprise scenarios.
> 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.
> **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 ## Modules to Import
``` ```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'; import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager';
``` ```
## enterpriseDeviceManager.enableAdmin ## 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. 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to enable. | | type | [AdminType](#AdminType) | Yes | Type of the device administrator 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. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. |
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -51,7 +87,7 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa ...@@ -51,7 +87,7 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -61,32 +97,28 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ...@@ -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. 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** **Required permissions**: ohos.permission.MANAGE_ADMIN
ohos.permission.MANAGE_ADMIN
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------ | | -------------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to enable. | | type | [AdminType](#AdminType) | Yes | Type of the device administrator 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** **Return value**
| Type | Description | | Type | Description |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -97,7 +129,7 @@ let enterpriseInfo = { ...@@ -97,7 +129,7 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, 100) enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, 100)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -105,80 +137,103 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa ...@@ -105,80 +137,103 @@ enterpriseDeviceManager.enableAdmin(wantTemp, enterpriseInfo, enterpriseDeviceMa
## enterpriseDeviceManager.disableAdmin ## 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. 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------------- | ---- | ------------------------------ | | -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application. | | 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. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. |
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: elementName.bundleName, bundleName: "bundleName",
abilityName: elementName.abilityName, abilityName: "abilityName",
}; };
enterpriseDeviceManager.disableAdmin(wantTemp, 100, (error, result) => { enterpriseDeviceManager.disableAdmin(wantTemp, 100, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
## enterpriseDeviceManager.disableAdmin ## enterpriseDeviceManager.disableAdmin
disableAdmin(admin: Want, userId?: number): Promise\<boolean> 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. 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** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ---------------------------------------------- | ---- | ------------------ | | ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application. | | 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** **Return value**
| Type | Description | | Type | Description |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
}; };
enterpriseDeviceManager.disableAdmin(wantTemp, 100).then((result) => { enterpriseDeviceManager.disableAdmin(wantTemp, 100).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -190,27 +245,25 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void ...@@ -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. Disables a device super administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | ------------------------------ | | ---------- | ----------------------- | ---- | ------------------- |
| bundleName | String | Yes | Bundle name of a device super administrator application. | | bundleName | String | Yes | Bundle name of the device super administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
**Example** **Example**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.disableSuperAdmin(bundleName, (error, result) => { enterpriseDeviceManager.disableSuperAdmin(bundleName, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
...@@ -220,28 +273,26 @@ disableSuperAdmin(bundleName: String): Promise\<boolean> ...@@ -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. Disables a device super administrator application based on the specified bundle name. This API uses a promise to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------------------ | | ---------- | ------ | ---- | ------------ |
| bundleName | String | Yes | Bundle name of a device super administrator application. | | bundleName | String | Yes | Bundle name of the device super administrator application.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------- | --------------------------- | | ----------------- | ----------------- |
| Promise\<boolean> | Promise used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => { enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -249,72 +300,97 @@ enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => { ...@@ -249,72 +300,97 @@ enterpriseDeviceManager.disableSuperAdmin(bundleName).then((result) => {
## enterpriseDeviceManager.isAdminEnabled ## 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. 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** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------------- | ---- | -------------------------------- | | -------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | 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. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. |
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: elementName.bundleName, bundleName: "bundleName",
abilityName: elementName.abilityName, abilityName: "abilityName",
}; };
enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => { enterpriseDeviceManager.isAdminEnabled(wantTemp, 100, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
## enterpriseDeviceManager.isAdminEnabled ## enterpriseDeviceManager.isAdminEnabled
isAdminEnabled(admin: Want, userId?: number): Promise\<boolean> 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. 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** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ---------------------------------------------- | ---- | -------------- | | ------ | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | 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** **Return value**
| Type | Description | | Type | Description |
| ----------------- | ------------------------------- | | ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
}; };
enterpriseDeviceManager.isAdminEnabled(wantTemp, 100).then((result) => { enterpriseDeviceManager.isAdminEnabled(wantTemp, 100).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -326,60 +402,54 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void ...@@ -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. 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** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | -------------------------------- | | ---------- | ----------------------- | ---- | -------------------- |
| bundleName | String | Yes | Bundle name of a device super administrator application. | | bundleName | String | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
**Example** **Example**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => { enterpriseDeviceManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) { if (error != null) {
console.log("error occurs" + error); console.log("error occurs" + error);
return; return;
} }
console.log(result); console.log("result is " + result);
}); });
``` ```
## enterpriseDeviceManager.isSuperAdmin ## enterpriseDeviceManager.isSuperAdmin
isSuperAdmin(bundleName: String): Promise\<boolean> 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 device super administrator application is enabled based on the specified bundle name. This API uses a promise to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------------ | | ---------- | ------ | ---- | --------- |
| bundleName | String | Yes | Bundle name of a device super administrator application. | | bundleName | String | Yes | Device super administrator application.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ----------------- | ------------------------------- | | ----------------- | ------------------- |
| Promise\<boolean> | Promise used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let bundleName = "com.example.myapplication"; let bundleName = "com.example.myapplication";
enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => { enterpriseDeviceManager.isSuperAdmin(bundleName).then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -391,19 +461,17 @@ getDeviceSettingsManager(callback: AsyncCallback&lt;DeviceSettingsManager&gt;): ...@@ -391,19 +461,17 @@ getDeviceSettingsManager(callback: AsyncCallback&lt;DeviceSettingsManager&gt;):
Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callback to return the result. Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callback to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- | | -------- | --------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback<DeviceSettingsManager&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained. | | callback | AsyncCallback<DeviceSettingsManager&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
...@@ -423,31 +491,28 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { ...@@ -423,31 +491,28 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
}); });
``` ```
## enterpriseDeviceManager.getDeviceSettingsManager ## enterpriseDeviceManager.getDeviceSettingsManager
getDeviceSettingsManager(): Promise&lt;DeviceSettingsManager&gt; getDeviceSettingsManager(): Promise&lt;DeviceSettingsManager&gt;
Obtains a **DeviceSettingsManager** object. This API uses a promise to return the result. Obtains a **DeviceSettingsManager** object. This API uses a promise to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------- | -------- | | ------------------------------------ | ---------------------------------- |
| Promise&lt;DeviceSettingsManager&gt; | Promise used to return the **DeviceSettingsManager** object obtained. | | Promise&lt;DeviceSettingsManager&gt; | Promise used to return the **DeviceSettingsManager** object obtained.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "bundleName", bundleName: "bundleName",
abilityName: "abilityName", abilityName: "abilityName",
}; };
mgr.getDeviceSettingsManager().then((mgr) => { enterpriseDeviceManager.getDeviceSettingsManager().then((mgr) => {
mgr.setDateTime(wantTemp, 1526003846000).then((value) => { mgr.setDateTime(wantTemp, 1526003846000).then((value) => {
console.log(value); console.log(value);
}).catch((error) => { }).catch((error) => {
...@@ -464,21 +529,19 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa ...@@ -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. Sets the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------------------ | | -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the 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. | | callback | AsyncCallback\<boolean&gt; | Yes | Callback used to return the result.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -489,39 +552,36 @@ let enterpriseInfo = { ...@@ -489,39 +552,36 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo) enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
``` ```
## enterpriseDeviceManager.setEnterpriseInfo ## enterpriseDeviceManager.setEnterpriseInfo
setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise&lt;boolean&gt; 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. Sets the enterprise information of a device administrator application. This API uses a promise to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------ | | -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------ | ----------------------------------- | | ----------------- | --------------------- |
| Promise\<boolean>; | Callback used to return the result. | | Promise\<boolean> | Promise used to return the result.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -532,7 +592,7 @@ let enterpriseInfo = { ...@@ -532,7 +592,7 @@ let enterpriseInfo = {
} }
enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo) enterpriseDeviceManager.setEnterpriseInfo(wantTemp, enterpriseInfo)
.then((result) => { .then((result) => {
console.log(result); console.log("result is " + result);
}).catch(error => { }).catch(error => {
console.log("error occurs" + error); console.log("error occurs" + error);
}); });
...@@ -544,20 +604,18 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback&lt;EnterpriseInfo&gt;): v ...@@ -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. Obtains the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ------------------------------------------------------ | ---- | ---------------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | 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. | | callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Yes | Callback used to return the enterprise information of the device administrator application.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -572,32 +630,29 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp, (error, result) => { ...@@ -572,32 +630,29 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp, (error, result) => {
}); });
``` ```
## enterpriseDeviceManager.getEnterpriseInfo ## enterpriseDeviceManager.getEnterpriseInfo
getEnterpriseInfo(admin: Want): Promise&lt;EnterpriseInfo&gt; 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. Obtains the enterprise information of a device administrator application. This API uses a promise to return the result.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------ | ---------------------------------------------- | ---- | -------------- | | ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------ | ------------------------------------------- | | ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise 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 device administrator application.|
**Example** **Example**
``` ```js
let wantTemp = { let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "com.example.myapplication.MainAbility", abilityName: "com.example.myapplication.MainAbility",
...@@ -614,25 +669,20 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => { ...@@ -614,25 +669,20 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
Describes the enterprise information of a device administrator application. Describes the enterprise information of a device administrator application.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
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. |
| 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 ## AdminType
Enumerates the administrator types of the device administrator application. Enumerates the administrator types of the device administrator application.
**System capability** **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
SystemCapability.Customation.EnterpriseDeviceManager
| Name | Default Value | Description | | Name | Default Value | Description |
| -------- | -------- | -------- | | ----------------- | ---- | ----- |
| ADMIN_TYPE_NORMAL | 0x00 | Common administrator. | | ADMIN_TYPE_NORMAL | 0x00 | Common administrator.|
| ADMIN_TYPE_SUPER | 0x01 | Super administrator. | | ADMIN_TYPE_SUPER | 0x01 | Super administrator.|
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册