提交 f64cc0dc 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
上级 08263582
......@@ -394,8 +394,10 @@
- [@ohos.enterprise.dateTimeManager (System Time Management)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (Device Control Management)](js-apis-enterprise-deviceControl.md)
- [@ohos.enterprise.deviceInfo (Device Information Management)](js-apis-enterprise-deviceInfo.md)
- [@ohos.enterprise.deviceSettings (Device Settings Management)](js-apis-enterprise-deviceSettings.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager (Network Management)](js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.restrictions (Restrictions)](js-apis-enterprise-restrictions.md)
- [@ohos.enterprise.wifiManager (Wi-Fi Management)](js-apis-enterprise-wifiManager.md)
- Common Library
......
# Enterprise Device Management Overview (Available Only for System Applications)
## Overview
OpenHarmony provides Enterprise Device Management APIs to support enterprise APIs. You can use the APIs to implement system-level management and configuration of employee devices. For example, the IT personnel need to install enterprise applications, set security policies, set enterprise email addresses, access enterprise networks, and remotely restore factory settings (to clear lost or stolen device data).
## Developing Enterprise Management Applications
### Basic Concepts
- Device administrator application: a system application that has the [EnterpriseAdminExtensionAbility](../../application-models/enterprise-extensionAbility.md).
### Constraints
- Only the stage model is supported.
### Environment Setup
- [Download DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio#download) and set it up as instructed on the official website.
- [Download ohos-sdk-full](../../../release-notes/OpenHarmony-v3.2-beta2.md#acquiring-source-code-from-mirrors).
### How to Develop
1. Use DevEco Studio to create a project and [switch to full-sdk](../../faqs/full-sdk-switch-guide.md).
2. In the [HarmonyAppProvision file](../../security/accesstoken-overview.md#application-apls), set the **app-feature** field to **hos_system_app**.
3. Create [EnterpriseAdminExtensionAbility](../../application-models/enterprise-extensionAbility.md).
4. Declare the permissions required. Before requesting permissions, ensure that the [basic principles for permission management](../../security/accesstoken-overview.md#basic-principles-for-permission-management) are met. Then, [declare the permissions](../../security/accesstoken-guidelines.md#acl).
### API Reference
To implement network management and Wi-Fi management, see:
- [@ohos.enterprise.accountManager (Account Management)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (Application Management)](js-apis-enterprise-applicationManager.md)
- [@ohos.enterprise.bundleManager (Bundle Management)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (System Time Management)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (Device Control Management)](js-apis-enterprise-deviceControl.md)
- [@ohos.enterprise.deviceInfo (Device Information Management)](js-apis-enterprise-deviceInfo.md)
- [@ohos.enterprise.deviceSettings (Device Settings Management](js-apis-enterprise-deviceSettings.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager (Network Management)](js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.restrictions (Restrictions)](js-apis-enterprise-restrictions.md)
- [@ohos.enterprise.wifiManager (Wi-Fi Management)](js-apis-enterprise-wifiManager.md)
# @ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
The **EnterpriseAdminExtensionAbility** module provides Extension abilities for enterprise administrators.
The **EnterpriseAdminExtensionAbility** module provides extended enterprise device management capabilities.
To have the capabilities provided by the module, for example, receiving the application activation or deactivation notification sent by the system, an enterprise administrator application must have an **EnterpriseAdminExtensionAbility** instance and override the APIs in it.
To have the capabilities provided by this module, for example, to receive a notification when a device administrator application is enabled or disabled, you need to create an **EnterpriseAdminExtensionAbility** instance for the enterprise administrator application and overload related APIs.
> **NOTE**
>
......@@ -20,7 +20,7 @@ import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExt
onAdminEnabled(): void
Called when an enterprise administrator is enabled.
Called when a device administrator application is enabled.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -39,7 +39,7 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil
onAdminDisabled(): void
Called when an enterprise administrator is disabled.
Called when a device administrator application is disabled.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
......@@ -66,7 +66,7 @@ Called when a bundle is added.
**Parameters**
| Parameter | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Name of the bundle added.|
......@@ -75,7 +75,7 @@ Called when a bundle is added.
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("added bundle name: " + bundleName);
console.info(`Succeeded in calling onBundleAdded callback, added bundle name : ${bundleName}`);
}
};
```
......@@ -92,7 +92,7 @@ Called when a bundle is removed.
**Parameters**
| Parameter | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Name of the bundle removed.|
......@@ -100,8 +100,8 @@ Called when a bundle is removed.
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("removed bundle name: " + bundleName);
onBundleRemoved(bundleName: string) {
console.info(`Succeeded in calling onBundleRemoved callback, removed bundle name : ${bundleName}`);
}
};
```
......@@ -118,7 +118,7 @@ Called when an application is started.
**Parameters**
| Parameter | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Bundle name of the application started.|
......@@ -127,7 +127,7 @@ Called when an application is started.
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onAppStart(bundleName: string) {
console.log("started bundle name: " + bundleName);
console.info(`Succeeded in calling onAppStart callback, started bundle name : ${bundleName}`);
}
};
```
......@@ -144,7 +144,7 @@ Called when an application is stopped.
**Parameters**
| Parameter | Type | Mandatory | Description |
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Bundle name of the application stopped.|
......@@ -153,7 +153,7 @@ Called when an application is stopped.
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onAppStop(bundleName: string) {
console.log("stopped bundle name: " + bundleName);
console.info(`Succeeded in calling onAppStop callback, stopped bundle name : ${bundleName}`);
}
};
```
# @ohos.enterprise.accountManager (Account Management)
The **accountManager** module provides APIs for account management of enterprise devices. Only the device administrator applications can call the APIs provided by this module.
The **accountManager** module provides APIs for account management of enterprise devices.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -46,13 +47,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
accountManager.disallowAddLocalAccount(wantTemp, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
accountManager.disallowAddLocalAccount(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to disallow add local account. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disallowing add local account');
});
```
......@@ -94,12 +98,13 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
accountManager.disallowAddLocalAccount(wantTemp, true).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in disallowing add local account');
}).catch((err) => {
console.error(`Failed to disallow add local account. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -4,7 +4,9 @@ The **adminManager** module provides enterprise device management capabilities s
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts).
## Modules to Import
......@@ -47,19 +49,20 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_SUPER, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("enableAdmin success");
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_SUPER, (err) => {
if (err) {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in enabling admin');
});
```
......@@ -99,19 +102,20 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("enableAdmin success");
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100, (err) => {
if (err) {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in enabling admin');
});
```
......@@ -156,16 +160,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100)
.catch(error => {
console.log("error occurs" + error);
adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_TYPE_NORMAL, 100).catch((err) => {
console.error(`Failed to enable admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -200,15 +204,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableAdmin success ");
adminManager.disableAdmin(wantTemp, (err) => {
if (err) {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling admin');
});
```
......@@ -244,15 +249,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, 100, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableAdmin success ");
adminManager.disableAdmin(wantTemp, 100, (err) => {
if (err) {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling admin');
});
```
......@@ -293,11 +299,12 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.disableAdmin(wantTemp, 100).catch(error => {
console.log("error occurs" + error);
adminManager.disableAdmin(wantTemp, 100).catch((err) => {
console.error(`Failed to disable admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -324,20 +331,21 @@ Disables a super device administrator application based on the specified bundle
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ----------------------------------------------------------------- |
| 9200005 | failed to disable the administrator application of the device. |
**Example**
```js
let bundleName = "com.example.myapplication";
adminManager.disableSuperAdmin(bundleName, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("disableSuperAdmin success");
let bundleName = 'com.example.myapplication';
adminManager.disableSuperAdmin(bundleName, (err) => {
if (err) {
console.error(`Failed to disable super admin. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in disabling super admin');
});
```
......@@ -376,9 +384,10 @@ For details about the error codes, see [Enterprise Device Management Error Codes
**Example**
```js
let bundleName = "com.example.myapplication";
adminManager.disableSuperAdmin(bundleName).catch(error => {
console.log("error occurs" + error);
let bundleName = 'com.example.myapplication';
adminManager.disableSuperAdmin(bundleName).catch((err) => {
console.error(`Failed to disable super admin. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -403,15 +412,16 @@ Checks whether a device administrator application of the current user is enabled
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
adminManager.isAdminEnabled(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query admin is enabled or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
});
```
......@@ -437,15 +447,16 @@ Checks whether a device administrator application of the user specified by **use
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, 100, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
adminManager.isAdminEnabled(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to query admin is enabled. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
});
```
......@@ -476,13 +487,14 @@ Checks whether a device administrator application of the specified user (if **us
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
adminManager.isAdminEnabled(wantTemp, 100).then((result) => {
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in querying admin is enabled or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query admin is enabled or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -506,13 +518,14 @@ Checks whether a super device administrator application is enabled based on the
**Example**
```js
let bundleName = "com.example.myapplication";
adminManager.isSuperAdmin(bundleName, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("result is " + result);
let bundleName = 'com.example.myapplication';
adminManager.isSuperAdmin(bundleName, (err, result) => {
if (err) {
console.error(`Failed to query admin is super admin or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in querying admin is super admin or not, result : ${result}`);
});
```
......@@ -541,11 +554,12 @@ Checks whether a super device administrator application is enabled based on the
**Example**
```js
let bundleName = "com.example.myapplication";
let bundleName = 'com.example.myapplication';
adminManager.isSuperAdmin(bundleName).then((result) => {
console.log("result is " + result);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in querying admin is super admin or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query admin is super admin or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -581,19 +595,20 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo, error => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log("setEnterpriseInfo success");
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo, (err) => {
if (err) {
console.error(`Failed to set enterprise info. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in setting enterprise info');
});
```
......@@ -634,15 +649,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let enterpriseInfo = {
name: "enterprise name",
description: "enterprise description"
name: 'enterprise name',
description: 'enterprise description'
}
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo).catch(error => {
console.log("error occurs" + error);
adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo).catch((err) => {
console.error(`Failed to set enterprise info. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -675,16 +691,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
adminManager.getEnterpriseInfo(wantTemp, (error, result) => {
if (error != null) {
console.log("error occurs" + error);
return;
}
console.log(result.name);
console.log(result.description);
adminManager.getEnterpriseInfo(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get enterprise info. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting enterprise info, enterprise name : ${result.name}, enterprise description : ${result.description}`);
});
```
......@@ -722,14 +738,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
adminManager.getEnterpriseInfo(wantTemp).then((result) => {
console.log(result.name);
console.log(result.description);
}).catch(error => {
console.log("error occurs" + error);
console.info(`Succeeded in getting enterprise info, enterprise name : ${result.name}, enterprise description : ${result.description}`);
}).catch((err) => {
console.error(`Failed to get enterprise info. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -766,14 +782,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.subscribeManagedEvent(wantTemp, events, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
adminManager.subscribeManagedEvent(wantTemp, events, (err) => {
if (err) {
console.error(`Failed to subscribe managed event. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in subscribe managed event');
});
```
......@@ -815,13 +834,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.subscribeManagedEvent(wantTemp, events).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to subscribe managed event. Code: ${err.code}, message: ${err.message}`);
})
```
......@@ -858,14 +878,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.unsubscribeManagedEvent(wantTemp, events, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
adminManager.unsubscribeManagedEvent(wantTemp, events, (err) => {
if (err) {
console.error(`Failed to unsubscribe managed event. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in unsubscribe managed event');
});
```
......@@ -907,13 +930,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
let events = [0, 1];
adminManager.unsubscribeManagedEvent(wantTemp, events).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to unsubscribe managed event. Code: ${err.code}, message: ${err.message}`);
})
```
......@@ -925,10 +949,10 @@ Defines the enterprise information of a device administrator application.
**System API**: This is a system API.
| Name | Type | Readable| Writable | Description |
| ----------- | --------| ---- | ----- | ------------------------------- |
| name | string | Yes | No | Name of the enterprise to which the device administrator application belongs.|
| description | string | Yes | No | Description of the enterprise to which the device administrator application belongs.|
| Name | Type | Mandatory| Description |
| ----------- | --------| ---- | ------------------------------- |
| name | string | Yes | Name of the enterprise to which the device administrator application belongs.|
| description | string | Yes | Description of the enterprise to which the device administrator application belongs.|
## AdminType
......
# @ohos.enterprise.applicationManager (Application Management)
The **applicationManager** module provides application management capabilities, including adding, removing, and obtaining the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
The **applicationManager** module provides application management capabilities, including adding, removing, and obtaining the applications that are forbidden to run.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -37,7 +38,7 @@ Adds a list of applications that are forbidden to run by the current user throug
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -47,15 +48,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed running bundles');
});
```
......@@ -84,7 +87,7 @@ Adds a list of applications that are forbidden to run by a given user through th
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -93,15 +96,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in adding disallowed running bundles');
});
```
......@@ -135,7 +140,7 @@ Adds a list of applications that are forbiddedn to run by the specified user (if
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -144,15 +149,15 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in adding disallowed running bundles');
}).catch((err) => {
console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -180,7 +185,7 @@ Removes a list of applications that are forbiddedn to run by the current user th
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -189,15 +194,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (err) => {
if (err) {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed running bundles');
});
```
......@@ -226,7 +233,7 @@ Removes a list of applications that are forbiddedn to run by the specified user
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -235,15 +242,17 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (err) => {
if (err) {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in removing disallowed running bundles');
});
```
......@@ -277,7 +286,7 @@ Removes a list of applications that are forbiddedn to run by the specified user
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -286,15 +295,15 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds = ["com.example.myapplication"];
let appIds = ['com.example.myapplication'];
applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in removing disallowed running bundles');
}).catch((err) => {
console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
......@@ -321,7 +330,7 @@ Obtains the list of applications that are firbidded to run by the current user t
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -330,14 +339,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
applicationManager.getDisallowedRunningBundles(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -365,7 +376,7 @@ Obtains the list of applications that are firbidded to run by the specified user
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -374,14 +385,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
applicationManager.getDisallowedRunningBundles(wantTemp, 100, (err, result) => {
if (err) {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
});
```
......@@ -414,7 +427,7 @@ Obtains the list of applications that are firbidded to run by the specified user
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
......@@ -423,12 +436,13 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
applicationManager.getDisallowedRunningBundles(wantTemp, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
applicationManager.getDisallowedRunningBundles(wantTemp, 100).then((result) => {
console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`);
}).catch((err) => {
console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`);
});
```
# @ohos.enterprise.dateTimeManager (System Time Management)
The **dateTimeManager** module provides APIs for system time management. Only the enterprise device administrator applications can call the APIs provided by this module.
The **dateTimeManager** module provides APIs for system time 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 APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -46,13 +47,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.setDateTime(wantTemp, 1526003846000, (err) => {
if (err) {
console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in setting date time');
})
```
......@@ -94,12 +98,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in setting date time');
}).catch((err) => {
console.error(`Failed to set date time. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -136,13 +142,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.disallowModifyDateTime(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in disallowing modify date time');
})
```
......@@ -184,12 +193,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in disallowing modify date time');
}).catch((err) => {
console.error(`Failed to disallow modify date time. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -225,13 +236,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in querying modify date time is disallowed : ${result}`);
})
```
......@@ -272,11 +286,13 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
dateTimeManager.isModifyDateTimeDisallowed(wantTemp).then((result) => {
console.info(`Succeeded in querying modify date time is disallowed : ${result}`);
}).catch((err) => {
console.error(`Failed to query modify date time is disallowed or not. Code is ${err.code}, message is ${err.message}`);
})
```
......@@ -3,9 +3,11 @@
The **deviceControl** module provides APIs for device control, which can be called only by device administrator applications.
> **NOTE**
>
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
>
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -17,8 +19,7 @@ import deviceControl from '@ohos.enterprise.deviceControl'
resetFactory(admin: Want, callback: AsyncCallback\<void>): void
Restores factory settings. This API uses an asynchronous callback to return the result.
Restores factory settings through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESET_DEVICE
......@@ -46,13 +47,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
deviceControl.resetFactory(wantTemp, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
deviceControl.resetFactory(wantTemp, (err) => {
if (err) {
console.error(`Failed to reset factory. Code is ${err.code}, message is ${err.message}`);
return;
}
console.log('Succeeded in resetting factory');
})
```
......@@ -78,7 +82,7 @@ Restores factory settings. This API uses a promise to return the result.
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | Promise that returns no value. If the operation fails, an error object is thrown.|
| Promise\<void> | Promise that returns no value. If the operation fails, an error object will be thrown.|
**Error codes**
......@@ -93,11 +97,12 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
bundleName: 'bundleName',
abilityName: 'abilityName',
};
deviceControl.resetFactory(wantTemp).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
}).catch((err) => {
console.error(`Failed to reset factory. Code is ${err.code}, message is ${err.message}`);
})
```
# @ohos.enterprise.deviceInfo (Device Information Management)
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers. Only the enterprise device administrator applications can call the APIs provided by this module.
The **deviceInfo** module provides APIs for enterprise device information management, including the API for obtaining device serial numbers.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
>
> - The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -45,15 +46,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceSerial(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDeviceSerial(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get device serial. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting device serial, result : ${result}`);
});
```
......@@ -94,13 +96,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceSerial(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting device serial, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get device serial. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -136,15 +139,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDisplayVersion(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDisplayVersion(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get display version. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting display version, result : ${result}`);
});
```
......@@ -185,13 +189,14 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDisplayVersion(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting display version, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get display version. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -227,15 +232,16 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceName(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log(result);
deviceInfo.getDeviceName(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get device name. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting device name, result : ${result}`);
});
```
......@@ -276,12 +282,13 @@ For details about the error codes, see [Enterprise Device Management Error Codes
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceInfo.getDeviceName(wantTemp).then((result) => {
console.log(result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in getting device name, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get device name. Code: ${err.code}, message: ${err.message}`);
});
```
# @ohos.enterprise.deviceSettings (Device Settings Management)
The **deviceSettings** module provides APIs for setting enterprise devices, including obtaining the screen-off time of a device.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module apply only to the [device administrator applications](enterpriseDeviceManagement-overview.md#basic-concepts). Before calling the APIs, you must enable the device administrator application(js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
```js
import deviceSettings from '@ohos.enterprise.deviceSettings';
```
## deviceSettings.getScreenOffTime
getScreenOffTime(admin: Want, callback: AsyncCallback&lt;number&gt;): void
Obtains the screen-off time of a device through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_SETTINGS
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the device screen-off time obtained. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceSettings.getScreenOffTime(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to get screen off time. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in getting screen off time, result : ${result}`);
});
```
## deviceSettings.getScreenOffTime
getScreenOffTime(admin: Want): Promise&lt;number&gt;
Obtains the screen-off time of a device through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_GET_SETTINGS
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;number&gt; | Promise used to return the device screen-off time. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
deviceSettings.getScreenOffTime(wantTemp).then((result) => {
console.info(`Succeeded in getting screen off time, result : ${result}`);
}).catch((err) => {
console.error(`Failed to get screen off time. Code: ${err.code}, message: ${err.message}`);
});
```
# @ohos.enterprise.restrictions (Restrictions)
This **restrictions** module provides APIs for setting general restriction policies, including disabling or enabling device printing and HDC.
> **NOTE**
>
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
```js
import restrictions from '@ohos.enterprise.restrictions'
```
## restrictions.setPrinterDisabled
setPrinterDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void
Enables or disables device printing through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disabled | boolean | Yes| Whether to disable device printing. The value **true** means to disable device printing; the value **false** means the opposite.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result.<br> If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.setPrinterDisabled(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in setting printer disabled');
})
```
## restrictions.setPrinterDisabled
setPrinterDisabled(admin: Want, disabled: boolean): Promise\<void>
Enables or disables device printing through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disabled | boolean | Yes| Whether to disable device printing. The value **true** means to disable device printing; the value **false** means the opposite.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | Promise that returns no value. An error object will be thrown if the specified device administrator application fails to disable or enable the device printing function.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.setPrinterDisabled(wantTemp, true).then(() => {
console.info('Succeeded in setting printer disabled');
}).catch((err) => {
console.error(`Failed to set printer disabled. Code is ${err.code}, message is ${err.message}`);
})
```
## restrictions.isPrinterDisabled
isPrinterDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
Checks whether printing is disabled for devices through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<boolean> | Yes| Callback invoked to return the result. The value **true** means that device printing is disabled; the value **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.isPrinterDisabled(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in querying is the printing function disabled : ${result}`);
})
```
## restrictions.isPrinterDisabled
isPrinterDisabled(admin: Want): Promise\<boolean>
Checks whether printing is disabled for devices through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **true** means that device printing is disabled; the value **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.isPrinterDisabled(wantTemp).then((result) => {
console.info(`Succeeded in querying is the printing function disabled : ${result}`);
}).catch((err) => {
console.error(`Failed to query is the printing function disabled or not. Code is ${err.code}, message is ${err.message}`);
})
```
## restrictions.setHdcDisabled
setHdcDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>): void
Enables or disables HDC through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disabled | boolean | Yes| Whether to disable HDC. The value **true** means to disable HDC; the value **false** means the opposite.|
| callback | AsyncCallback\<void> | Yes| Callback invoked to return the result.<br> If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.setHdcDisabled(wantTemp, true, (err) => {
if (err) {
console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info('Succeeded in setting hdc disabled');
})
```
## restrictions.setHdcDisabled
setHdcDisabled(admin: Want, disabled: boolean): Promise\<void>
Enables or disables HDC through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| disabled | boolean | Yes| Whether to disable HDC. The value **true** means to disable HDC; the value **false** means the opposite.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<void> | Promise that returns no value. An error object will be thrown if the specified device administrator application fails to disable or enable HDC.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.setHdcDisabled(wantTemp, true).then(() => {
console.info('Succeeded in setting hdc disabled');
}).catch((err) => {
console.error(`Failed to set hdc disabled. Code is ${err.code}, message is ${err.message}`);
})
```
## restrictions.isHdcDisabled
isHdcDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
Checks whether HDC is disabled through the specified device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| callback | AsyncCallback\<boolean> | Yes| Callback invoked to return the result. The value **true** means HDC is disabled; the value **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.isHdcDisabled(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`Succeeded in querying is hdc disabled : ${result}`);
})
```
## restrictions.isHdcDisabled
isHdcDisabled(admin: Want): Promise\<boolean>
Checks whether HDC is disabled through the specified device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_RESTRICT_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **true** means HDC is disabled; the value **false** means the opposite.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: 'bundleName',
abilityName: 'abilityName',
};
restrictions.isHdcDisabled(wantTemp).then((result) => {
console.info(`Succeeded in querying is hdc disabled : ${result}`);
}).catch((err) => {
console.error(`Failed to query is hdc disabled or not. Code is ${err.code}, message is ${err.message}`);
})
```
# @ohos.enterprise.wifiManager (Wi-Fi Management)
The **wifiManager** module provides APIs for Wi-Fi management of enterprise devices. Only the device administrator applications can call the APIs provided by this module.
The **wifiManager** module provides APIs for Wi-Fi management of enterprise devices.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module can be called only by a [device administrator application](enterpriseDeviceManagement-overview.md#basic-concepts) that is [enabled](js-apis-enterprise-adminManager.md#adminmanagerenableadmin).
## Modules to Import
......@@ -29,31 +30,32 @@ Checks whether Wi-Fi is active through the specified device administrator applic
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that checks the Wi-Fi status. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is a Boolean value (**true** indicates that Wi-Fi is active; and **false** indicates that Wi-Fi is inactive). If the operation fails, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
wifiManager.isWifiActive(wantTemp, (error, result) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("result:" + result);
wifiManager.isWifiActive(wantTemp, (err, result) => {
if (err) {
console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info(`Succeeded in query is wifi active or not, result : ${result}`);
});
```
......@@ -73,7 +75,7 @@ Checks whether Wi-Fi is active through the specified device administrator applic
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that checks the Wi-Fi status.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
**Return value**
......@@ -85,22 +87,23 @@ Checks whether Wi-Fi is active through the specified device administrator applic
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
wifiManager.isWifiActive(wantTemp).then((result) => {
console.log("result:" + result);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info(`Succeeded in query is wifi active or not, result : ${result}`);
}).catch((err) => {
console.error(`Failed to query is wifi active or not. Code: ${err.code}, message: ${err.message}`);
});
```
......@@ -120,7 +123,7 @@ Sets Wi-Fi to connect to the specified network. This API uses an asynchronous ca
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that sets the Wi-Fi profile. |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
| profile | [WifiProfile](#wifiprofile) | Yes | WLAN configuration. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
......@@ -128,29 +131,30 @@ Sets Wi-Fi to connect to the specified network. This API uses an asynchronous ca
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
let profile: wifiManager.WifiProfile = {
'ssid': 'name',
'preSharedKey': 'passwd',
'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
console.log("set wifi success");
wifiManager.setWifiProfile(wantTemp, profile, (err) => {
if (err) {
console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
return;
}
console.info('Succeeded in setting wifi profile');
});
```
......@@ -170,7 +174,7 @@ Sets Wi-Fi to connect to the specified network. This API uses a promise to retur
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application that sets the Wi-Fi profile.|
| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
| profile | [WifiProfile](#wifiprofile) | Yes | WLAN configuration. |
**Return value**
......@@ -183,27 +187,28 @@ Sets Wi-Fi to connect to the specified network. This API uses a promise to retur
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | The application is not an administrator application of the device. |
| 9200002 | The administrator application does not have permission to manage the device. |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let profile : wifiManager.WifiProfile = {
"ssid": "name",
"preSharedKey": "passwd",
"securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
'ssid': 'name',
'preSharedKey': 'passwd',
'securityType': wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
wifiManager.setWifiProfile(wantTemp, profile).then(() => {
console.log("set wifi success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
console.info('Succeeded in setting wifi profile');
}).catch((err) => {
console.error(`Failed to set wifi profile. Code: ${err.code}, message: ${err.message}`);
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册