diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md
index 79230cf32f010ee568575817643996f15b0bf007..aca0bbb39f14d5110bf82d2a610eca7d8b05dd6c 100644
--- a/en/application-dev/application-models/Readme-EN.md
+++ b/en/application-dev/application-models/Readme-EN.md
@@ -36,9 +36,10 @@
- [Applying Custom Drawing in the Widget](arkts-ui-widget-page-custom-drawing.md)
- Widget Event Development
- [Widget Event Capability Overview](arkts-ui-widget-event-overview.md)
- - [Redirecting to a Specified Page Through the Router Event](arkts-ui-widget-event-router.md)
- - [Updating Widget Content Through FormExtensionAbility](arkts-ui-widget-event-formextensionability.md)
- - [Updating Widget Content Through UIAbility](arkts-ui-widget-event-uiability.md)
+ - [Redirecting to a UIAbility Through the router Event](arkts-ui-widget-event-router.md)
+ - [Launching a UIAbility in the Background Through the call Event](arkts-ui-widget-event-call.md)
+ - [Updating Widget Content Through the message Event](arkts-ui-widget-event-formextensionability.md)
+ - [Updating Widget Content Through the router or call Event](arkts-ui-widget-event-uiability.md)
- Widget Data Interaction
- [Widget Data Interaction Overview](arkts-ui-widget-interaction-overview.md)
- [Configuring a Widget to Update Periodically](arkts-ui-widget-update-by-time.md)
diff --git a/en/application-dev/application-models/accessibilityextensionability.md b/en/application-dev/application-models/accessibilityextensionability.md
index 688eaefa4bc10723d23f880dfbb4c1502cb42053..c14b4b95921f8adef52c83b20253d26b774b16fa 100644
--- a/en/application-dev/application-models/accessibilityextensionability.md
+++ b/en/application-dev/application-models/accessibilityextensionability.md
@@ -12,17 +12,31 @@ The **AccessibilityExtensionAbility** module provides accessibility extension ca
This document is organized as follows:
-- [AccessibilityExtensionAbility Development](#accessibilityextensionability-development)
- - [Creating an Accessibility Extension Service](#creating-an-accessibility-extension-service)
- - [Creating a Project](#creating-a-project)
- - [Creating an AccessibilityExtAbility File](#creating-an-accessibilityextability-file)
- - [Processing an Accessibility Event](#processing-an-accessibility-event)
- - [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services)
- - [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service)
+- [AccessibilityExtensionAbility Overview](#accessibilityextensionability-overview)
+- [Creating an Accessibility Extension Service](#creating-an-accessibility-extension-service)
+- [Processing an Accessibility Event](#processing-an-accessibility-event)
+- [Declaring Capabilities of Accessibility Extension Services](#declaring-capabilities-of-accessibility-extension-services)
+- [Enabling a Custom Accessibility Extension Service](#enabling-a-custom-accessibility-extension-service)
+
+## AccessibilityExtensionAbility Overview
+
+Accessibility is about giving equal access to everyone so that they can access and use information equally and conveniently under any circumstances. It helps narrow the digital divide between people of different classes, regions, ages, and health status in terms of information understanding, information exchange, and information utilization, so that they can participate in social life more conveniently and enjoy the benefits of technological advances.
+
+AccessibilityExtensionAbility is an accessibility extension service framework. It allows you to develop your own extension services and provides a standard mechanism for exchanging information between applications and extension services. You can make use of the provided capabilities and APIs to develop accessibility features for users with disabilities or physical limitations. For example, you can develop a screen reader for users with vision impairments.
+
+Below shows the AccessibilityExtensionAbility framework.
+
+
+
+1. Accessibility app: extension service application developed based on the AccessibilityExtensionAbility framework, for example, a screen reader application.
+2. Target app: application assisted by the accessibility app.
+3. AccessibilityAbilityManagerService (AAMS): main service of the AccessibilityExtensionAbility framework, which is used to manage the lifecycle of accessibility apps and provide a bridge for information exchange between accessibility apps and target apps.
+4. AccessibilityAbility (AAkit): ability that is used by the accessibility app to build an extension service ability operating environment and that provides interfaces for the accessibility app to query and operate the target app, including performing click/long press operations.
+5. AccessibilitySystemAbilityClient (ASACkit): used by the target app to send accessibility events, such as content change events, to AAMS, and respond to the instructions (such as performing click/long press operations) sent by the accessibility app through AAMS.
## Creating an Accessibility Extension Service
-You can create an accessibility extension service by creating a project from scratch or adding the service to an existing project.
+You can create an accessibility extension service by creating a project from scratch or adding the service to an existing project. Only one accessibility extension service can be created for a project.
### Creating a Project
@@ -40,15 +54,15 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens
class AccessibilityExtAbility extends AccessibilityExtensionAbility {
onConnect() {
- console.log('AccessibilityExtAbility onConnect');
+ console.info('AccessibilityExtAbility onConnect');
}
onDisconnect() {
- console.log('AccessibilityExtAbility onDisconnect');
+ console.info('AccessibilityExtAbility onDisconnect');
}
onAccessibilityEvent(accessibilityEvent) {
- console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
+ console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
}
}
@@ -69,9 +83,9 @@ You can process the service logic for accessibility events in the **onAccessibil
```typescript
onAccessibilityEvent(accessibilityEvent) {
- console.log('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
+ console.info('AccessibilityExtAbility onAccessibilityEvent: ' + JSON.stringify(accessibilityEvent));
if (accessibilityEvent.eventType === 'pageStateUpdate') {
- console.log('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate');
+ console.info('AccessibilityExtAbility onAccessibilityEvent: pageStateUpdate');
// TODO: Develop custom logic.
}
}
@@ -119,3 +133,4 @@ To enable or disable an accessibility extension service, run the following comma
In the preceding commands, **AccessibilityExtAbility** indicates the name of the accessibility extension service, **com.example.demo** indicates the bundle name, and **rg** indicates the capabilities (**r** is short for retrieve).
If the service is enabled or disabled successfully, the message "enable ability successfully" or "disable ability successfully" is displayed.
+
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-call.md b/en/application-dev/application-models/arkts-ui-widget-event-call.md
new file mode 100644
index 0000000000000000000000000000000000000000..073506706053e31402d7c69d645138ec7ab112cc
--- /dev/null
+++ b/en/application-dev/application-models/arkts-ui-widget-event-call.md
@@ -0,0 +1,89 @@
+# Launching a UIAbility in the Background Through the call Event
+
+
+There may be cases you want to provide in a widget access to features available in your application when it is running in the foreground, for example, the play, pause, and stop buttons in a music application widget. This is where the **call** capability of the **postCardAction** API comes in handy. This capability, when used in a widget, can start the specified UIAbility of the widget provider in the background. It also allows the widget to call the specified method of the application and transfer data so that the application, while in the background, can behave accordingly in response to touching of the buttons on the widget.
+
+
+Generally, buttons are used to trigger the **call** event. Below is an example.
+
+
+- In this example, two buttons are laid out on the widget page. When one button is clicked, the **postCardAction** API is called to send a **call** event to the target UIAbility. Note that the **method** parameter in the API indicates the method to call in the target UIAbility. It is mandatory and of the string type.
+
+ ```ts
+ @Entry
+ @Component
+ struct WidgetCard {
+ build() {
+ Column() {
+ Button ('Feature A')
+ .margin('20%')
+ .onClick(() => {
+ console.info('call EntryAbility funA');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funA' // Set the name of the method to call in the EntryAbility.
+ }
+ });
+ })
+
+ Button ('Feature B')
+ .margin('20%')
+ .onClick(() => {
+ console.info('call EntryAbility funB');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funB', // Set the name of the method to call in the EntryAbility.
+ 'num': 1 // Set other parameters to be transferred.
+ }
+ });
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- The UIAbility receives the **call** event and obtains the transferred parameters. It then executes the target method specified by the **method** parameter. Other data can be obtained in readString mode. Listen for the method required by the **call** event in the **onCreate** callback of the UIAbility.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+
+ function FunACall(data) {
+ // Obtain all parameters transferred in the call event.
+ console.info('FunACall param:' + JSON.stringify(data.readString()));
+ return null;
+ }
+
+ function FunBCall(data) {
+ console.info('FunACall param:' + JSON.stringify(data.readString()));
+ return null;
+ }
+
+ export default class CameraAbility extends UIAbility {
+ // If the UIAbility is started for the first time, the onCreate lifecycle callback is triggered after the call event is received.
+ onCreate(want, launchParam) {
+ try {
+ // Listen for the method required by the call event.
+ this.callee.on('funA', FunACall);
+ this.callee.on('funB', FunBCall);
+ } catch (error) {
+ console.error(`Failed to register callee on. Cause: ${JSON.stringify(err)}`);
+ }
+ }
+
+ // Deregister the listener when the process exits.
+ onDestroy() {
+ try {
+ this.callee.off('funA');
+ this.callee.off('funB');
+ } catch (err) {
+ console.error(`Failed to register callee off. Cause: ${JSON.stringify(err)}`);
+ }
+ }
+ };
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md b/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
index 861f5ca66eea9a06ee50c7b1448e1f6ed040c01a..be7761d8d78da5102afadd2c37043c228dfcd53e 100644
--- a/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
+++ b/en/application-dev/application-models/arkts-ui-widget-event-formextensionability.md
@@ -1,7 +1,7 @@
-# Updating Widget Content Through FormExtensionAbility
+# Updating Widget Content Through the message Event
-On the widget page, the **postCardAction** API can be used to trigger a message event to the FormExtensionAbility, which then updates the widget content. The following is an example of this widget update mode.
+On the widget page, the **postCardAction** API can be used to trigger a message event to start a FormExtensionAbility, which then updates the widget content. The following is an example of this widget update mode.
- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the event to the FormExtensionAbility.
@@ -57,10 +57,10 @@ On the widget page, the **postCardAction** API can be used to trigger a message
})
}
- // ...
+ ...
}
```
The figure below shows the effect.
-
+

diff --git a/en/application-dev/application-models/arkts-ui-widget-event-overview.md b/en/application-dev/application-models/arkts-ui-widget-event-overview.md
index fbc77b97a27b52b0f7b2a3b0cebc5b5cb5940f72..ed029fc3017d00a7d4c2cf14e1b905139bd7eb49 100644
--- a/en/application-dev/application-models/arkts-ui-widget-event-overview.md
+++ b/en/application-dev/application-models/arkts-ui-widget-event-overview.md
@@ -1,40 +1,31 @@
# Widget Event Capability Overview
-
The ArkTS widget provides the **postCardAction()** API for interaction between the widget internal and the provider application. Currently, this API supports the router, message, and call events and can be called only in the widget.
-

+**Definition**: postCardAction(component: Object, action: Object): void
-Definition: postCardAction(component: Object, action: Object): void
-
-
-Parameters:
-
+**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| component | Object | Yes| Instance of the current custom component. Generally, **this** is transferred.|
| action | Object | Yes| Action description. For details, see the following table.|
+**Description of the action parameter**
-Description of the action parameter
-
-
-| **Key** | **Value** | Description|
+| Key | Value | Description|
| -------- | -------- | -------- |
-| "action" | string | Action type.
- **"router"**: application redirection. If this type of action is triggered, the corresponding UIAbility is displayed. Only the UIAbility of the current application can be displayed.
- **"message"**: custom message. If this type of action is triggered, the [onFormEvent()](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent) lifecycle callback of the provider FormExtensionAbility is called.
- **"call"**: application startup in the background. If this type of action is triggered, the corresponding UIAbility is started but does not run in the foreground. The target application must have the permission to run in the background ([ohos.permission.KEEP_BACKGROUND_RUNNING](../security/permission-list.md#ohospermissionkeep_background_running)).|
+| "action" | string | Action type.
- **"router"**: redirection to the specified UIAbility of the widget provider.
- **"message"**: custom message. If this type of action is triggered, the [onFormEvent()](../reference/apis/js-apis-app-form-formExtensionAbility.md#onformevent) lifecycle callback of the provider FormExtensionAbility is called.
- **"call"**: launch of the widget provider in the background. If this type of action is triggered, the specified UIAbility of the widget provider is started in the background, but not displayed in the foreground. This action type requires that the widget provider should have the [ohos.permission.KEEP_BACKGROUND_RUNNING](../security/permission-list.md#ohospermissionkeep_background_running) permission.|
| "bundleName" | string | Name of the target bundle when **action** is **"router"** or **"call"**. This parameter is optional.|
| "moduleName" | string | Name of the target module when **action** is **"router"** or **"call"**. This parameter is optional.|
| "abilityName" | string | Name of the target UIAbility when **action** is **"router"** or **"call"**. This parameter is mandatory.|
-| "params" | Object | Additional parameters carried in the current action. The value is a key-value pair in JSON format.|
+| "params" | Object | Additional parameters carried in the current action. The value is a key-value pair in JSON format. For the **"call"** action type, the **method** parameter must be set and its value type must be string. This parameter is mandatory.|
Sample code of the **postCardAction()** API:
-
-
```typescript
Button ('Jump')
.width('40%')
@@ -45,18 +36,26 @@ Button ('Jump')
'bundleName': 'com.example.myapplication',
'abilityName': 'EntryAbility',
'params': {
- 'message': 'testForRouter' // Customize the message to be sent.
+ 'message': 'testForRouter' // Customize the message to send.
}
});
})
-```
-
-
-The following are typical widget development scenarios that can be implemented through widget events:
+Button ('Start in Background')
+ .width('40%')
+ .height('20%')
+ .onClick(() => {
+ postCardAction(this, {
+ 'action': 'call',
+ 'bundleName': 'com.example.myapplication',
+ 'abilityName': 'EntryAbility',
+ 'params': {
+ 'method': 'fun', // Set the name of the method to call. It is mandatory.
+ 'message': 'testForcall' // Customize the message to send.
+ }
+ });
+ })
+```
-- [Updating Widget Content Through FormExtensionAbility](arkts-ui-widget-event-formextensionability.md)
-
-- [Updating Widget Content Through UIAbility](arkts-ui-widget-event-uiability.md)
-- [Redirecting to a Specified Page Through the Router Event](arkts-ui-widget-event-router.md)
+Read on to learn the typical widget development scenarios that can be implemented through widget events.
diff --git a/en/application-dev/application-models/arkts-ui-widget-event-router.md b/en/application-dev/application-models/arkts-ui-widget-event-router.md
index 371cbc6b2729a7985ed2fd183297ed771fddb11d..733ff7f59b57ec4295fa21cb4d83ae8a5b2b8eb4 100644
--- a/en/application-dev/application-models/arkts-ui-widget-event-router.md
+++ b/en/application-dev/application-models/arkts-ui-widget-event-router.md
@@ -1,8 +1,6 @@
-# Redirecting to a Specified Page Through the Router Event
-
-
-The **router** capability of the **postCardAction** API can be used in a widget to quickly start the widget provider application. An application can provide different buttons through the widget so that users can jump to different pages at the touch of a button. For example, a camera widget provides the buttons that direct the user to respective pages, such as the page for taking a photo and the page for recording a video.
+# Redirecting to a UIAbility Through the router Event
+The **router** capability of the **postCardAction** API can be used in a widget to quickly start a specific UIAbility of the widget provider. By leveraging this capability, an application can provide in the widget multiple buttons, each of which targets a different target UIAbility. For example, a camera widget can provide the buttons that redirect the user to the UIAbility for taking a photo and the UIAbility for recording a video.

diff --git a/en/application-dev/application-models/arkts-ui-widget-event-uiability.md b/en/application-dev/application-models/arkts-ui-widget-event-uiability.md
index 0d6cb33a3749c81b6b41dd4904ba64c89a7942ae..ca66e20aa2d258a0e05002296dac39c19ac131c3 100644
--- a/en/application-dev/application-models/arkts-ui-widget-event-uiability.md
+++ b/en/application-dev/application-models/arkts-ui-widget-event-uiability.md
@@ -1,10 +1,11 @@
-# Updating Widget Content Through UIAbility
+# Updating Widget Content Through the router or call Event
-On the widget page, the **postCardAction** API can be used to trigger a router or call event to start the UIAbility, which then updates the widget content. The following is an example of this widget update mode.
+On the widget page, the **postCardAction** API can be used to trigger a router or call event to start a UIAbility, which then updates the widget content. The following is an example of this widget update mode.
+## Updating Widget Content Through the router Event
-- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the event to the FormExtensionAbility.
+- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the **router** event to the FormExtensionAbility.
```ts
let storage = new LocalStorage();
@@ -84,3 +85,104 @@ On the widget page, the **postCardAction** API can be used to trigger a router o
...
}
```
+
+## Updating Widget Content Through the call Event
+
+- When using the **call** event of the **postCardAction** API, the value of **formId** must be updated in the **onAddForm** callback of the FormExtensionAbility.
+
+ ```ts
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+
+ export default class EntryFormAbility extends FormExtensionAbility {
+ onAddForm(want) {
+ let formId = want.parameters["ohos.extra.param.key.form_identity"];
+ let dataObj1 = {
+ "formId": formId
+ };
+ let obj1 = formBindingData.createFormBindingData(dataObj1);
+ return obj1;
+ }
+
+ ...
+ };
+ ```
+
+- On the widget page, register the **onClick** event callback of the button and call the **postCardAction** API in the callback to trigger the event to the UIAbility.
+
+ ```ts
+ let storage = new LocalStorage();
+ @Entry(storage)
+ @Component
+ struct WidgetCard {
+ @LocalStorageProp('detail') detail: string = 'init';
+ @LocalStorageProp('formId') formId: string = '0';
+
+ build() {
+ Column() {
+ Button ('Start in Background')
+ .margin('20%')
+ .onClick(() => {
+ console.info('postCardAction to EntryAbility');
+ postCardAction(this, {
+ 'action': 'call',
+ 'abilityName': 'EntryAbility', // Only the UIAbility of the current application is allowed.
+ 'params': {
+ 'method': 'funA',
+ 'formId': this.formId,
+ 'detail': 'CallFromCard'
+ }
+ });
+ })
+ Text(`${this.detail}`).margin('20%')
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+- Listen for the method required by the **call** event in the **onCreate** callback of the UIAbility, and then call the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) API in the corresponding method to update the widget.
+
+ ```ts
+ import UIAbility from '@ohos.app.ability.UIAbility';
+ import formBindingData from '@ohos.app.form.formBindingData';
+ import formProvider from '@ohos.app.form.formProvider';
+ import formInfo from '@ohos.app.form.formInfo';
+
+ const MSG_SEND_METHOD: string = 'funA';
+
+ // After the call event is received, the method listened for by the callee is triggered.
+ function FunACall(data) {
+ // Obtain all parameters transferred in the call event.
+ let params = JSON.parse(data.readString())
+ if (params.formId !== undefined) {
+ let curFormId = params.formId;
+ let message = params.detail;
+ console.info(`UpdateForm formId: ${curFormId}, message: ${message}`);
+ let formData = {
+ "detail": message
+ };
+ let formMsg = formBindingData.createFormBindingData(formData)
+ formProvider.updateForm(curFormId, formMsg).then((data) => {
+ console.info('updateForm success.' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('updateForm failed:' + JSON.stringify(error));
+ })
+ }
+ return null;
+ }
+ export default class EntryAbility extends UIAbility {
+ // If the UIAbility is started for the first time, the onCreate lifecycle callback is triggered after the call event is received.
+ onCreate(want, launchParam) {
+ console.info('Want:' + JSON.stringify(want));
+ try {
+ // Listen for the method required by the call event.
+ this.callee.on(MSG_SEND_METHOD, FunACall);
+ } catch (error) {
+ console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`)
+ }
+ }
+ ...
+ }
+ ```
diff --git a/en/application-dev/application-models/arkts-ui-widget-image-update.md b/en/application-dev/application-models/arkts-ui-widget-image-update.md
index 4862fbf747c0275d179eb4a2f988280379f2d262..dfe6dbf0e9249c66c3fb1d0723f1c7b296443381 100644
--- a/en/application-dev/application-models/arkts-ui-widget-image-update.md
+++ b/en/application-dev/application-models/arkts-ui-widget-image-update.md
@@ -1,10 +1,10 @@
# Updating Local and Online Images in the Widget
-Generally, local images or online images downloaded from the network need to be displayed on a widget. To obtain local and online images, use the FormExtensionAbility. The following exemplifies how to show local and online images on a widget.
+Typically, a widget includes local images or online images downloaded from the network. To obtain local and online images, use the FormExtensionAbility. The following exemplifies how to show local and online images on a widget.
-1. Internet access is required for downloading online images. Therefore, you need to apply for the **ohos.permission.INTERNET** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md).
+1. For the widget to download online images, declare the **ohos.permission.INTERNET** permission for the widget. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md).
2. Update local files in the **onAddForm** lifecycle callback of the EntryFormAbility.
@@ -44,7 +44,7 @@ Generally, local images or online images downloaded from the network need to be
}
```
-3. Update online files in the onFormEvent lifecycle callback of the EntryFormAbility.
+3. Update online images in the **onFormEvent** lifecycle callback of the EntryFormAbility.
```ts
import formBindingData from '@ohos.app.form.formBindingData';
@@ -60,8 +60,8 @@ Generally, local images or online images downloaded from the network need to be
'text': 'Updating...'
})
formProvider.updateForm(formId, formInfo)
- // Note: The FormExtensionAbility is started when the lifecycle callback is triggered. It can run in the background for only 5 seconds.
- // When possible, limit the size of the image to download. If an image cannot be downloaded within 5 seconds, it cannot be updated to the widget page.
+ // Note: After being started with the triggering of the lifecycle callback, the FormExtensionAbility can run in the background for only 5 seconds.
+ // When possible, limit the size of the image to download. If an image cannot be downloaded within 5 seconds, it will not be updated to the widget page.
let netFile = 'https://xxxx/xxxx.png'; // Specify the URL of the image to download.
let tempDir = this.context.getApplicationContext().tempDir;
let fileName = 'file' + Date.now();
@@ -161,6 +161,6 @@ Generally, local images or online images downloaded from the network need to be
```
> **NOTE**
-> - The **\** component displays images in the remote memory based on the **memory://** identifier in the input parameter (**memory://fileName**). The **fileName** value must be consistent with the key in the object (**'formImages': {key: fd}**) passed by the EntryFormAbility.
+> - The **\** component displays images in the remote memory based on the **memory://** identifier in the input parameter (**memory://fileName**). The value of **fileName** must be consistent with the key in the object (**'formImages': {key: fd}**) passed by the EntryFormAbility.
>
-> - The **\** component determines whether to update the image based on whether the input parameter is changed. Therefore, the value of **imgName** passed by the EntryFormAbility each time must be different. If the two values of **imgName** passed consecutively are identical, the image is not updated.
+> - The **\** component determines whether to update the image by comparing the values of **imgName** consecutively passed by the EntryFormAbility. It updates the image only when the values are different.
diff --git a/en/application-dev/application-models/arkts-ui-widget-lifecycle.md b/en/application-dev/application-models/arkts-ui-widget-lifecycle.md
index 4cb68536312e26e0f7c98546839134c0ab435a8c..fb25fd362f67646d65853b870a6a9cb518c4d760 100644
--- a/en/application-dev/application-models/arkts-ui-widget-lifecycle.md
+++ b/en/application-dev/application-models/arkts-ui-widget-lifecycle.md
@@ -92,4 +92,5 @@ When creating an ArkTS widget, you need to implement the [FormExtensionAbility](
> **NOTE**
-> The FormExtensionAbility cannot reside in the background. Therefore, continuous tasks cannot be processed in the widget lifecycle callbacks. The FormExtensionAbility persists for 5 seconds after the lifecycle callback is completed and will exit if no new lifecycle callback is invoked during this time frame. For the service logic that may take more than 5 seconds to complete, it is recommended that you [start the application](arkts-ui-widget-event-uiability.md). After the processing is complete, use the [updateForm](../reference/apis/js-apis-app-form-formProvider.md#updateform) to notify the widget of the update.
+>
+> The FormExtensionAbility cannot reside in the background. It persists for 5 seconds after the lifecycle callback is completed and exist if no new lifecycle callback is invoked during this time frame. This means that continuous tasks cannot be processed in the widget lifecycle callbacks. For the service logic that may take more than 5 seconds to complete, it is recommended that you [start the application](arkts-ui-widget-event-uiability.md) for processing. After the processing is complete, use [updateForm()](../reference/apis/js-apis-app-form-formProvider.md#updateform) to notify the widget of the update.
diff --git a/en/application-dev/application-models/arkts-ui-widget-modules.md b/en/application-dev/application-models/arkts-ui-widget-modules.md
index 5084b7ea5045002759ca57f10c055ef5623eb7d0..b9a411426db84a4c1af12e70eab956adc8f25806 100644
--- a/en/application-dev/application-models/arkts-ui-widget-modules.md
+++ b/en/application-dev/application-models/arkts-ui-widget-modules.md
@@ -1,7 +1,7 @@
# ArkTS Widget Related Modules
+**Figure 1** ArkTS widget related modules
- **Figure 1** ArkTS widget related modules

@@ -15,10 +15,10 @@
- [formBindingData](../reference/apis/js-apis-app-form-formBindingData.md): provides APIs for widget data binding. You can use the APIs to create a **FormBindingData** object and obtain related information.
-- [Page Layout (Card.ets)](arkts-ui-widget-page-overview.md): provides APIs for a declarative paradigm UI.
- - [ArkTS widget capabilities](arkts-ui-widget-event-overview.md): include the **postCardAction** API used for interaction between the widget internal and the provider application and can be called only in the widget.
- - [ArkTS widget capability list](arkts-ui-widget-page-overview.md#page-capabilities-supported-by-arkts-widgets): lists the APIs, components, events, attributes, and lifecycle callbacks that can be used in ArkTS widgets.
+- [Page layout (Card.ets)](arkts-ui-widget-page-overview.md): provides APIs for a declarative paradigm UI.
+ - [Capabilities exclusive to ArkTS widgets](arkts-ui-widget-event-overview.md): include the **postCardAction** API used for interaction between the widget internal and the provider application and can be called only in the widget.
+ - [ArkTS widget capability list](arkts-ui-widget-page-overview.md#page-capabilities-supported-by-arkts-widgets): contain the APIs, components, events, attributes, and lifecycle callbacks that can be used in ArkTS widgets.
- [Widget configuration](arkts-ui-widget-configuration.md): includes FormExtensionAbility configuration and widget configuration.
- - Configure FormExtensionAbility information under **extensionAbilities** in the [module.json5 file](../quick-start/module-configuration-file.md).
+ - Configure the FormExtensionAbility information under **extensionAbilities** in the [module.json5 file](../quick-start/module-configuration-file.md).
- Configure the widget configuration information (**WidgetCard.ets**) in the [form_config.json](arkts-ui-widget-configuration.md) file in **resources/base/profile**.
diff --git a/en/application-dev/application-models/arkts-ui-widget-page-animation.md b/en/application-dev/application-models/arkts-ui-widget-page-animation.md
index 9a940aeecb62682a185ba8c0529adc38017c8e2d..0cb8e356c61155d367e55c0f39bbf491d03e2e12 100644
--- a/en/application-dev/application-models/arkts-ui-widget-page-animation.md
+++ b/en/application-dev/application-models/arkts-ui-widget-page-animation.md
@@ -1,10 +1,10 @@
# Using Animations in the Widget
-To make your ArkTS widget more engaging, you can apply animations to it, including [explicit animation](../reference/arkui-ts/ts-explicit-animation.md), [attribute animation](../reference/arkui-ts/ts-animatorproperty.md), and [component transition](../reference/arkui-ts/ts-transition-animation-component.md). Note the following restrictions when using the animations in ArkTS widgets.
+To make your ArkTS widget more engaging, you can apply animations to it, including [explicit animation](../reference/arkui-ts/ts-explicit-animation.md), [attribute animation](../reference/arkui-ts/ts-animatorproperty.md), and [component transition](../reference/arkui-ts/ts-transition-animation-component.md). Just note the following restrictions when using the animations in ArkTS widgets.
- **Table 1** Restrictions on animation parameters
+**Table 1** Restrictions on animation parameters
| Name| Description| Description|
| -------- | -------- | -------- |
@@ -13,14 +13,10 @@ To make your ArkTS widget more engaging, you can apply animations to it, includi
| delay | Animation delay duration.| Do not set this parameter in the widget. Use the default value 0.|
| iterations | Number of times that the animation is played.| Do not set this parameter in the widget. Use the default value 1.|
-
The following sample code implements the animation effect of button rotation:
-

-
-
```ts
@Entry
@Component
diff --git a/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md
index 49523d60af886db40b55fc90d80c9bd5027cade8..a55cb9cd17cda67cc2989e5916db19c5cf36cc47 100644
--- a/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md
+++ b/en/application-dev/application-models/arkts-ui-widget-page-custom-drawing.md
@@ -1,9 +1,9 @@
# Applying Custom Drawing in the Widget
- You can apply custom drawing in your ArkTS widget to create a more vibrant experience. Use the [Canvas](../reference/arkui-ts/ts-components-canvas-canvas.md) component to create a canvas on the widget, and then use the [CanvasRenderingContext2D](../reference/arkui-ts/ts-canvasrenderingcontext2d.md) object to draw custom graphics on the canvas. The following code shows how to draw a smiling face in the center of the canvas.
+You can apply custom drawing in your ArkTS widget to create a more vibrant experience. Use the [Canvas](../reference/arkui-ts/ts-components-canvas-canvas.md) component to create a canvas on the widget, and then use the [CanvasRenderingContext2D](../reference/arkui-ts/ts-canvasrenderingcontext2d.md) object to draw custom graphics on the canvas. The following code snippet draws a smiling face in the center of a canvas.
-```typescript
+```ts
@Entry
@Component
struct Card {
@@ -30,41 +30,41 @@ struct Card {
this.context.fillRect(0, 0, this.canvasWidth, this.canvasHeight);
// Draw a red circle in the center of the canvas.
this.context.beginPath();
- let radius = this.context.width / 3
- let circleX = this.context.width / 2
- let circleY = this.context.height / 2
+ let radius = this.context.width / 3;
+ let circleX = this.context.width / 2;
+ let circleY = this.context.height / 2;
this.context.moveTo(circleX - radius, circleY);
this.context.arc(circleX, circleY, radius, 2 * Math.PI, 0, true);
this.context.closePath();
this.context.fillStyle = 'red';
this.context.fill();
// Draw the left eye of the smiling face.
- let leftR = radius / 4
- let leftX = circleX - (radius / 2)
- let leftY = circleY - (radius / 3.5)
+ let leftR = radius / 4;
+ let leftX = circleX - (radius / 2);
+ let leftY = circleY - (radius / 3.5);
this.context.beginPath();
this.context.arc(leftX, leftY, leftR, 0, Math.PI, true);
- this.context.strokeStyle = '#ffff00'
- this.context.lineWidth = 10
- this.context.stroke()
+ this.context.strokeStyle = '#ffff00';
+ this.context.lineWidth = 10;
+ this.context.stroke();
// Draw the right eye of the smiling face.
- let rightR = radius / 4
- let rightX = circleX + (radius / 2)
- let rightY = circleY - (radius / 3.5)
+ let rightR = radius / 4;
+ let rightX = circleX + (radius / 2);
+ let rightY = circleY - (radius / 3.5);
this.context.beginPath();
this.context.arc(rightX, rightY, rightR, 0, Math.PI, true);
- this.context.strokeStyle = '#ffff00'
- this.context.lineWidth = 10
- this.context.stroke()
+ this.context.strokeStyle = '#ffff00';
+ this.context.lineWidth = 10;
+ this.context.stroke();
// Draw the mouth of the smiling face.
- let mouthR = radius / 2.5
- let mouthX = circleX
- let mouthY = circleY + (radius / 3)
+ let mouthR = radius / 2.5;
+ let mouthX = circleX;
+ let mouthY = circleY + (radius / 3);
this.context.beginPath();
this.context.arc(mouthX, mouthY, mouthR, Math.PI, 0, true);
- this.context.strokeStyle = '#ffff00'
- this.context.lineWidth = 10
- this.context.stroke()
+ this.context.strokeStyle = '#ffff00';
+ this.context.lineWidth = 10;
+ this.context.stroke();
})
}
}.height('100%').width('100%')
@@ -72,8 +72,6 @@ struct Card {
}
```
-
The figure below shows the effect.
-
-
+
\ No newline at end of file
diff --git a/en/application-dev/application-models/arkts-ui-widget-update-by-status.md b/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
index 8952b8dff4ecdd3acad6b1a65513d8e529c4dc70..b27958c66d3e174a66c80c90e46cdd71f5ecf668 100644
--- a/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
+++ b/en/application-dev/application-models/arkts-ui-widget-update-by-status.md
@@ -1,7 +1,7 @@
# Updating Widget Content by State
-Multiple widgets of the same application can be configured to implement different features. For example, two weather widgets can be added to the home screen: one for displaying the weather of London, and the other Beijing. The widget is set to be updated at 07:00 every morning. It needs to detect the configured city, and then updates the city-specific weather information. The following example describes how to dynamically update the widget content based on the state.
+There are cases where multiple copies of the same widget are added to the home screen to accommodate different needs. In these cases, the widget content needs to be dynamically updated based on the state. This topic exemplifies how this is implemented. In the following example, two weather widgets are added to the home screen: one for displaying the weather of London, and the other Beijing, both configured to be updated at 07:00 every morning. The widget provider detects the target city, and then displays the city-specific weather information on the widgets.
- Widget configuration file: Configure the widget to be updated at 07:00 every morning.
@@ -74,7 +74,7 @@ Multiple widgets of the same application can be configured to implement differen
}
Row() {// Content that is updated only in state A
- Text('State A: ')
+ Text ('State A:')
Text(this.textA)
}
@@ -167,4 +167,5 @@ Multiple widgets of the same application can be configured to implement differen
> **NOTE**
+>
> When the local database is used for widget information persistence, it is recommended that [TEMPORARY_KEY](../reference/apis/js-apis-app-form-formInfo.md#formparam) be used to determine whether the currently added widget is a normal one in the [onAddForm](../reference/apis/js-apis-app-form-formExtensionAbility.md#onaddform) lifecycle callback. If the widget is a normal one, the widget information is directly persisted. If the widget is a temporary one, the widget information is persisted when the widget is converted to a normal one ([onCastToNormalForm](../reference/apis/js-apis-app-form-formExtensionAbility.md#oncasttonormalform)). In addition, the persistent widget information needs to be deleted when the widget is destroyed ([onRemoveForm](../reference/apis/js-apis-app-form-formExtensionAbility.md#onremoveform)), preventing the database size from continuously increasing due to repeated widget addition and deletion.
diff --git a/en/application-dev/application-models/arkts-ui-widget-update-by-time.md b/en/application-dev/application-models/arkts-ui-widget-update-by-time.md
index 5b27a636f83f144110c5533a3d43baf0087c3716..2c2643c802aff436656f5855d67c00e1a3c38dcd 100644
--- a/en/application-dev/application-models/arkts-ui-widget-update-by-time.md
+++ b/en/application-dev/application-models/arkts-ui-widget-update-by-time.md
@@ -5,7 +5,7 @@ Before configuring a widget to update periodically, enable the periodic update f
The widget framework provides the following modes of updating widgets periodically:
-- Set the update interval: The widget will be updated at the specified interval. You can specify the interval by setting the [updateDuration](arkts-ui-widget-configuration.md) field in the **form_config.json** file. For example, you can configure the widget to update once an hour.
+- Set the update interval: The widget will be updated at the specified interval by calling [onUpdateForm](../reference/apis/js-apis-app-form-formExtensionAbility.md#onupdateform). You can specify the interval by setting the [updateDuration](arkts-ui-widget-configuration.md) field in the **form_config.json** file. For example, you can configure the widget to update once an hour.
> **NOTE**
>
diff --git a/en/application-dev/application-models/common-event-overview.md b/en/application-dev/application-models/common-event-overview.md
index e8be9abaa3015a5512c47af55d2f364be0de79ad..3f532865e686592282b9080f234c088ee24a64f8 100644
--- a/en/application-dev/application-models/common-event-overview.md
+++ b/en/application-dev/application-models/common-event-overview.md
@@ -7,8 +7,7 @@ OpenHarmony provides Common Event Service (CES) for applications to subscribe to
Common events are classified into system common events and custom common events.
-- System common events: defined in CES. Only system applications and system services can publish system common events, such as HAP installation, update, and uninstall. For details about the supported system common events, see [Support](../reference/apis/js-apis-commonEventManager.md#support).
-
+- System common events: defined in CES. Currently, only system applications and system services can publish system common events, such as HAP installation, update, and uninstall. For details about the supported system common events, see [System Common Events](../reference/apis/commonEventManager-definitions.md).
- Custom common events: customized by applications to implement cross-process event communication.
@@ -16,9 +15,7 @@ Common events are also classified into unordered, ordered, and sticky common eve
- Unordered common events: common events that CES forwards regardless of whether subscribers receive the events and when they subscribe to the events.
-
-- Ordered common events: common events that CES forwards based on the subscriber priority. CES forwards common events to the subscriber with lower priority only after receiving a reply from the previous subscriber with higher priority. Subscribers with the same priority receive common events in a random order.
-
+- Ordered common events: common events that CES forwards based on the subscriber priority. CES preferentially forwards an ordered common event to the subscriber with higher priority, waits until the subscriber receives the event, and then forwards the events to the subscriber with lower priority. Subscribers with the same priority receive common events in a random order.
- Sticky common events: common events that can be sent to a subscriber before or after they initiate a subscription. Only system applications and system services can send sticky common events, which remain in the system after being sent. The sends must first request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
diff --git a/en/application-dev/application-models/common-event-remove-sticky.md b/en/application-dev/application-models/common-event-remove-sticky.md
index 358cf8ccf912e0c329684ff904207b933713835b..2ad907a9c7962d496f0a791c88a25aaab54a9d25 100644
--- a/en/application-dev/application-models/common-event-remove-sticky.md
+++ b/en/application-dev/application-models/common-event-remove-sticky.md
@@ -1,4 +1,4 @@
-# Removing Sticky Common Events
+# Removing Sticky Common Events (for System Applications Only)
## When to Use
@@ -16,21 +16,26 @@ For details, see [Common Event](../reference/apis/js-apis-commonEventManager.md)
## How to Develop
-1. Import the module.
-
+1. Request the **ohos.permission.COMMONEVENT_STICKY** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+
+2. Import the module.
+
```ts
import commonEventManager from '@ohos.commonEventManager';
```
-2. The sticky common event to be removed must have been released by the application. For details about how to release sticky common events, see [Publishing Common Events](common-event-publish.md).
+3. Call the [removeStickyCommonEvent()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerremovestickycommonevent10) API to remove the target sticky common event.
+
+ > **NOTE**
+ >
+ > The sticky common event to be removed must have been released by the application. For details about how to release sticky common events, see [Publishing Common Events](common-event-publish.md).
```ts
- CommonEventManager.removeStickyCommonEvent("sticky_event", (err) => { // sticky_event indicates the name of the sticky common event to remove.
- if (err) {
- console.info(`Remove sticky event AsyncCallback failed, errCode: ${err.code}, errMes: ${err.message}`);
- return;
- }
- console.info(`Remove sticky event AsyncCallback success`);
- }
+ commonEventManager.removeStickyCommonEvent("sticky_event", (err) => { // sticky_event indicates the name of the target sticky common event.
+ if (err) {
+ console.error(`Failed to remove sticky common event. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info(`Succeeded in removeing sticky event.`);
});
```
diff --git a/en/application-dev/application-models/common-event-static-subscription.md b/en/application-dev/application-models/common-event-static-subscription.md
index 53e014abe38ac3f8ec89fe8a21dc9280184a280b..7005c86ae2e29eb7c635f55b5da05f658ccd8360 100644
--- a/en/application-dev/application-models/common-event-static-subscription.md
+++ b/en/application-dev/application-models/common-event-static-subscription.md
@@ -2,38 +2,46 @@
## When to Use
-A static subscriber is started once it receives a target event published by the system or application. At the same time, the **onReceiveEvent** callback is triggered, in which you can implement the service logic. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks. Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. Note that this subscribing mode has negative impact on system power consumption. Therefore, exercise caution when using this mode.
+A static subscriber is started once it receives a target event published by the system or application. At the same time, the [onReceiveEvent()](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback is triggered.
+
+You can implement the service logic in the [onReceiveEvent()](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md#staticsubscriberextensionabilityonreceiveevent) callback. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks.
+
+Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from [StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md).
+
+> **NOTE**
+>
+> The static subscription mode has negative impact on system power consumption. Therefore, exercise caution when using this mode.
## How to Develop
-1. Declaring a Static Subscriber
+1. Declaring a static subscriber.
- To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. The sample code is as follows:
+ To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project.
+
+ You can implement service logic in the **onReceiveEvent()** callback.
```ts
import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'
export default class StaticSubscriber extends StaticSubscriberExtensionAbility {
- onReceiveEvent(event) {
- console.log('onReceiveEvent, event:' + event.event);
- }
+ onReceiveEvent(event) {
+ console.info('onReceiveEvent, event: ' + event.event);
+ }
}
```
- You can implement service logic in the **onReceiveEvent** callback.
-
-2. Project Configuration for a Static Subscriber
+2. Configure static subscriber settings.
- After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows:
+ After writing the static subscriber code, configure the subscriber in the [module.json5](../quick-start/module-configuration-file.md) file.
```ts
{
"module": {
- ......
+ ...
"extensionAbilities": [
{
"name": "StaticSubscriber",
- "srcEntry": "./ets/StaticSubscriber/StaticSubscriber.ts",
+ "srcEntry": "./ets/staticsubscriber/StaticSubscriber.ts",
"description": "$string:StaticSubscriber_desc",
"icon": "$media:icon",
"label": "$string:StaticSubscriber_label",
@@ -47,14 +55,14 @@ A static subscriber is started once it receives a target event published by the
]
}
]
- ......
+ ...
}
}
```
- Pay attention to the following fields in the JSON file:
+ Some fields in the file are described as follows:
- - **srcEntry**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
+ - **srcEntry **: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
- **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**.
@@ -62,42 +70,46 @@ A static subscriber is started once it receives a target event published by the
- **name**: name of the ExtensionAbility. For a static subscriber, declare the name as **ohos.extension.staticSubscriber** for successful identification.
- **resource**: path that stores the ExtensionAbility configuration, which is customizable. In this example, the path is **resources/base/profile/subscribe.json**.
- A level-2 configuration file pointed to by **metadata** must be in the following format:
- ```ts
- {
- "commonEvents": [
- {
- "name": "xxx",
- "permission": "xxx",
- "events":[
- "xxx"
- ]
- }
- ]
- }
- ```
+3. Configure the level-2 configuration file to which the metadata points.
- If the level-2 configuration file is not declared in this format, the file cannot be identified. The fields are described as follows:
+ ```json
+ {
+ "commonEvents": [
+ {
+ "name": "xxx",
+ "permission": "xxx",
+ "events":[
+ "xxx"
+ ]
+ }
+ ]
+ }
+ ```
- - **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**.
+ If the level-2 configuration file is not declared in this format, the file cannot be identified. Some fields in the file are described as follows:
- - **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published.
+ - **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**.
+ - **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published.
+ - **events**: list of target events to subscribe to.
- - **events**: list of target events to subscribe to.
+4. Modify the [preset configuration file](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/preinstall-config/install_list_permissions.json) of the device, that is, the **/system/etc/app/install_list_permission.json** file on the device. When the device is started, this file is read. During application installation, the common event type specified by **allowCommonEvent** in the file is authorized. The **install_list_permission.json** file contains the following fields:
-3. Device System Configuration
+ - **bundleName**: bundle name of the application.
+ - **app_signature**: fingerprint information of the application. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md#configuration-in-install_list_capabilityjson).
+ - **allowCommonEvent**: type of common event that can be started by static broadcast.
- In the device system configuration file **/system/etc/app/install_list_capability.json**, add the bundle name of the static subscriber.
+ > **NOTE**
+ >
+ > The **install_list_permissions.json** file is available only for preinstalled applications.
- ```json
- {
- "install_list": [
- {
- "bundleName": "ohos.extension.staticSubscriber",
- "allowCommonEvent": ["usual.event.A", "usual.event.B"],
- }
- ]
- }
+ ```json
+ [
+ {
+ "bundleName": "com.example.myapplication",
+ "app_signature": ["****"],
+ "allowCommonEvent": ["usual.event.A", "usual.event.B"]
+ }
+ ]
```
diff --git a/en/application-dev/application-models/common-event-subscription-overview.md b/en/application-dev/application-models/common-event-subscription-overview.md
index 20064af92d3df2e6f7ab7d62c4f71f911848057a..262f30c87e6018fed4e417a196dcaeeb58e42ae2 100644
--- a/en/application-dev/application-models/common-event-subscription-overview.md
+++ b/en/application-dev/application-models/common-event-subscription-overview.md
@@ -1,7 +1,7 @@
# Common Event Subscription Overview
-The common event service provides two subscription modes: dynamic and static. The biggest difference between these two modes is that dynamic subscription requires the application to be running, while static subscription does not.
+The common event service provides two subscription modes: dynamic and static. The biggest difference between these two modes is that dynamic subscription requires the application to be running, while static subscription does not.
- In dynamic subscription mode, a subscriber subscribes to common events by calling an API during the running period. For details, see [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md).
-- In static subscription mode, a subscriber subscribes to common events by configuring a declaration file and implementing a class that inherits from StaticSubscriberExtensionAbility. For details, see [Subscribing to Common Events in Static Mode](common-event-static-subscription.md).
+- In static subscription mode, a subscriber subscribes to common events by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. For details, see [Subscribing to Common Events in Static Mode](common-event-static-subscription.md).
diff --git a/en/application-dev/application-models/common-event-subscription.md b/en/application-dev/application-models/common-event-subscription.md
index 6cdc52ef9b798e48a911892f965db8fbf2aaa67f..c3e3ebfa52415d5e0ebade26973f78a589fb348f 100644
--- a/en/application-dev/application-models/common-event-subscription.md
+++ b/en/application-dev/application-models/common-event-subscription.md
@@ -32,7 +32,7 @@ For details about the APIs, see [API Reference](../reference/apis/js-apis-common
let subscriber = null;
// Subscriber information.
let subscribeInfo = {
- events: ["usual.event.SCREEN_OFF"], // Subscribe to the common event screen-off.
+ events: ["usual.event.SCREEN_OFF"], // Subscribe to the common event screen-off.
}
```
@@ -41,13 +41,13 @@ For details about the APIs, see [API Reference](../reference/apis/js-apis-common
```ts
// Callback for subscriber creation.
commonEventManager.createSubscriber(subscribeInfo, (err, data) => {
- if (err) {
- console.error(`[CommonEvent] CreateSubscriberCallBack err=${JSON.stringify(err)}`);
- } else {
- console.info(`[CommonEvent] CreateSubscriber success`);
- subscriber = data;
- // Callback for common event subscription.
- }
+ if (err) {
+ console.error(`Failed to create subscriber. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in creating subscriber.');
+ subscriber = data;
+ // Callback for common event subscription.
})
```
@@ -56,14 +56,13 @@ For details about the APIs, see [API Reference](../reference/apis/js-apis-common
```ts
// Callback for common event subscription.
if (subscriber !== null) {
- commonEventManager.subscribe(subscriber, (err, data) => {
- if (err) {
- console.error(`[CommonEvent] SubscribeCallBack err=${JSON.stringify(err)}`);
- } else {
- console.info(`[CommonEvent] SubscribeCallBack data=${JSON.stringify(data)}`);
- }
- })
+ commonEventManager.subscribe(subscriber, (err, data) => {
+ if (err) {
+ console.error(`Failed to subscribe common event. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ })
} else {
- console.error(`[CommonEvent] Need create subscriber`);
+ console.error(`Need create subscriber`);
}
```
diff --git a/en/application-dev/application-models/figures/AccessibilityFramework.png b/en/application-dev/application-models/figures/AccessibilityFramework.png
new file mode 100644
index 0000000000000000000000000000000000000000..786233e6ac160972f62b9786397eb077f7ee767c
Binary files /dev/null and b/en/application-dev/application-models/figures/AccessibilityFramework.png differ
diff --git a/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg b/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg
deleted file mode 100644
index 9c797ff4575ae0aaf9aad27ae5d4d701181faf97..0000000000000000000000000000000000000000
Binary files a/en/application-dev/application-models/figures/WidgetCanvasDemo.jpeg and /dev/null differ
diff --git a/en/application-dev/application-models/figures/WidgetCanvasDemo.png b/en/application-dev/application-models/figures/WidgetCanvasDemo.png
new file mode 100644
index 0000000000000000000000000000000000000000..c09c82dd88cf002020990b5b8327701c445eeaaf
Binary files /dev/null and b/en/application-dev/application-models/figures/WidgetCanvasDemo.png differ
diff --git a/en/application-dev/application-models/inputmethodextentionability.md b/en/application-dev/application-models/inputmethodextentionability.md
index 2b3910707ecdb6f964822380a85b14857ec8fd29..b36cf2a050cd15c1d4047410406ed46343f604e5 100644
--- a/en/application-dev/application-models/inputmethodextentionability.md
+++ b/en/application-dev/application-models/inputmethodextentionability.md
@@ -1,11 +1,11 @@
# InputMethodExtensionAbility Development
-[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md) is an ExtensionAbility component of the inputMethod type that provides extension capabilities for the input method framework.
+## When to Use
+[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md), inherited from [ExtensionAbility](extensionability-overview.md), is used for developing input method applications.
-InputMethodExtensionAbility can be started or connected by other application components to process transactions in the background based on the request of the caller.
+The entire lifecycle of the [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md) instance and the owning ExtensionAbility process is scheduled and managed by the input method framework. The input method framework provides the [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md) base class. Derive this base class to implement initialization and resource clearing.
-
-InputMethodExtensionAbility provides related capabilities through the [InputMethodExtensionContext](../reference/apis/js-apis-inputmethod-extension-context.md).
+[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md) provides related capabilities through [InputMethodExtensionContext](../reference/apis/js-apis-inputmethod-extension-context.md).
## Implementing an Input Method Application
@@ -13,15 +13,13 @@ InputMethodExtensionAbility provides related capabilities through the [InputMeth
InputMethodExtensionAbility provides the **onCreate()** and **onDestory()** callbacks, as described below. Override them as required.
- **onCreate**
-
This callback is triggered when a service is created for the first time. You can perform initialization operations, for example, registering a common event listener.
-
+
> **NOTE**
>
> If a service has been created, starting it again does not trigger the **onCreate()** callback.
-
+
- **onDestroy**
-
This callback is triggered when the service is no longer used and the instance is ready for destruction. You can clear resources in this callback, for example, deregister the listener.
@@ -29,7 +27,7 @@ InputMethodExtensionAbility provides the **onCreate()** and **onDestory()** call
To implement an input method application, manually create an InputMethodExtensionAbility component in DevEco Studio. The procedure is as follows:
-In the **ets** directory of the target module, right-click and choose **New** > **Extention Ability** > **InputMethod** to a minimum template of InputMethodExtensionAbility.
+In the **ets** directory of the target module, right-click and choose **New** > **Extension Ability** > **InputMethod** to a minimum template of InputMethodExtensionAbility.
> **NOTE**
>
@@ -70,7 +68,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
onDestroy() {
console.log("onDestroy.");
- this.context.destroy();
+ this.keyboardController.onDestroy(); // Destroy the window and deregister the event listener.
}
}
```
@@ -109,7 +107,6 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
this.unRegisterListener(); // Deregister the event listener.
let win = windowManager.findWindow(this.windowName);
win.destroyWindow(); // Destroy the window.
- this.mContext.terminateSelf(); // Terminate the InputMethodExtensionAbility service.
}
private initWindow(): void // Initialize the window.
@@ -159,7 +156,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
})
globalThis.inputAbility.on('inputStop', (imeId) => {
if (imeId == "Bundle name/Ability name") {
- this.onDestroy();
+ this.mContext.destroy(); // Destroy the InputMethodExtensionAbility service.
}
});
}
@@ -233,7 +230,7 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
Add the path to this file to the **src** field in the **resources/base/profile/main_pages.json** file.
- ```ts
+ ```ets
import { numberSourceListData, sourceListType } from './keyboardKeyData'
@Component
@@ -342,12 +339,12 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
}
```
- Register the InputMethodExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the target module. Set **type** to **"inputMethod"** and **srcEntry** to the code path of the InputMethodExtensionAbility component.
+5. Register the InputMethodExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"inputMethod"** and **srcEntry** to the code path of the InputMethodExtensionAbility component.
```ts
{
"module": {
- // ...
+ ...
"extensionAbilities": [
{
"description": "inputMethod",
@@ -364,3 +361,47 @@ The minimum template contains four files: **KeyboardController.ts**, **InputMeth
+## Restrictions
+
+To reduce the risk of abuse of the InputMethodExtensionAbility by third-party applications, the invoking of APIs in the following modules is restricted in the InputMethodExtensionAbility:
+
+> **NOTE**
+>
+> - If a restricted module is imported, no error is reported during compilation, but an incorrect value (**undefined**) is returned during running. As a result, the module does not take effect.
+> - Currently, access to the [@ohos.multimedia.audio (Audio Management)](../reference/apis/js-apis-audio.md) module is allowed, with compliance with the following rules:
+> - Users who deny the recording permission should still be allowed to use the non-voice-input features of the input method application.
+> - Recording-related services are allowed only when the InputMethodExtensionAbility is in the foreground. For example, perform recording only when the soft keyboard is in the foreground and the user is proactively using the voice input method; stop recording when the application is switched to the background.
+> - Applications will see increasingly stringent measures against violations with the preceding rules, and any violation may result in function exceptions.
+
+**Restricted modules:**
+
+- [@ohos.ability.featureAbility (FeatureAbility)](../reference/apis/js-apis-ability-featureAbility.md)
+- [@ohos.ability.particleAbility (ParticleAbility)](../reference/apis/js-apis-ability-particleAbility.md)
+- [@ohos.account.distributedAccount (Distributed Account Management)](../reference/apis/js-apis-distributed-account.md)
+- [@ohos.backgroundTaskManager (Background Task Management)](../reference/apis/js-apis-backgroundTaskManager.md)
+- [@ohos.bluetooth (Bluetooth)](../reference/apis/js-apis-bluetooth.md)
+- [@ohos.bluetoothManager (Bluetooth)](../reference/apis/js-apis-bluetoothManager.md)
+- [@ohos.connectedTag (Active Tags)](../reference/apis/js-apis-connectedTag.md)
+- [@ohos.geolocation (Geolocation)](../reference/apis/js-apis-geolocation.md)
+- [@ohos.geoLocationManager (Geolocation Manager)](../reference/apis/js-apis-geoLocationManager.md)
+- [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](../reference/apis/js-apis-cardEmulation.md)
+- [@ohos.nfc.controller (Standard NFC)](../reference/apis/js-apis-nfcController.md)
+- [@ohos.nfc.tag (Standard NFC Tags)](../reference/apis/js-apis-nfcTag.md)
+- [@ohos.reminderAgent (Reminder Agent)](../reference/apis/js-apis-reminderAgent.md)
+- [@ohos.reminderAgentManager (reminderAgentManager)](../reference/apis/js-apis-reminderAgentManager.md)
+- [@ohos.sensor (Sensor)](../reference/apis/js-apis-sensor.md)
+- [@ohos.telephony.call (Call)](../reference/apis/js-apis-call.md)
+- [@ohos.telephony.data (Cellular Data)](../reference/apis/js-apis-telephony-data.md)
+- [@ohos.telephony.observer (observer)](../reference/apis/js-apis-observer.md)
+- [@ohos.telephony.radio (Network Search)](../reference/apis/js-apis-radio.md)
+- [@ohos.telephony.sim (SIM Management)](../reference/apis/js-apis-sim.md)
+- [@ohos.telephony.sms (SMS)](../reference/apis/js-apis-sms.md)
+- [@ohos.wallpaper (Wallpaper)](../reference/apis/js-apis-wallpaper.md)
+- [@ohos.wifiext (WLAN Extension)](../reference/apis/js-apis-wifiext.md)
+- [@ohos.wifiManager (WLAN)](../reference/apis/js-apis-wifiManager.md)
+- [@ohos.wifiManagerExt (WLAN Extension Interface)](../reference/apis/js-apis-wifiManagerExt.md)
+- [@system.geolocation (Geolocation)](../reference/apis/js-apis-system-location.md)
+- [nfctech (Standard NFC Technologies)](../reference/apis/js-apis-nfctech.md)
+- [tagSession (Standard NFC Tag Session)](../reference/apis/js-apis-tagSession.md)
+
+
diff --git a/en/application-dev/application-models/service-widget-overview.md b/en/application-dev/application-models/service-widget-overview.md
index 3739129f2a07765b2ebe015910d1d6e3d8d721d0..528d9d4c134107c30de75f7f9e84ab42be514224 100644
--- a/en/application-dev/application-models/service-widget-overview.md
+++ b/en/application-dev/application-models/service-widget-overview.md
@@ -6,7 +6,7 @@ A service widget (also called widget) is a set of UI components that display imp
## Service Widget Architecture
- **Figure 1** Service widget architecture
+**Figure 1** Service widget architecture

@@ -24,7 +24,7 @@ Before you get started, it would be helpful if you have a basic understanding of
Below is the typical procedure of using the widget:
- **Figure 2** Typical procedure of using the widget
+**Figure 2** Typical procedure of using the widget

@@ -55,4 +55,4 @@ ArkTS widgets and JS widgets have different implementation principles and featur
| Custom drawing| Not supported| Supported|
| Logic code execution (excluding the import capability)| Not supported| Supported|
-As can be seen above, ArkTS widgets have more capabilities and use cases than JS widgets. Therefore, ArkTS widgets are always recommended, except for the case where the widget consists of only static pages.
+As can be seen above, ArkTS widgets provide more capabilities and use cases than JS widgets. Therefore, ArkTS widgets are always recommended, except for the case where the widget consists of only static pages.
diff --git a/en/application-dev/connectivity/Readme-EN.md b/en/application-dev/connectivity/Readme-EN.md
index 59df854e8a37289cc9dcf55ed2f7d8110a7c84d0..c09ca21b6d0814bd1cd2cecb95b0d2896fada8c4 100755
--- a/en/application-dev/connectivity/Readme-EN.md
+++ b/en/application-dev/connectivity/Readme-EN.md
@@ -5,7 +5,6 @@
- [HTTP Data Request](http-request.md)
- [WebSocket Connection](websocket-connection.md)
- [Socket Connection](socket-connection.md)
- - [Network Policy Management](net-policy-management.md)
- [Network Sharing](net-sharing.md)
- [Ethernet Connection](net-ethernet.md)
- [Network Connection Management](net-connection-manager.md)
diff --git a/en/application-dev/connectivity/net-connection-manager.md b/en/application-dev/connectivity/net-connection-manager.md
index 5ee75a717882c3344612e741b2e197fa6e57509d..c443c93759caddbc5203b65022426882c0bb960b 100644
--- a/en/application-dev/connectivity/net-connection-manager.md
+++ b/en/application-dev/connectivity/net-connection-manager.md
@@ -39,7 +39,7 @@ For the complete list of APIs and example code, see [Network Connection Manageme
| ---- | ---- | ---- |
| ohos.net.connection | function getDefaultNet(callback: AsyncCallback\): void; |Creates a **NetHandle** object that contains the **netId** of the default network. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getGlobalHttpProxy10+(callback: AsyncCallback\): void;| Obtains the global HTTP proxy for the network. This API uses an asynchronous callback to return the result.|
-| ohos.net.connection | function setGlobalHttpProxy10+(httpProxy: HttpProxy, callback: AsyncCallback): void;| Sets the global HTTP proxy for the network. This API uses an asynchronous callback to return the result.|
+| ohos.net.connection | function setGlobalHttpProxy10+(httpProxy: HttpProxy, callback: AsyncCallback\): void;| Sets the global HTTP proxy for the network. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getAppNet9+(callback: AsyncCallback\): void;| Obtains a **NetHandle** object that contains the **netId** of the network bound to the application. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function setAppNet9+(netHandle: NetHandle, callback: AsyncCallback\): void;| Binds an application to the specified network. The application can access the external network only through this network. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getDefaultNetSync9+(): NetHandle; |Obtains the default active data network in synchronous mode. You can use **getNetCapabilities** to obtain information such as the network type and capabilities.|
@@ -47,7 +47,7 @@ For the complete list of APIs and example code, see [Network Connection Manageme
| ohos.net.connection | function getAllNets(callback: AsyncCallback\>): void;| Obtains the list of **NetHandle** objects of the connected network. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\): void; |Obtains link information of the default network. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\): void; |Obtains the capability set of the default network. This API uses an asynchronous callback to return the result.|
-| ohos.net.connection | function isDefaultNetMetered9+(callback: AsyncCallback): void; |Checks whether the data traffic usage on the current network is metered. This API uses an asynchronous callback to return the result.|
+| ohos.net.connection | function isDefaultNetMetered9+(callback: AsyncCallback\): void; |Checks whether the data traffic usage on the current network is metered. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback\): void;| Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback\): void;| Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. This API uses an asynchronous callback to return the result.|
| ohos.net.connection | function getAddressesByName(host: string, callback: AsyncCallback\>): void; |Obtains all IP addresses of the specified network by resolving the domain name. This API uses an asynchronous callback to return the result.|
diff --git a/en/application-dev/connectivity/net-mgmt-overview.md b/en/application-dev/connectivity/net-mgmt-overview.md
index 043d41768f89dd851839eae893b7ba4409395f5e..f03d7668edc9fc27ef22c4ef4d69b186f7b4c3d9 100644
--- a/en/application-dev/connectivity/net-mgmt-overview.md
+++ b/en/application-dev/connectivity/net-mgmt-overview.md
@@ -5,7 +5,6 @@ Network management functions include:
- [HTTP data request](http-request.md): initiates a data request through HTTP.
- [WebSocket connection](websocket-connection.md): establishes a bidirectional connection between the server and client through WebSocket.
- [Socket connection](socket-connection.md): transmits data through Socket.
-- [Network policy management](net-policy-management.md): restricts network capabilities by setting network policies, including cellular network policy, sleep/power-saving mode policy, and background network policy, and resets network policies as needed.
- [Network sharing](net-sharing.md): shares a device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing, and queries the network sharing state and shared mobile data volume.
- [Ethernet connection](net-ethernet.md): provides wired network capabilities, which allow you to set the IP address, subnet mask, gateway, and Domain Name System (DNS) server of a wired network.
- [Network connection management](net-connection-manager.md): provides basic network management capabilities, including management of Wi-Fi/cellular/Ethernet connection priorities, network quality evaluation, subscription to network connection status changes, query of network connection information, and DNS resolution.
diff --git a/en/application-dev/connectivity/net-policy-management.md b/en/application-dev/connectivity/net-policy-management.md
deleted file mode 100644
index 6450bd671e565fdffafb7eeed499e123893a45a3..0000000000000000000000000000000000000000
--- a/en/application-dev/connectivity/net-policy-management.md
+++ /dev/null
@@ -1,402 +0,0 @@
-# Network Policy Management
-
-## Introduction
-
-The Network Policy Management module allows you to restrict network capabilities by setting network policies, including cellular network policy, sleep/power-saving mode policy, and background network policy, and to reset network policies as needed.
-
-> **NOTE**
-> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-policy.md).
-
-## Basic Concepts
-
-- Sleep mode: A mode in which the system shuts down some idle components and peripherals to enter the low-power mode and restricts some applications from accessing the network.
-- Power-saving mode: A mode in which the system disables certain functions and features to save power. When this mode is enabled, the system performance deteriorates and some applications are restricted from accessing the network.
-- Traffic-saving mode: A mode in which the system restricts background applications that use the metering network. It is equivalent to the background network policy.
-- Cellular network: A mobile communication network.
-- Metering network: A mobile network with preconfigured traffic quota, WLAN network, or Ethernet network.
-
-## **Constraints**
-
-- Programming language: C++ and JS
-- System: Linux kernel
-- 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.
-
-## When to Use
-
-Typical application scenarios of network policy management are as follows:
-
-- Managing the metering network policy: Set the metering network quota and obtain the configured metering network policy.
-- Managing network access for an application in the background: Set and obtain the status of the background network restriction switch, and check whether the application indicated by the specified UID can access the network in the background.
-- Managing the metering network access policy: Set and obtain the policy for the application indicated by the specified UID to access the metering network, and obtain the UIDs of the applications for which the policy is configured.
-- Restoring network policies
-- Checking whether an application indicated by the specified UID can access a metering or non-metering network
-- Adding a UID to or removing a UID from the sleep mode allowlist, and obtaining the sleep mode allowlist
-- Adding a UID to or removing a UID from the power-saving mode allowlist, and obtaining the power-saving mode allowlist
-- Updating the network notification policy
-
-The following describes the development procedure specific to each application scenario.
-
-## Available APIs
-
-For the complete list of APIs and example code, see [Network Policy Management](../reference/apis/js-apis-net-policy.md).
-
-| Type| API| Description|
-| ---- | ---- | ---- |
-| ohos.net.policy | function setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void |Sets a background network policy. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function isBackgroundAllowed(callback: AsyncCallback\): void; |Obtains the background network policy. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void; |Sets an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getPolicyByUid(uid: number, callback: AsyncCallback\): void;| Obtains an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void; | Obtains the UID array of applications configured with a certain application-specific network policy. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getNetQuotaPolicies(callback: AsyncCallback\>): void; |Obtains the network quota policies. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void; |Sets an array of network quota policies. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function restoreAllPolicies(iccid: string, callback: AsyncCallback\): void; | Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void; | Checks whether an application is allowed to access metering or non-metering networks. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void; | Checks whether an application is allowed to access the given network. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void; | Sets whether to add an application to the device idle allowlist. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getDeviceIdleAllowList(callback: AsyncCallback\>): void; | Obtains the UID array of applications that are on the device idle allowlist. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void; | Obtains the background network policies configured for the given application. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function resetPolicies(iccid: string, callback: AsyncCallback\): void; | Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void; | Updates a reminder policy. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void; | Sets whether to add an application to the power-saving allowlist. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function getPowerSaveAllowList(callback: AsyncCallback\>): void; | Obtains the UID array of applications that are on the power-saving allowlist. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void; | Subscribes to policy changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function off(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void; | Unsubscribes from policy changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void; | Subscribes to rule changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function off(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void; | Unsubscribes from rule changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function on(type: "netMeteredIfacesChange", callback: Callback\>): void; | Subscribes to metered **iface** changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function off(type: "netMeteredIfacesChange", callback: Callback\>): void; | Unsubscribes from metered **iface** changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function on(type: "netQuotaPolicyChange", callback: Callback\>): void; | Subscribes to network quota policy changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function off(type: "netQuotaPolicyChange", callback: Callback\>): void; | Unsubscribes from network quota policy changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function on(type: "netBackgroundPolicyChange", callback: Callback\): void; | Subscribes to background network policy changes. This API uses an asynchronous callback to return the result.|
-| ohos.net.policy | function off(type: "netBackgroundPolicyChange", callback: Callback\): void; | Unsubscribes from background network policy changes. This API uses an asynchronous callback to return the result.|
-
-## Managing the Metering Network Policy
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **setNetQuotaPolicies** to configure the metering network policy.
-
-3. Call **getNetQuotaPolicies** to obtain the configured metering network policy.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy';
-
- addNetQuotaPolicy(){
- let param = {
- // For details about the value of netType, see [NetBearType](../reference/apis/js-apis-net-connection.md#netbeartype).
- netType:Number.parseInt(this.netType),
-
- // Integrated circuit card identifier (ICCID) of the SIM card on the metering cellular network. It is not available for an Ethernet or Wi-Fi network.
- iccid:this.iccid,
-
- // Used together with ICCID on the metering cellular network. It is used independently on an Ethernet or Wi-Fi network.
- ident:this.ident,
-
- // Metering start time, for example, M1, D1, and Y1.
- periodDuration:this.periodDuration,
-
- // Set the traffic threshold for generating an alarm to an integer greater than 0.
- warningBytes:Number.parseInt(this.warningBytes),
-
- // Set the traffic quota to an integer greater than 0.
- limitBytes:Number.parseInt(this.limitBytes),
-
- // Specify whether the network is a metering network. The value true means a metering network and false means a non-metering network.
- metered:Boolean(Number.parseInt(this.metered)),https://gitee.com/openharmony/docs/pulls/14404
- // For details about the action triggered after the traffic limit is reached, see [LimitAction](../reference/apis/js-apis-net-policy.md#limitaction).
- limitAction:Number.parseInt(this.limitAction)
- };
- this.netQuotaPolicyList.push(param);
- },
-
- // Subscribe to metered iface changes.
- policy.on('netMeteredIfacesChange', (data) => {
- this.log('on netMeteredIfacesChange: ' + JSON.stringify(data));
- });
-
- // Subscribe to metering network policy changes.
- policy.on('netQuotaPolicyChange', (data) => {
- this.log('on netQuotaPolicyChange: ' + JSON.stringify(data));
- });
-
- // Call setNetQuotaPolicies to configure the metering network policy.
- setNetQuotaPolicies(){
- this.dialogType = DialogType.HIDE;
- policy.setNetQuotaPolicies(this.netQuotaPolicyList, (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data));
- });
- },
-
- // Call getNetQuotaPolicies to obtain the configured metering network policy.
- getNetQuotaPolicies(){
- policy.getNetQuotaPolicies((err, data) => {
- this.callBack(err, data);
- if(data){
- this.netQuotaPolicyList = data;
- }
- });
- },
-
- // Unsubscribe from metered iface changes.
- policy.off('netMeteredIfacesChange', (data) => {
- this.log('off netMeteredIfacesChange: ' + JSON.stringify(data));
- });
-
- // Unsubscribe from metering network policy changes.
- policy.off('netQuotaPolicyChange', (data) => {
- this.log('off netQuotaPolicyChange: ' + JSON.stringify(data));
- });
-```
-
-## Managing Network Access for an Application in the Background
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **setBackgroundAllowed** to enable or disable the background network restriction switch.
-
-3. Call **isBackgroundAllowed** to check whether the background network restriction switch is enabled or disabled.
-
-4. Call **getBackgroundPolicyByUid** to check whether the application indicated b the specified UID can access the network in the background.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Subscribe to background network policy changes.
- policy.on('netBackgroundPolicyChange', (data) => {
- this.log('on netBackgroundPolicyChange: ' + JSON.stringify(data));
- });
-
- // Call setBackgroundAllowed to enable or disable the background network restriction switch.
- setBackgroundAllowed() {
- policy.setBackgroundAllowed(Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call isBackgroundAllowed to check whether the background network restriction switch is enabled or disabled.
- isBackgroundAllowed() {
- policy.isBackgroundAllowed((err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call getBackgroundPolicyByUid to check whether the application indicated b the specified UID can access the network in the background.
- getBackgroundPolicyByUid() {
- policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Unsubscribe from background network policy changes.
- policy.off('netBackgroundPolicyChange', (data) => {
- this.log('off netBackgroundPolicyChange: ' + JSON.stringify(data));
- });
-```
-
-## Managing the Metering Network Access Policy
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **setPolicyByUid** to set whether the application indicated by the specified UID can access the network in the background.
-
-3. Call **getPolicyByUid** to check whether the metering network access policy for the application indicated by the specified UID.
-
-4. Call **getUidsByPolicy** to obtain the UIDs of the applications for which the metering network access policy is configured.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Subscribe to policy changes of the application indicated by the specified UID.
- policy.on('netUidPolicyChange', (data) => {
- this.log('on netUidPolicyChange: ' + JSON.stringify(data));
- });
-
- // Subscribe to rule changes of the application indicated by the specified UID.
- policy.on('netUidRuleChange', (data) => {
- this.log('on netUidRuleChange: ' + JSON.stringify(data));
- });
-
- // Call setPolicyByUid to set whether the application indicated by the specified UID can access the network in the background.
- setPolicyByUid() {
- let param = {
- uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy)
- }
- policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call getPolicyByUid to check whether the metering network access policy for the application indicated by the specified UID.
- getPolicyByUid() {
- policy.getPolicyByUid(Number.parseInt(this.firstParam), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call getUidsByPolicy to obtain the UIDs of the applications for which the metering network access policy is configured.
- getUidsByPolicy(){
- policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Unsubscribe from policy changes of the application indicated by the specified UID.
- policy.off('netUidPolicyChange', (data) => {
- this.log('off netUidPolicyChange: ' + JSON.stringify(data));
- });
-
- // Unsubscribe from rule changes of the application indicated by the specified UID.
- policy.off('netUidRuleChange', (data) => {
- this.log('off netUidRuleChange: ' + JSON.stringify(data));
- });
-
-```
-
-## Restoring Network Policies
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **restoreAllPolicies** to restore all network policies.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Call restoreAllPolicies to restore all network policies.
- restoreAllPolicies(){
- policy.restoreAllPolicies(this.firstParam, (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-```
-
-## Checking Access to a Metering or Non-metering Network
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **isUidNetAllowed** to check whether the UID can access the metering or non-metering network.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Call isUidNetAllowed to check whether the application indicated by the specified UID can access the metering or non-metering network.
- isUidNetAllowedIsMetered(){
- let param = {
- uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean))
- }
- policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-```
-
-## Managing the Sleep Mode Allowlist
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **setDeviceIdleAllowList** to add a UID to or remove a UID from the sleep mode allowlist.
-
-3. Call **getDeviceIdleAllowList** to obtain the UIDs added to the sleep mode allowlist.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Call setDeviceIdleAllowList to add a UID to or remove a UID from the sleep mode allowlist.
- setDeviceIdleAllowList(){
- let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
- }
- policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call getDeviceIdleAllowList to obtain the UIDs added to the sleep mode allowlist.
- getDeviceIdleAllowList(){
- policy.getDeviceIdleAllowList((err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-```
-
-## Managing the Power-saving Mode Allowlist
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-2. Call **setPowerSaveAllowList** to add a UID to or remove a UID from the power-saving mode allowlist.
-3. Call **getPowerSaveAllowList** to obtain the UIDs added to the power-saving mode allowlist.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Call setPowerSaveAllowList to add a UID to or remove a UID from the power-saving mode allowlist.
- setPowerSaveAllowList(){
- let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
- }
- policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-
- // Call getPowerSaveAllowList to obtain the UIDs added to the power-saving mode allowlist.
- getPowerSaveAllowList(){
- policy.getPowerSaveAllowList((err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-```
-
-## Updating the Network Notification Policy
-
-### How to Develop
-
-1. Import the **policy** namespace from **@ohos.net.policy.d.ts**.
-
-2. Call **updateRemindPolicy** to update the network notification policy.
-
-```js
- // Import the policy namespace.
- import policy from '@ohos.net.policy'
-
- // Call updateRemindPolicy to update the network notification policy.
- updateRemindPolicy() {
- let param = {
- netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType
- }
- policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (err, data) => {
- console.log(JSON.stringify(err));
- console.log(JSON.stringify(data))
- });
- },
-```
diff --git a/en/application-dev/device/usb-guidelines.md b/en/application-dev/device/usb-guidelines.md
index 68c8c3de013e75d56854bf0cf0e3a71aca9eb261..ef09e1ee89940220f8b9d1936362d34ebf8bf7a6 100644
--- a/en/application-dev/device/usb-guidelines.md
+++ b/en/application-dev/device/usb-guidelines.md
@@ -1,156 +1,161 @@
# USB Service Development
+
## When to Use
In Host mode, you can obtain the list of connected USB devices, enable or disable the devices, manage device access permissions, and perform data transfer or control transfer.
-## APIs
+
+## Available APIs
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usbManager.md).
-**Table 1** Open USB APIs
+**Table 1** Open USB APIs
-| API | Description |
+| Name | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
-| hasRight(deviceName: string): boolean | Checks whether the user has the device access permissions. |
-| requestRight(deviceName: string): Promise\ | Requests the temporary permission for a given application to access the USB device. This API uses a promise to return the result. |
-| connectDevice(device: USBDevice): Readonly\ | Connects to the USB device based on the device list returned by `getDevices()`. |
-| getDevices(): Array> | Obtains the list of USB devices connected to the USB host. If no USB device is connected, an empty list is returned. |
-| setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number | Sets the USB device configuration. |
-| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
-| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number | Claims a USB interface. |
-| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise\ | Performs bulk transfer. |
-| closePipe(pipe: USBDevicePipe): number | Closes a USB device pipe. |
-| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. |
-| getFileDescriptor(pipe: USBDevicePipe): number | Obtains the file descriptor. |
-| getRawDescriptor(pipe: USBDevicePipe): Uint8Array | Obtains the raw USB descriptor. |
-| controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise<number> | Performs control transfer. |
+| hasRight(deviceName: string): boolean | Checks whether the user has the device access permissions.|
+| requestRight(deviceName: string): Promise<boolean> | Requests the device access permissions for the application. This API uses a promise to return the result. |
+| removeRight(deviceName: string): boolean | Revokes the device access permissions of the application.|
+| connectDevice(device: USBDevice): Readonly<USBDevicePipe> | Connects to the USB device based on the device information returned by `getDevices()`. |
+| getDevices(): Array<Readonly<USBDevice>> | Obtains the list of USB devices connected to the host. If no device is connected, an empty list is returned. |
+| setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number | Sets the USB device configuration. |
+| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
+| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number | Claims a USB interface. |
+| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise<number> | Performs bulk transfer. |
+| closePipe(pipe: USBDevicePipe): number | Closes a USB device pipe. |
+| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | Releases a USB interface. |
+| getFileDescriptor(pipe: USBDevicePipe): number | Obtains the file descriptor. |
+| getRawDescriptor(pipe: USBDevicePipe): Uint8Array | Obtains the raw USB descriptor. |
+| controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise<number> | Performs control transfer. |
+
## How to Develop
-You can set a USB device as the USB host to connect to other USB devices for data transfer. The development procedure is as follows:
-
-1. Obtain the USB device list.
-
- ```js
- // Import the USB API package.
- import usb from '@ohos.usbManager';
- // Obtain the USB device list.
- let deviceList = usb.getDevices();
- /*
- Example deviceList structure
- [
- {
- name: "1-1",
- serial: "",
- manufacturerName: "",
- productName: "",
- version: "",
- vendorId: 7531,
- productId: 2,
- clazz: 9,
- subClass: 0,
- protocol: 1,
- devAddress: 1,
- busNum: 1,
- configs: [
- {
- id: 1,
- attributes: 224,
- isRemoteWakeup: true,
- isSelfPowered: true,
- maxPower: 0,
- name: "1-1",
- interfaces: [
- {
- id: 0,
- protocol: 0,
- clazz: 9,
- subClass: 0,
- alternateSetting: 0,
- name: "1-1",
- endpoints: [
- {
- address: 129,
- attributes: 3,
- interval: 12,
- maxPacketSize: 4,
- direction: 128,
- number: 1,
- type: 3,
- interfaceId: 0,
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- */
- ```
-
+You can set a USB device as a host to connect to a device for data transfer. The development procedure is as follows:
+
+
+1. Obtain the USB device list.
+
+ ```js
+ // Import the USB API package.
+ import usb from '@ohos.usbManager';
+ // Obtain the USB device list.
+ let deviceList = usb.getDevices();
+ /*
+ Example deviceList structure:
+ [
+ {
+ name: "1-1",
+ serial: "",
+ manufacturerName: "",
+ productName: "",
+ version: "",
+ vendorId: 7531,
+ productId: 2,
+ clazz: 9,
+ subClass: 0,
+ protocol: 1,
+ devAddress: 1,
+ busNum: 1,
+ configs: [
+ {
+ id: 1,
+ attributes: 224,
+ isRemoteWakeup: true,
+ isSelfPowered: true,
+ maxPower: 0,
+ name: "1-1",
+ interfaces: [
+ {
+ id: 0,
+ protocol: 0,
+ clazz: 9,
+ subClass: 0,
+ alternateSetting: 0,
+ name: "1-1",
+ endpoints: [
+ {
+ address: 129,
+ attributes: 3,
+ interval: 12,
+ maxPacketSize: 4,
+ direction: 128,
+ number: 1,
+ type: 3,
+ interfaceId: 0,
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ]
+ */
+ ```
2. Obtain the device operation permissions.
- ```js
- let deviceName = deviceList[0].name;
- // Request the permissions to operate a specified device.
- usb.requestRight(deviceName).then(hasRight => {
- console.info("usb device request right result: " + hasRight);
- }).catch(error => {
- console.info("usb device request right failed : " + error);
- });
- ```
+ ```js
+ let deviceName = deviceList[0].name;
+ // Request the permissions to operate a specified device.
+ usb.requestRight(deviceName).then(hasRight => {
+ console.info("usb device request right result: " + hasRight);
+ }).catch(error => {
+ console.info("usb device request right failed : " + error);
+ });
+ ```
3. Open the device.
- ```js
- // Open the device, and obtain the USB device pipe for data transfer.
- let interface1 = deviceList[0].configs[0].interfaces[0];
- /*
- Claim the corresponding interface from deviceList.
- interface1 must be one present in the device configuration.
- */
- usb.claimInterface(pipe, interface1, true);
- ```
+ ```js
+ // Open the device, and obtain the USB device pipe for data transfer.
+ let pipe = usb.connectDevice(deviceList[0]);
+ let interface1 = deviceList[0].configs[0].interfaces[0];
+ /*
+ Claim the corresponding interface from **deviceList**.
+ interface1 must be one present in the device configuration.
+ */
+ usb.claimInterface(pipe, interface1, true);
+ ```
4. Perform data transfer.
- ```js
- /*
+ ```js
+ /*
Read data. Select the corresponding RX endpoint from deviceList for data transfer.
- (endpoint.direction == 0x80); dataUint8Array indicates the data to read. The data type is Uint8Array.
- */
- let inEndpoint = interface1.endpoints[2];
- let outEndpoint = interface1.endpoints[1];
- let dataUint8Array = new Uint8Array(1024);
- usb.bulkTransfer(pipe, inEndpoint, dataUint8Array, 15000).then(dataLength => {
- if (dataLength >= 0) {
- console.info("usb readData result Length : " + dataLength);
- } else {
- console.info("usb readData failed : " + dataLength);
- }
- }).catch(error => {
- console.info("usb readData error : " + JSON.stringify(error));
- });
- // Send data. Select the corresponding TX endpoint from deviceList for data transfer. (endpoint.direction == 0)
- usb.bulkTransfer(pipe, outEndpoint, dataUint8Array, 15000).then(dataLength => {
- if (dataLength >= 0) {
- console.info("usb writeData result write length : " + dataLength);
- } else {
- console.info("writeData failed");
- }
- }).catch(error => {
- console.info("usb writeData error : " + JSON.stringify(error));
- });
- ```
-
-5. Release the USB interface, and close the USB device.
-
- ```js
- usb.releaseInterface(pipe, interface);
- usb.closePipe(pipe);
- ```
\ No newline at end of file
+ (endpoint.direction == 0x80); dataUint8Array indicates the data to read. The data type is Uint8Array.
+ */
+ let inEndpoint = interface1.endpoints[2];
+ let outEndpoint = interface1.endpoints[1];
+ let dataUint8Array = new Uint8Array(1024);
+ usb.bulkTransfer(pipe, inEndpoint, dataUint8Array, 15000).then(dataLength => {
+ if (dataLength >= 0) {
+ console.info("usb readData result Length : " + dataLength);
+ } else {
+ console.info("usb readData failed : " + dataLength);
+ }
+ }).catch(error => {
+ console.info("usb readData error : " + JSON.stringify(error));
+ });
+ // Send data. Select the corresponding TX endpoint from deviceList for data transfer. (endpoint.direction == 0)
+ usb.bulkTransfer(pipe, outEndpoint, dataUint8Array, 15000).then(dataLength => {
+ if (dataLength >= 0) {
+ console.info("usb writeData result write length : " + dataLength);
+ } else {
+ console.info("writeData failed");
+ }
+ }).catch(error => {
+ console.info("usb writeData error : " + JSON.stringify(error));
+ });
+ ```
+
+5. Release the USB interface, and close the USB device.
+
+ ```js
+ usb.releaseInterface(pipe, interface1);
+ usb.closePipe(pipe);
+ ```
\ No newline at end of file
diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md
index fcac5325292b27f349f6c3dcadb627dca2dd0c03..44b69713783501cc21c0612fa2bb08390a53dcc0 100644
--- a/en/application-dev/internationalization/intl-guidelines.md
+++ b/en/application-dev/internationalization/intl-guidelines.md
@@ -111,7 +111,7 @@ The [i18n](../reference/apis/js-apis-i18n.md) module provides enhanced I18N capa
let dateTimeFormat = new Intl.DateTimeFormat();
```
- Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions9).
+ Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions6).
```js
let options = {dateStyle: "full", timeStyle: "full"};
@@ -181,7 +181,7 @@ The [i18n](../reference/apis/js-apis-i18n.md) module provides enhanced I18N capa
let numberFormat = new Intl.NumberFormat();
```
- Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions9).
+ Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions6).
```js
let options = {compactDisplay: "short", notation: "compact"};
@@ -240,7 +240,7 @@ Users in different regions have different requirements for string sorting. [Coll
let collator = new Intl.Collator();
```
- Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions9).
+ Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions8).
The **sensitivity** parameter is used to specify the levels of differences that will be used for string comparison. The value **base** indicates that only characters are compared, but not the accent and capitalization. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **accent** indicates that the accent is considered, but not the capitalization. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **case** indicates that the capitalization is considered, but the accent. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **variant** indicates that the accent and capitalization are considered. For example, 'a' != 'b', 'a' == '', 'a'=='A'.
```js
@@ -301,7 +301,7 @@ According to grammars in certain languages, the singular or plural form of a nou
let pluralRules = new Intl.PluralRules();
```
- Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions9).
+ Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions8).
```js
let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"});
@@ -349,7 +349,7 @@ According to grammars in certain languages, the singular or plural form of a nou
let relativeTimeFormat = new Intl.RelativeTimeFormat();
```
- Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions9).
+ Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions8).
```js
let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
@@ -384,4 +384,4 @@ According to grammars in certain languages, the singular or plural form of a nou
```js
let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
let options = relativeTimeFormat.resolvedOptions(); // options = {"locale": "zh-CN", "style": "long", "numeric": "always", "numberingSystem": "latn"}
- ```
+ ```
\ No newline at end of file
diff --git a/en/application-dev/notification/figures/en-us_image_0000001466462305.png b/en/application-dev/notification/figures/en-us_image_0000001466462305.png
index 740f4b79a9ee234008cad6cf3616a8f213569476..7db8892ea08d7bc75f87c1f90cc7bc7281a7e07e 100644
Binary files a/en/application-dev/notification/figures/en-us_image_0000001466462305.png and b/en/application-dev/notification/figures/en-us_image_0000001466462305.png differ
diff --git a/en/application-dev/notification/notification-enable.md b/en/application-dev/notification/notification-enable.md
index 4b0ecd303d8f13b3f7ba4f43364ddd53ffadc1d7..0ab05bec0d4ec44eee8f2c5c43151c2da6da51d3 100644
--- a/en/application-dev/notification/notification-enable.md
+++ b/en/application-dev/notification/notification-enable.md
@@ -1,17 +1,17 @@
# Enabling Notification
-To publish a notification, you must have notification enabled for your application. You can call the [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification) API to display a dialog box prompting the user to enable notification for your application. Note that the dialog box is displayed only when the API is called for the first time.
+To publish a notification, you must have notification enabled for your application. You can call the [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationmanagerrequestenablenotification) API to display a dialog box prompting the user to enable notification for your application. Note that the dialog box is displayed only when the API is called for the first time.
- **Figure 1** Dialog box prompting the user to enable notification
+**Figure 1** Dialog box prompting the user to enable notification

- Touching **allow** enables notification for the application, and touching **ban** keeps notification disabled.
-- The dialog box will not be displayed again when [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification) is called later. The user can manually enable notification as follows.
-
+- The dialog box will not be displayed again when [requestEnableNotification()](../reference/apis/js-apis-notificationManager.md#notificationmanagerrequestenablenotification) is called later. The user can manually enable notification as follows.
+
| 1. Swipe down from the upper left corner of the device screen to access the notification panel. | 2. Touch the **Settings** icon in the upper right corner. On the notification screen, locate the target application.| 3. Toggle on **Allow notifications**. |
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|  |  |  |
@@ -19,7 +19,7 @@ To publish a notification, you must have notification enabled for your applicati
## Available APIs
-For details about the APIs, see [@ohos.notificationManager](../reference/apis/js-apis-notificationManager.md#notificationrequestenablenotification).
+For details about the APIs, see [@ohos.notificationManager](../reference/apis/js-apis-notificationManager.md#notificationmanagerrequestenablenotification).
**Table 1** Notification APIs
diff --git a/en/application-dev/notification/notification-overview.md b/en/application-dev/notification/notification-overview.md
index 6bef8be8fd446e62b3e3da04582b467c9ddc5961..f3dd4149d7b9c77be498f6d02abed67d9e070ab8 100644
--- a/en/application-dev/notification/notification-overview.md
+++ b/en/application-dev/notification/notification-overview.md
@@ -24,4 +24,5 @@ A notification is generated by the notification sender and sent to the notificat
System applications also support notification-related configuration options, such as switches. The system configuration initiates a configuration request and sends the request to the notification subsystem for storage in the memory and database.
+**Figure 1** Notification service process

diff --git a/en/application-dev/notification/notification-subscription.md b/en/application-dev/notification/notification-subscription.md
index 95fe77de7feead97208082c12519523588cd6521..45e75f1f64606cfa89cae2cfae91b89a13faaa5c 100644
--- a/en/application-dev/notification/notification-subscription.md
+++ b/en/application-dev/notification/notification-subscription.md
@@ -16,19 +16,19 @@ The major APIs for notification subscription are described as follows. For detai
| Name | Description|
| -------- | -------- |
| subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void | Subscribes to notifications from a specific application.|
-| subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | Subscribes to notifications from all applications. |
+| subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | Subscribes to notifications from all applications. |
**Table 2** Callbacks for notification subscription
| Name | Description|
| -------- | -------- |
-| onConsume?:(data: SubscribeCallbackData) => void | Callback for receiving notifications. |
-| onCancel?:(data: SubscribeCallbackData) => void | Callback for canceling notifications. |
-| onUpdate?:(data: NotificationSortingMap) => void | Callback for notification sorting updates. |
-| onConnect?:() => void; | Callback for subscription. |
-| onDisconnect?:() => void; | Callback for unsubscription. |
-| onDestroy?:() => void | Callback for disconnecting from the notification subsystem. |
-| onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void | Callback for the Do Not Disturb (DNT) time changes.|
+| onConsume?:(data: SubscribeCallbackData) => void | Callback for receiving notifications. |
+| onCancel?:(data: SubscribeCallbackData) => void | Callback for canceling notifications. |
+| onUpdate?:(data: NotificationSortingMap) => void | Callback for notification sorting updates. |
+| onConnect?:() => void; | Callback for subscription. |
+| onDisconnect?:() => void; | Callback for unsubscription. |
+| onDestroy?:() => void | Callback for disconnecting from the notification subsystem. |
+| onDoNotDisturbDateChange?:(mode: notification.DoNotDisturbDate) => void | Callback for the Do Not Disturb (DNT) time changes.|
| onEnabledNotificationChanged?:(callbackData: EnabledNotificationCallbackData) => void | Callback for notification switch changes. |
@@ -46,37 +46,38 @@ The major APIs for notification subscription are described as follows. For detai
```ts
let subscriber = {
- onConsume: function (data) {
- let req = data.request;
- console.info('[ANS] onConsume callback req.id: ' + req.id);
- },
- onCancel: function (data) {
- let req = data.request;
- console.info('[ANS] onCancel callback req.id: : ' + req.id);
- },
- onUpdate: function (data) {
- console.info('[ANS] onUpdate in test');
- },
- onConnect: function () {
- console.info('[ANS] onConnect in test');
- },
- onDisconnect: function () {
- console.info('[ANS] onDisConnect in test');
- },
- onDestroy: function () {
- console.info('[ANS] onDestroy in test');
- },
+ onConsume: function (data) {
+ let req = data.request;
+ console.info(`onConsume callback. req.id: ${req.id}`);
+ },
+ onCancel: function (data) {
+ let req = data.request;
+ console.info(`onCancel callback. req.id: ${req.id}`);
+ },
+ onUpdate: function (data) {
+ let req = data.request;
+ console.info(`onUpdate callback. req.id: ${req.id}`);
+ },
+ onConnect: function () {
+ console.info(`onConnect callback.}`);
+ },
+ onDisconnect: function () {
+ console.info(`onDisconnect callback.}`);
+ },
+ onDestroy: function () {
+ console.info(`onDestroy callback.}`);
+ },
};
```
-
+
4. Initiate notification subscription.
```ts
notificationSubscribe.subscribe(subscriber, (err, data) => { // This API uses an asynchronous callback to return the result.
if (err) {
- console.error(`[ANS] subscribe failed, code is ${err.code}, message is ${err.message}`);
+ console.error(`Failed to subscribe notification. Code is ${err.code}, message is ${err.message}`);
return;
}
- console.info(`[ANS] subscribeTest success : + ${data}`);
+ console.info(`Succeeded in subscribing to notification. Data: ${data}`);
});
```
diff --git a/en/application-dev/notification/notification-with-wantagent.md b/en/application-dev/notification/notification-with-wantagent.md
index 47275ecabeed338cfb67cff44cb39c325498e0ff..638f53ef2f6f6fce1637468ba4c900496727f23d 100644
--- a/en/application-dev/notification/notification-with-wantagent.md
+++ b/en/application-dev/notification/notification-with-wantagent.md
@@ -4,7 +4,7 @@ A [WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md) object encapsu
Below you can see the process of adding a **WantAgent** object to a notification. The notification publisher requests a **WantAgent** object from the Ability Manager Service (AMS), and then sends a notification carrying the **WantAgent** object to the home screen. When the user touches the notification from the notification panel on the home screen, the **WantAgent** object is triggered.
- **Figure 1** Publishing a notification with a WantAgent object
+**Figure 1** Publishing a notification with a WantAgent object

@@ -15,11 +15,11 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
| Name| Description|
| -------- | -------- |
-|getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | Creates a **WantAgent** object.|
-|trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | Triggers a **WantAgent** object.|
-|cancel(agent: WantAgent, callback: AsyncCallback<void>): void | Cancels a **WantAgent** object.|
-|getWant(agent: WantAgent, callback: AsyncCallback<Want>): void | Obtains a **WantAgent** object.|
-|equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback<boolean>): void | Checks whether two **WantAgent** objects are equal.|
+| getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | Creates a **WantAgent** object.|
+| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | Triggers a **WantAgent** object.|
+| cancel(agent: WantAgent, callback: AsyncCallback<void>): void | Cancels a **WantAgent** object.|
+| getWant(agent: WantAgent, callback: AsyncCallback<Want>): void | Obtains a **WantAgent** object.|
+| equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback<boolean>): void | Checks whether two **WantAgent** objects are equal.|
## How to Develop
@@ -42,20 +42,20 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
// Set the action type through operationType of WantAgentInfo.
let wantAgentInfo = {
- wants: [
- {
- deviceId: '',
- bundleName: 'com.example.myapplication',
- abilityName: 'EntryAbility',
- action: '',
- entities: [],
- uri: '',
- parameters: {}
- }
- ],
- operationType: wantAgent.OperationType.START_ABILITY,
- requestCode: 0,
- wantAgentFlags:[wantAgent.WantAgentFlags.CONSTANT_FLAG]
+ wants: [
+ {
+ deviceId: '',
+ bundleName: 'com.example.myapplication',
+ abilityName: 'EntryAbility',
+ action: '',
+ entities: [],
+ uri: '',
+ parameters: {}
+ }
+ ],
+ operationType: wantAgent.OperationType.START_ABILITY,
+ requestCode: 0,
+ wantAgentFlags:[wantAgent.WantAgentFlags.CONSTANT_FLAG]
};
```
@@ -66,16 +66,16 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
// Set the action type through operationType of WantAgentInfo.
let wantAgentInfo = {
- wants: [
- {
- action: 'event_name', // Set the action name.
- parameters: {},
- }
- ],
- operationType: wantAgent.OperationType.SEND_COMMON_EVENT,
- requestCode: 0,
- wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG],
- }
+ wants: [
+ {
+ action: 'event_name', // Set the action name.
+ parameters: {},
+ }
+ ],
+ operationType: wantAgent.OperationType.SEND_COMMON_EVENT,
+ requestCode: 0,
+ wantAgentFlags: [wantAgent.WantAgentFlags.CONSTANT_FLAG],
+ };
```
4. Invoke the [getWantAgent()](../reference/apis/js-apis-app-ability-wantAgent.md#wantagentgetwantagent) API to create a **WantAgent** object.
@@ -83,12 +83,12 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
```typescript
// Create a WantAgent object.
wantAgent.getWantAgent(wantAgentInfo, (err, data) => {
- if (err) {
- console.error('[WantAgent]getWantAgent err=' + JSON.stringify(err));
- return;
- }
- console.info('[WantAgent]getWantAgent success');
- wantAgentObj = data;
+ if (err) {
+ console.error(`Failed to get want agent. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in geting want agent.');
+ wantAgentObj = data;
});
```
@@ -97,25 +97,25 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
```typescript
// Create a NotificationRequest object.
let notificationRequest: notificationManager.NotificationRequest = {
- content: {
- contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
- normal: {
- title: 'Test_Title',
- text: 'Test_Text',
- additionalText: 'Test_AdditionalText',
- },
+ content: {
+ contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
+ normal: {
+ title: 'Test_Title',
+ text: 'Test_Text',
+ additionalText: 'Test_AdditionalText',
},
- id: 1,
- label: 'TEST',
- wantAgent: wantAgentObj,
+ },
+ id: 1,
+ label: 'TEST',
+ wantAgent: wantAgentObj,
}
notificationManager.publish(notificationRequest, (err) => {
- if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
- return;
- }
- console.info(`[ANS] publish success`);
+ if (err) {
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in publishing notification.');
});
```
diff --git a/en/application-dev/notification/progress-bar-notification.md b/en/application-dev/notification/progress-bar-notification.md
index db7cae812218c2f7b6c363d204baa04dfeeb639f..4f016fefcbb6912fa9a0b998c7b5feb672503eee 100644
--- a/en/application-dev/notification/progress-bar-notification.md
+++ b/en/application-dev/notification/progress-bar-notification.md
@@ -27,13 +27,14 @@ In the [NotificationTemplate](../reference/apis/js-apis-inner-notification-notif
```ts
notificationManager.isSupportTemplate('downloadTemplate').then((data) => {
console.info(`[ANS] isSupportTemplate success`);
+ console.info('Succeeded in supporting download template notification.');
let isSupportTpl: boolean = data; // The value true means that the template of the downloadTemplate type is supported, and false means the opposite.
// ...
}).catch((err) => {
- console.error(`[ANS] isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
+ console.error(`Failed to support download template notification. Code is ${err.code}, message is ${err.message}`);
});
```
-
+
> **NOTE**
>
> Proceed with the step below only when the specified template is supported.
@@ -61,9 +62,9 @@ In the [NotificationTemplate](../reference/apis/js-apis-inner-notification-notif
// Publish the notification.
notificationManager.publish(notificationRequest, (err) => {
if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
return;
}
- console.info(`[ANS] publish success `);
+ console.info('Succeeded in publishing notification.');
});
```
diff --git a/en/application-dev/notification/text-notification.md b/en/application-dev/notification/text-notification.md
index 7901a78a4c547ca02caae191b551d27f6cae3e3a..fb1455e0dcdd791db6658935b48e90a6f14a3a14 100644
--- a/en/application-dev/notification/text-notification.md
+++ b/en/application-dev/notification/text-notification.md
@@ -3,8 +3,7 @@
You can publish basic notifications to send SMS messages, prompt messages, and advertisements. Available content types of basic notifications include normal text, long text, multi-line text, and picture-attached.
-
- **Table 1** Basic notification content types
+**Table 1** Basic notification content types
| Type| Description|
| -------- | -------- |
@@ -13,16 +12,16 @@ You can publish basic notifications to send SMS messages, prompt messages, and a
| NOTIFICATION_CONTENT_MULTILINE | Multi-line text notification.|
| NOTIFICATION_CONTENT_PICTURE | Picture-attached notification.|
+Notifications are displayed in the notification panel, which is the only supported subscriber to notifications. Below you can see two examples of the basic notification.
-Notifications are displayed in the notification panel, which is the only system subscriber to notifications. Below you can see two examples of the basic notification.
+**Figure 1** Examples of the basic notification
-**Figure 1** Examples of the basic notification

## Available APIs
-The following table describes the APIs for notification publishing. You specify the notification type by setting the [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest) parameter in the APIs.
+The following table describes the APIs for notification publishing. You specify the notification type by setting the [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest) parameter in the APIs.
| Name| Description|
| -------- | -------- |
@@ -48,21 +47,21 @@ The following table describes the APIs for notification publishing. You specify
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
- contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // Basic notification
- normal: {
- title: 'test_title',
- text: 'test_text',
- additionalText: 'test_additionalText',
- }
+ contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // Basic notification
+ normal: {
+ title: 'test_title',
+ text: 'test_text',
+ additionalText: 'test_additionalText',
+ }
}
- }
+ };
notificationManager.publish(notificationRequest, (err) => {
- if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
- return;
- }
- console.info(`[ANS] publish success.`);
+ if (err) {
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in publishing notification.');
});
```
@@ -74,25 +73,25 @@ The following table describes the APIs for notification publishing. You specify
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
- contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // Long-text notification
- longText: {
- title: 'test_title',
- text: 'test_text',
- additionalText: 'test_additionalText',
- longText: 'test_longText',
- briefText: 'test_briefText',
- expandedTitle: 'test_expandedTitle',
- }
+ contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // Long-text notification
+ longText: {
+ title: 'test_title',
+ text: 'test_text',
+ additionalText: 'test_additionalText',
+ longText: 'test_longText',
+ briefText: 'test_briefText',
+ expandedTitle: 'test_expandedTitle',
+ }
}
- }
+ };
// Publish the notification.
notificationManager.publish(notificationRequest, (err) => {
- if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
- return;
- }
- console.info(`[ANS] publish success.`);
+ if (err) {
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in publishing notification.');
});
```
@@ -104,24 +103,24 @@ The following table describes the APIs for notification publishing. You specify
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
- contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // Multi-line text notification
- multiLine: {
- title: 'test_title',
- text: 'test_text',
- briefText: 'test_briefText',
- longTitle: 'test_longTitle',
- lines: ['line_01', 'line_02', 'line_03', 'line_04'],
- }
+ contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // Multi-line text notification
+ multiLine: {
+ title: 'test_title',
+ text: 'test_text',
+ briefText: 'test_briefText',
+ longTitle: 'test_longTitle',
+ lines: ['line_01', 'line_02', 'line_03', 'line_04'],
+ }
}
- }
+ };
// Publish the notification.
notificationManager.publish(notificationRequest, (err) => {
if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
- return;
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
+ return;
}
- console.info(`[ANS] publish success`);
+ console.info('Succeeded in publishing notification.');
});
```
@@ -132,27 +131,27 @@ The following table describes the APIs for notification publishing. You specify
```ts
let imagePixelMap: PixelMap = undefined; // Obtain the PixelMap information.
let notificationRequest: notificationManager.NotificationRequest = {
- id: 1,
- content: {
- contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
- picture: {
- title: 'test_title',
- text: 'test_text',
- additionalText: 'test_additionalText',
- briefText: 'test_briefText',
- expandedTitle: 'test_expandedTitle',
- picture: imagePixelMap
- }
+ id: 1,
+ content: {
+ contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
+ picture: {
+ title: 'test_title',
+ text: 'test_text',
+ additionalText: 'test_additionalText',
+ briefText: 'test_briefText',
+ expandedTitle: 'test_expandedTitle',
+ picture: imagePixelMap
}
- }
+ }
+ };
// Publish the notification.
notificationManager.publish(notificationRequest, (err) => {
- if (err) {
- console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
- return;
- }
- console.info(`[ANS] publish success.`);
+ if (err) {
+ console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
+ return;
+ }
+ console.info('Succeeded in publishing notification.');
});
```
diff --git a/en/application-dev/quick-start/figures/ci_download.png b/en/application-dev/quick-start/figures/ci_download.png
new file mode 100644
index 0000000000000000000000000000000000000000..da0d306e0f95a4fa114af51ca010d9109ae7e029
Binary files /dev/null and b/en/application-dev/quick-start/figures/ci_download.png differ
diff --git a/en/application-dev/quick-start/figures/compiler.png b/en/application-dev/quick-start/figures/compiler.png
new file mode 100644
index 0000000000000000000000000000000000000000..3854c378fd56761952b0f6443458e4ae663b3bf2
Binary files /dev/null and b/en/application-dev/quick-start/figures/compiler.png differ
diff --git a/en/application-dev/quick-start/figures/sdk-structure.png b/en/application-dev/quick-start/figures/sdk-structure.png
new file mode 100644
index 0000000000000000000000000000000000000000..18a9315151bc7b184a87c2f95b23238bbefc2b82
Binary files /dev/null and b/en/application-dev/quick-start/figures/sdk-structure.png differ
diff --git a/en/application-dev/quick-start/howto-migrate-cmake-with-ohosndk.md b/en/application-dev/quick-start/howto-migrate-cmake-with-ohosndk.md
new file mode 100644
index 0000000000000000000000000000000000000000..ae328b3e52b577be0fd9fcefd58b0e215e3d7ca4
--- /dev/null
+++ b/en/application-dev/quick-start/howto-migrate-cmake-with-ohosndk.md
@@ -0,0 +1,173 @@
+# Using Native APIs (NDK) of the OHOS SDK in a CMake Project
+
+## What Is Native API
+For details, see [Native APIs](https://gitee.com/openharmony/docs/blob/master/en/application-dev/napi/Readme-EN.md).
+
+## Downloading the NDK
+
+You download the Native API Development Kit (NDK) by downloading the OHOS SDK, where the NDK is included. To download the OHOS SDK, use any of the following modes:
+
+- (Recommended) Acquire source code from mirrors for an officially released version. For details, see [release notes](https://gitee.com/openharmony/docs/tree/master/en/release-notes#/openharmony/docs/blob/master/en/release-notes/OpenHarmony-v3.2-release.md).
+- Download the SDK from the SDK Manager in DevEco Studio.
+- Download the SDK from the [daily build](http://ci.openharmony.cn/dailys/dailybuilds), by clicking the download link to the ohos-sdk component.
+ 
+
+## Decompressing the NDK
+
+Place the downloaded NDK in a folder you prefer and decompress it. Below shows the directory structure after decompression.
+
+
+Configure the Linux environment as follows: (Skip this step if the NDK is downloaded from DevEco Studio.)
+
+1. Add the CMake tool that comes with the NDK to the environment variables.
+
+```
+ # Open the .bashrc file.
+ vim ~/.bashrc
+ # Append the custom CMake path to the file. Save the file and exit.
+ export PATH=~/ohos-sdk/ohos-sdk/linux/native/build-tools/cmake/bin:$PATH
+ # Run the source ~/.bashrc command to make the environment variables take effect.
+ source ~/.bashrc
+```
+
+2. Check the default CMake path.
+
+```
+ # Run the which cmake command.
+ which cmake
+ # The result should be the same as the custom path previously appended to the file.
+ ~/ohos-sdk/ohos-sdk/linux/native/build-tools/cmake/bin/cmake
+```
+
+
+## Using the NDK to Compile a Native Program
+
+You can use the NDK to quickly develop a native program, including native dynamic libraries, static libraries, and executable files. The ArkUI application framework can call the native dynamic libraries through the NAPI framework. The following exemplifies how to use the NDK to compile a C/C++ dynamic library in a C/C++ demo project.
+
+
+### Folders in the NDK
+#### build Folder: ohos.toolchain.cmake file
+The **ohos.toolchain.cmake** file contains the attributes of the CMake compilation target. Its path must be specified in the **CMAKE_TOOLCHAIN_FILE** parameter so that it can be located during CMake compilation. For details about the mandatory parameters in the **ohos.toolchain.cmake** file, see [Key Parameters in ohos.toolchain.cmake](#key-parameters-in-ohostoolchaincmake).
+
+
+#### build-tools folder: Build Tool Provided by the NDK
+```
+ # Run the following command to view the CMake version:
+ cmake -version
+ # Result
+ cmake version 3.16.5
+
+ CMake suite maintained and supported by Kitware (kitware.com/cmake).
+```
+#### llvm Folder: Compiler Provided by the NDK
+
+
+### Demo Project for the NDK
+#### Demo Project Directory
+ demo
+ ├── CMakeLists.txt
+ ├── include
+ └── sum.h
+ └── src
+ ├── CMakeLists.txt
+ ├── sum.cpp
+ └── hello.cpp
+
+#### CMakeLists.txt in the demo Directory
+```
+ # Specify the minimum CMake version.
+ CMAKE_MINIMUM_REQUIRED(VERSION 3.16)
+
+ # Set the project name, which is HELLO in this example.
+ PROJECT(HELLO)
+
+ # Add a subdirectory and build the subdirectory.
+ ADD_SUBDIRECTORY(src bin)
+```
+
+#### CMakeLists.txt in the src Directory
+```
+ SET(LIBHELLO_SRC hello.cpp)
+
+ # Set compilation flags.
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0")
+
+ # Set the link parameter. The value below is only for exemplary purposes.
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--emit-relocs --verbose")
+
+ # Add a libsum dynamic library target. If the compilation is successful, a libsum.so file is generated.
+ ADD_LIBRARY(sum SHARED sum.cpp)
+
+ # Add the executable target called Hello. If the compilation is successful, a Hello executable is generated.
+ ADD_EXECUTABLE(Hello ${LIBHELLO_SRC})
+
+ # Specify the path to the include directory of the Hello target.
+ TARGET_INCLUDE_DIRECTORIES(Hello PUBLIC ../include)
+
+ # Specify the name of the library to be linked to the Hello target.
+ TARGET_LINK_LIBRARIES(Hello PUBLIC sum)
+```
+
+For details about CMake, see [CMake Tutorial](https://cmake.org/cmake/help/v3.16/guide/tutorial/).
+
+#### Source Code
+**hello.cpp** source code:
+
+```
+ #include
+ #include "sum.h"
+
+ int main(int argc,const char **argv)
+ {
+ std::cout<< "hello world!" <
+
+ int sum(int a, int b)
+ {
+ return a + b;
+ }
+```
+
+
+### Key Parameters in ohos.toolchain.cmake
+| Parameter | Type|Description|
+|--------|------|------|
+|OHOS_STL|c++\_shared/c++\_static|STL to use. The value must be consistent across the native libraries in the same application.
**c++\_shared** (default): The shared library of libc++, libc++\_shared.so, is used.
**c++\static**: The static library of libc++, libc++\_static.a, is used.|
+|OHOS_ARCH|armeabi-v7a/arm64-v8a/x86_64|ABI to support. Currently, three types of ABI are supported.|
+|OHOS_PLATFORM|OHOS|Target platform. Currently, only OHOS is supported.|
+|CMAKE_TOOLCHAIN_FILE|Toolchain file|CMake toolchain file, that is, the aforementioned **ohos.toolchain.cmake** file.|
+
+### Building from Command Line
+In the project directory, create the **build** directory to store the intermediate files generated during CMake building.
+
+> **NOTE**
+>
+> In the following commands, **ohos-sdk** is the root directory of the downloaded SDK. Replace it with the actual directory.
+
+1. Use **OHOS_STL=c++_shared** for dynamic compilation.
+```
+ >mkdir build && cd build
+ >cmake -DOHOS_STL=c++_shared -DOHOS_ARCH=armeabi-v7a -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE={ohos-sdk}/linux/native/build/cmake/ohos.toolchain.cmake ..
+ >cmake --build .
+```
+
+2. Use **OHOS_STL=c++_static** for static compilation.
+```
+ >mkdir build && cd build
+ >cmake -DOHOS_STL=c++_static -DOHOS_ARCH=armeabi-v7a -DOHOS_PLATFORM=OHOS -DCMAKE_TOOLCHAIN_FILE={ohos-sdk}/linux/native/build/cmake/ohos.toolchain.cmake ..
+ >cmake --build .
+```
+
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index b942d5aa2a56cfc90c0496074d2ca7dda6d96b6f..f9a6af9e1de4ac19c1623914fcd7e6a62c41a3fd 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -120,6 +120,7 @@
- [@ohos.events.emitter (Emitter)](js-apis-emitter.md)
- [@ohos.notificationManager (NotificationManager) (Recommended)](js-apis-notificationManager.md)
- [@ohos.notificationSubscribe (NotificationSubscribe) (Recommended)](js-apis-notificationSubscribe.md)
+ - [@ohos.application.StaticSubscriberExtensionContext (NotificationSubscribe) (Recommended)](js-apis-application-StaticSubscriberExtensionContext.md)
- [System Common Events (To Be Deprecated Soon)](commonEvent-definitions.md)
- [@ohos.commonEvent (Common Event) (To Be Deprecated Soon)](js-apis-commonEvent.md)
- [@ohos.notification (Notification) (To Be Deprecated Soon)](js-apis-notification.md)
@@ -137,6 +138,10 @@
- [NotificationFlags](js-apis-inner-notification-notificationFlags.md)
- [NotificationRequest](js-apis-inner-notification-notificationRequest.md)
- [NotificationSlot](js-apis-inner-notification-notificationSlot.md)
+ - [NotificationSorting](js-apis-inner-notification-notificationSorting.md)
+ - [NotificationSortingMap](js-apis-inner-notification-notificationSortingMap.md)
+ - [NotificationSubscribeInfo](js-apis-inner-notification-notificationSubscribeInfo.md)
+ - [NotificationSubscriber](js-apis-inner-notification-notificationSubscriber.md)
- [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md)
- [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md)
- Common Events
@@ -320,7 +325,7 @@
- [@ohos.systemTimer (System Timer)](js-apis-system-timer.md)
- [@ohos.wallpaper (Wallpaper)](js-apis-wallpaper.md)
- [@ohos.web.webview (Webview)](js-apis-webview.md)
- - [console (Log)](js-apis-logs.md)
+ - [Console](js-apis-logs.md)
- [Timer](js-apis-timer.md)
- application
- [AccessibilityExtensionContext (Accessibility Extension Context)](js-apis-inner-application-accessibilityExtensionContext.md)
@@ -330,6 +335,7 @@
- [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md)
- [@ohos.brightness (Screen Brightness)](js-apis-brightness.md)
- [@ohos.charger (Charging Type)](js-apis-charger.md)
+ - [@ohos.cooperate (Screen Hopping)](js-apis-devicestatus-cooperate.md)
- [@ohos.deviceInfo (Device Information)](js-apis-device-info.md)
- [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md)
@@ -344,6 +350,7 @@
- [@ohos.multimodalInput.mouseEvent (Mouse Event)](js-apis-mouseevent.md)
- [@ohos.multimodalInput.pointer (Mouse Pointer)](js-apis-pointer.md)
- [@ohos.multimodalInput.touchEvent (Touch Event)](js-apis-touchevent.md)
+ - [@ohos.multimodalInput.shortKey (Shortcut Key)](js-apis-shortKey.md)
- [@ohos.power (System Power Management)](js-apis-power.md)
- [@ohos.runningLock (Runninglock)](js-apis-runninglock.md)
- [@ohos.sensor (Sensor)](js-apis-sensor.md)
@@ -365,6 +372,7 @@
- [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md)
- [@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)
diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md
index c116f901789c4a0fd1898d28bb7e8fd69a1b38fc..db930ccbe8cc14f368b9e16d29b556074e981482 100644
--- a/en/application-dev/reference/apis/js-apis-Bundle.md
+++ b/en/application-dev/reference/apis/js-apis-Bundle.md
@@ -904,7 +904,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
> This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead.
-getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback>) : void;
+getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback\\>): void;
Obtains the information about all applications of the current user. This API uses an asynchronous callback to return the result.
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
index 7ea0a7024970cffde1434f76ce911cce28dbcd2e..95d4b1e408a255be8f9830ecc0594640211a26e1 100644
--- a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md
@@ -25,7 +25,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
onAddForm(want: Want): formBindingData.FormBindingData
-Called to notify the widget provider that a **Form** instance (widget) has been created.
+Called to notify the widget provider that a **Form** instance (widget) is being created.
**System capability**: SystemCapability.Ability.Form
@@ -49,7 +49,7 @@ import formBindingData from '@ohos.app.form.formBindingData';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onAddForm(want) {
- console.log('FormExtensionAbility onAddForm, want: ${want.abilityName}');
+ console.log(`FormExtensionAbility onAddForm, want: ${want.abilityName}`);
let dataObj1 = {
temperature: '11c',
'time': '11:00'
@@ -64,7 +64,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onCastToNormalForm(formId: string): void
-Called to notify the widget provider that a temporary widget has been converted to a normal one.
+Called to notify the widget provider that a temporary widget is being converted to a normal one.
**System capability**: SystemCapability.Ability.Form
@@ -81,7 +81,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onCastToNormalForm(formId) {
- console.log('FormExtensionAbility onCastToNormalForm, formId: ${formId}');
+ console.log(`FormExtensionAbility onCastToNormalForm, formId: ${formId}`);
}
};
```
@@ -90,7 +90,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onUpdateForm(formId: string): void
-Called to notify the widget provider that a widget has been updated. After obtaining the latest data, your application should call [updateForm](js-apis-app-form-formProvider.md#updateform) of **formProvider** to update the widget data.
+Called to notify the widget provider that a widget is being updated. After obtaining the latest data, your application should call [updateForm](js-apis-app-form-formProvider.md#updateform) of **formProvider** to update the widget data.
**System capability**: SystemCapability.Ability.Form
@@ -109,15 +109,15 @@ import formProvider from '@ohos.app.form.formProvider';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onUpdateForm(formId) {
- console.log('FormExtensionAbility onUpdateForm, formId: ${formId}');
+ console.log(`FormExtensionAbility onUpdateForm, formId: ${formId}`);
let obj2 = formBindingData.createFormBindingData({
temperature: '22c',
time: '22:00'
});
formProvider.updateForm(formId, obj2).then((data) => {
- console.log('FormExtensionAbility context updateForm, data: ${data}');
+ console.log(`FormExtensionAbility context updateForm, data: ${data}`);
}).catch((error) => {
- console.error('Operation updateForm failed. Cause: ${error}');
+ console.error(`Operation updateForm failed. Cause: ${error}`);
});
}
};
@@ -127,7 +127,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onChangeFormVisibility(newStatus: { [key: string]: number }): void
-Called to notify the widget provider of the change of visibility.
+Called to notify the widget provider that the widget visibility status is being changed.
**System capability**: SystemCapability.Ability.Form
@@ -146,18 +146,18 @@ import formProvider from '@ohos.app.form.formProvider';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onChangeFormVisibility(newStatus) {
- console.log('FormExtensionAbility onChangeFormVisibility, newStatus: ${newStatus}');
+ console.log(`FormExtensionAbility onChangeFormVisibility, newStatus: ${newStatus}`);
let obj2 = formBindingData.createFormBindingData({
temperature: '22c',
time: '22:00'
});
for (let key in newStatus) {
- console.log('FormExtensionAbility onChangeFormVisibility, key: ${key}, value= ${newStatus[key]}');
+ console.log(`FormExtensionAbility onChangeFormVisibility, key: ${key}, value= ${newStatus[key]}`);
formProvider.updateForm(key, obj2).then((data) => {
- console.log('FormExtensionAbility context updateForm, data: ${data}');
+ console.log(`FormExtensionAbility context updateForm, data: ${data}`);
}).catch((error) => {
- console.error('Operation updateForm failed. Cause: ${error}');
+ console.error(`Operation updateForm failed. Cause: ${error}`);
});
}
}
@@ -168,7 +168,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onFormEvent(formId: string, message: string): void
-Called to instruct the widget provider to receive and process the widget event.
+Called to instruct the widget provider to process the widget event.
**System capability**: SystemCapability.Ability.Form
@@ -186,7 +186,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onFormEvent(formId, message) {
- console.log('FormExtensionAbility onFormEvent, formId: ${formId}, message: ${message}');
+ console.log(`FormExtensionAbility onFormEvent, formId: ${formId}, message: ${message}`);
}
};
```
@@ -195,7 +195,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onRemoveForm(formId: string): void
-Called to notify the widget provider that a **Form** instance (widget) has been destroyed.
+Called to notify the widget provider that a **Form** instance (widget) is being destroyed.
**System capability**: SystemCapability.Ability.Form
@@ -212,7 +212,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onRemoveForm(formId) {
- console.log('FormExtensionAbility onRemoveForm, formId: ${formId}');
+ console.log(`FormExtensionAbility onRemoveForm, formId: ${formId}`);
}
};
```
@@ -221,7 +221,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onConfigurationUpdate(newConfig: Configuration): void;
-Called when the configuration of the environment where the ability is running is updated.
+Called when the configuration of the environment where the FormExtensionAbility is running is updated.
**System capability**: SystemCapability.Ability.Form
@@ -238,7 +238,7 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onConfigurationUpdate(config) {
- console.log('onConfigurationUpdate, config: ${JSON.stringify(config)}');
+ console.log(`onConfigurationUpdate, config: ${JSON.stringify(config)}`);
}
};
```
@@ -247,7 +247,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onAcquireFormState?(want: Want): formInfo.FormState;
-Called when the widget provider receives the status query result of a widget. By default, the initial state is returned.
+Called to notify the widget provider that the widget host is requesting the widget state. By default, the initial state is returned.
**System capability**: SystemCapability.Ability.Form
@@ -265,7 +265,7 @@ import formInfo from '@ohos.app.form.formInfo';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onAcquireFormState(want) {
- console.log('FormExtensionAbility onAcquireFormState, want: ${want}');
+ console.log(`FormExtensionAbility onAcquireFormState, want: ${want}`);
return formInfo.FormState.UNKNOWN;
}
};
@@ -275,7 +275,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility {
onShareForm?(formId: string): { [key: string]: Object }
-Called by the widget provider to receive shared widget data.
+Called to notify the widget provider that the widget host is sharing the widget data.
**System API**: This is a system API.
@@ -300,7 +300,46 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
export default class MyFormExtensionAbility extends FormExtensionAbility {
onShareForm(formId) {
- console.log('FormExtensionAbility onShareForm, formId: ${formId}');
+ console.log(`FormExtensionAbility onShareForm, formId: ${formId}`);
+ let wantParams = {
+ 'temperature': '20',
+ 'time': '2022-8-8 09:59',
+ };
+ return wantParams;
+ }
+};
+```
+
+## onAcquireFormData10+
+
+onAcquireFormData?(formId: string): { [key: string]: Object }
+
+Called to notify the widget provider that the widget host is requesting the custom data.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| formId | string | Yes | Widget ID.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------------ | ----------------------------------------------------------- |
+| {[key: string]: any} | Custom data of the widget, in the form of key-value pairs.|
+
+**Example**
+
+```ts
+import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
+
+export default class MyFormExtensionAbility extends FormExtensionAbility {
+ onAcquireFormData(formId) {
+ console.log('FormExtensionAbility onAcquireFormData, formId: ${formId}');
let wantParams = {
'temperature': '20',
'time': '2022-8-8 09:59',
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formHost.md b/en/application-dev/reference/apis/js-apis-app-form-formHost.md
index 0afda1db43c8830ffbf9eeb63cceae0c07a62f2c..d81c78c439f21e0ce60ff3df6e33c3d949ee980a 100644
--- a/en/application-dev/reference/apis/js-apis-app-form-formHost.md
+++ b/en/application-dev/reference/apis/js-apis-app-form-formHost.md
@@ -2222,7 +2222,7 @@ try {
## getRunningFormInfosByFilter10+
-function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter): Promise<Array<formInfo.RunningFormInfo>>
Obtains the information about widget hosts based on the widget provider information. This API uses a promise to return the result.
@@ -2273,7 +2273,7 @@ try {
## getRunningFormInfosByFilter10+
-function getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.FormInfo>>): void
+getRunningFormInfosByFilter(formProviderFilter: formInfo.FormProviderFilter, callback: AsyncCallback<Array<formInfo.FormInfo>>): void
Obtains the information about widget hosts based on the widget provider information. This API uses an asynchronous callback to return the result.
@@ -2321,7 +2321,7 @@ try {
## getRunningFormInfoById10+
-function getRunningFormInfoById(formId: string): Promise<Array<formInfo.RunningFormInfo>>
+getRunningFormInfoById(formId: string): Promise<Array<formInfo.RunningFormInfo>>
Obtains the information about widget hosts based on the widget ID. This API uses a promise to return the result.
@@ -2366,7 +2366,7 @@ try {
## getRunningFormInfoById10+
-function getRunningFormInfoById(formId: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void
+getRunningFormInfoById(formId: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void
Obtains the information about widget hosts based on the widget ID. This API uses an asynchronous callback to return the result.
diff --git a/en/application-dev/reference/apis/js-apis-application-StaticSubscriberExtensionContext.md b/en/application-dev/reference/apis/js-apis-application-StaticSubscriberExtensionContext.md
new file mode 100644
index 0000000000000000000000000000000000000000..f1c7c82e6af9bdeacc971596d47b217c72f1ddc9
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-application-StaticSubscriberExtensionContext.md
@@ -0,0 +1,161 @@
+# @ohos.application.StaticSubscriberExtensionContext (StaticSubscriberExtensionContext)
+
+The **StaticSubscriberExtensionContext** module, inherited from **ExtensionContext**, provides context for StaticSubscriberExtensionAbilities.
+
+You can use the APIs of this module to start StaticSubscriberExtensionAbilities.
+
+> **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 used only in the stage model.
+
+## Usage
+
+Before using the **StaticSubscriberExtensionContext** module, you must first obtain a **StaticSubscriberExtensionAbility** instance.
+
+```ts
+import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'
+
+export default class MyStaticSubscriberExtensionAbility extends StaticSubscriberExtensionAbility {
+ context = this.context;
+};
+```
+
+## StaticSubscriberExtensionContext.startAbility
+
+startAbility(want: Want, callback: AsyncCallback<void>): void;
+
+Starts an ability that belongs to the same application as this StaticSubscriberExtensionAbility. This API uses an asynchronous callback to return the result.
+
+Observe the following when using this API:
+ - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
+ - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------- | ---- | -------------------------- |
+| want | [Want](js-apis-application-want.md) | Yes | Want information about the target ability. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000011 | The context does not exist. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+| 16300003 | The target application is not self application. |
+
+**Example**
+
+ ```ts
+ let want = {
+ bundleName: "com.example.myapp",
+ abilityName: "MyAbility"
+ };
+
+ try {
+ this.context.startAbility(want, (error) => {
+ if (error) {
+ // Process service logic errors.
+ console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) +
+ ' error.message: ' + JSON.stringify(error.message));
+ return;
+ }
+ // Carry out normal service processing.
+ console.log('startAbility succeed');
+ });
+ } catch (paramError) {
+ // Process input parameter errors.
+ console.log('startAbility failed, error.code: ' + JSON.stringify(paramError.code) +
+ ' error.message: ' + JSON.stringify(paramError.message));
+ }
+ ```
+
+## StaticSubscriberExtensionContext.startAbility
+
+startAbility(want: Want): Promise<void>;
+
+Starts an ability that belongs to the same application as this StaticSubscriberExtensionAbility. This API uses a promise to return the result.
+
+Observe the following when using this API:
+ - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission.
+ - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ----------------------------------- | ---- | ----------------------- |
+| want | [Want](js-apis-application-want.md) | Yes | Want information about the target ability.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md).
+
+| ID| Error Message |
+| -------- | ------------------------------------------------------------ |
+| 16000001 | The specified ability does not exist. |
+| 16000002 | Incorrect ability type. |
+| 16000004 | Can not start invisible component. |
+| 16000005 | The specified process does not have the permission. |
+| 16000006 | Cross-user operations are not allowed. |
+| 16000008 | The crowdtesting application expires. |
+| 16000009 | An ability cannot be started or stopped in Wukong mode. |
+| 16000011 | The context does not exist. |
+| 16000050 | Internal error. |
+| 16000053 | The ability is not on the top of the UI. |
+| 16000055 | Installation-free timed out. |
+| 16200001 | The caller has been released. |
+| 16300003 | The target application is not self application. |
+
+**Example**
+
+ ```ts
+ let want = {
+ bundleName: "com.example.myapp",
+ abilityName: "MyAbility"
+ };
+
+ try {
+ this.context.startAbility(want)
+ .then(() => {
+ // Carry out normal service processing.
+ console.log('startAbility succeed');
+ })
+ .catch((error) => {
+ // Process service logic errors.
+ console.log('startAbility failed, error.code: ' + JSON.stringify(error.code) +
+ ' error.message: ' + JSON.stringify(error.message));
+ });
+ } catch (paramError) {
+ // Process input parameter errors.
+ console.log('startAbility failed, error.code: ' + JSON.stringify(paramError.code) +
+ ' error.message: ' + JSON.stringify(paramError.message));
+ }
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
index 096433a60c44904bbe9b2f25d09e9384e192c7fb..c28c4372ba1cf10ad9c67669913de1b4ac06ae17 100644
--- a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
@@ -13,6 +13,14 @@ The **StaticSubscriberExtensionAbility** module provides Extension abilities for
import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility';
```
+## Attributes
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+| Name | Type | Readable| Writable| Description |
+| ------- | ------------------------------------------------------------ | ---- | ---- | -------- |
+| context | [StaticSubscriberExtensionContext](js-apis-application-StaticSubscriberExtensionContext.md) | Yes | No | Context.|
+
## StaticSubscriberExtensionAbility.onReceiveEvent
onReceiveEvent(event: CommonEventData): void;
@@ -30,7 +38,6 @@ Callback of the common event of a static subscriber.
| event | [CommonEventData](js-apis-commonEventManager.md#commoneventdata) | Yes| Common event of a static subscriber.|
**Example**
-
```ts
class MyStaticSubscriberExtensionAbility extends StaticSubscriberExtensionAbility {
onReceiveEvent(event) {
diff --git a/en/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md b/en/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md
index 340a54ba1b1e5950cdced1971050c42590208f74..f8bbe2212f0b6b9ae41183bfce2ae7c03a726d99 100644
--- a/en/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md
+++ b/en/application-dev/reference/apis/js-apis-arkui-componentSnapshot.md
@@ -1,6 +1,6 @@
# @ohos.arkui.componentSnapshot (Component Snapshot)
-The **componentSnapshot** module provides APIs for obtaining component snapshots, including snapshots of components that have been loaded and snapshots of components that have not been loaded yet.
+The **componentSnapshot** module provides APIs for obtaining component snapshots, including snapshots of components that have been loaded and snapshots of components that have not been loaded yet. Note that a component snapshot does not contain content drawn outside of the area of the owning component or the parent component.
> **NOTE**
>
@@ -8,6 +8,7 @@ The **componentSnapshot** module provides APIs for obtaining component snapshots
>
> You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer.
+
## Modules to Import
```js
@@ -20,14 +21,18 @@ get(id: string, callback: AsyncCallback): void
Obtains the snapshot of a component that has been loaded. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> The snapshot captures content rendered in the last frame. If this API is called when the component triggers an update, the re-rendered content will not be included in the obtained snapshot.
+
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------------------- | ---- | ------------------------------------------------------------------------------ |
-| id | string | Yes | [ID](../arkui-ts/ts-universal-attributes-component-id.md) of the target component.|
-| callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------------------- | ---- | ---------------------------------------- |
+| id | string | Yes | [ID](../arkui-ts/ts-universal-attributes-component-id.md) of the target component.|
+| callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return the result. |
**Example**
@@ -45,8 +50,8 @@ struct SnapshotExample {
Image(this.pixmap)
.width(300).height(300)
// ...Component
- // ...Components
- // ...Components
+ // ...Component
+ // ...Component
Button("click to generate UI snapshot")
.onClick(() => {
componentSnapshot.get("root", (error: Error, pixmap: image.PixelMap) => {
@@ -71,25 +76,29 @@ get(id: string): Promise
Obtains the snapshot of a component that has been loaded. This API uses a promise to return the result.
+> **NOTE**
+>
+> The snapshot captures content rendered in the last frame. If this API is called when the component triggers an update, the re-rendered content will not be included in the obtained snapshot.
+
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
-| Name | Type | Mandatory| Description |
-| ------- | ------------------------------------------------------- | ---- | -------------------- |
-| id | string | Yes | [ID](../arkui-ts/ts-universal-attributes-component-id.md) of the target component.|
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ---------------------------------------- |
+| id | string | Yes | [ID](../arkui-ts/ts-universal-attributes-component-id.md) of the target component.|
**Return value**
-| Type | Description |
-| ----------------------------- | -------------- |
+| Type | Description |
+| ----------------------------- | -------- |
| Promise<image.PixelMap> | Promise used to return the result.|
**Error codes**
-| ID| Error Message |
-| -------- | ------------------- |
-| 100001 | if id is not valid. |
+| ID | Error Message |
+| ------ | ------------------- |
+| 100001 | if id is not valid. |
**Example**
@@ -134,14 +143,21 @@ createFromBuilder(builder: CustomBuilder, callback: AsyncCallback **NOTE**
+>
+> To account for the time spent in awaiting component building and rendering, the callback of offscreen snapshots has a delay of less than 500 ms.
+>
+> If a component is on a time-consuming task, for example, an **\** or **\** component that is loading online images, its loading may be still in progress when this API is called. In this case, the output snapshot does not represent the component in the way it looks when the loading is successfully completed.
+
+
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------------------- | ---- | -------------------- |
-| builder | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) | Yes | Builder of the custom component.|
-| callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ---------- |
+| builder | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) | Yes | Builder of the custom component.|
+| callback | AsyncCallback<image.PixelMap> | Yes | Callback used to return the result.|
**Example**
@@ -194,25 +210,31 @@ createFromBuilder(builder: CustomBuilder): Promise
Renders a custom component in the application background and outputs its snapshot. This API uses a promise to return the result.
+> **NOTE**
+>
+> To account for the time spent in awaiting component building and rendering, the callback of offscreen snapshots has a delay of less than 500 ms.
+>
+> If a component is on a time-consuming task, for example, an **\** or **\** component that is loading online images, its loading may be still in progress when this API is called. In this case, the output snapshot does not represent the component in the way it looks when the loading is successfully completed.
+
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
-| Name | Type | Mandatory| Description |
-| ------- | ------------------------------------------------------- | ---- | -------------------- |
-| builder | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) | Yes | Builder of the custom component.|
+| Name | Type | Mandatory | Description |
+| ------- | ---------------------------------------- | ---- | ---------- |
+| builder | [CustomBuilder](../arkui-ts/ts-types.md#custombuilder8) | Yes | Builder of the custom component.|
**Return value**
-| Type | Description |
-| ----------------------------- | -------------- |
+| Type | Description |
+| ----------------------------- | -------- |
| Promise<image.PixelMap> | Promise used to return the result.|
**Error codes**
-| ID| Error Message |
-| -------- | ----------------------------------------- |
-| 100001 | if builder is not a valid build function. |
+| ID | Error Message |
+| ------ | ---------------------------------------- |
+| 100001 | if builder is not a valid build function. |
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md
index 7962d8ae77ab77dc1bba0d72b4418d3da2f867a2..a4d1dab714b0b5f632b020d0b57d6c788b48d8b7 100644
--- a/en/application-dev/reference/apis/js-apis-bundleManager.md
+++ b/en/application-dev/reference/apis/js-apis-bundleManager.md
@@ -113,6 +113,7 @@ Enumerates the types of Extension abilities.
| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.|
| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.|
| PRINT10+ | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
+| PUSH10+ | 17 | **PushExtensionAbility**: provides APIs for pushing scenario-specific messages. This ability is reserved.|
| DRIVER10+ | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index 1f90664de26360d3099d9f0870baabaad1063b23..a488a313beff34555f589b57bdea17ddbdbcc752 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -2057,7 +2057,7 @@ promise.then(data => {
setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\\): void
-Sets the call waiting switch. This API uses an asynchronous callback to return the result.
+Specifies whether to enable the call waiting service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
@@ -2099,7 +2099,7 @@ call.setCallWaiting(0, true, (err) => {
setCallWaiting\(slotId: number, activate: boolean\): Promise\
-Sets the call waiting switch. This API uses a promise to return the result.
+Specifies whether to enable the call waiting service. This API uses a promise to return the result.
**System API**: This is a system API.
@@ -2719,6 +2719,91 @@ call.off('mmiCodeResult', data => {
});
```
+
+## call.on('audioDeviceChange')10+
+
+on\(type: 'audioDeviceChange', callback: Callback\\): void
+
+Subscribes to audio device change events. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------------------- | ---- | --------------------------------------------------- |
+| type | string | Yes | Audio device change. This field has a fixed value of **audioDeviceChange**.|
+| callback | Callback<[AudioDeviceInfo](#audiodeviceinfo10)> | Yes | Callback used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+call.on('audioDeviceChange', data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.off('audioDeviceChange')10+
+
+off\(type: 'audioDeviceChange', callback?: Callback\\): void
+
+Unsubscribes from **audioDeviceChange** events. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------------------------- | ---- | --------------------------------------------------- |
+| type | string | Yes | Audio device change. This field has a fixed value of **audioDeviceChange**.|
+| callback | Callback<[AudioDeviceInfo](#audiodeviceinfo10)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+call.off('audioDeviceChange', data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
+});
+```
+
+
## call.isNewCallAllowed8+
isNewCallAllowed\(callback: AsyncCallback\\): void
@@ -3804,7 +3889,7 @@ call.updateImsCallMode(1, 1).then(() => {
enableImsSwitch\(slotId: number, callback: AsyncCallback\\): void
-Enables the IMS switch. This API uses an asynchronous callback to return the result.
+Enables the IMS service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
@@ -3845,7 +3930,7 @@ call.enableImsSwitch(0, (err) => {
enableImsSwitch\(slotId: number\): Promise\
-Enables the IMS switch. This API uses a promise to return the result.
+Enables the IMS service. This API uses a promise to return the result.
**System API**: This is a system API.
@@ -3893,7 +3978,7 @@ call.enableImsSwitch(0).then(() => {
disableImsSwitch\(slotId: number, callback: AsyncCallback\\): void
-Disables the IMS switch. This API uses an asynchronous callback to return the result.
+Disables the IMS service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
@@ -3934,7 +4019,7 @@ call.disableImsSwitch(0, (err) => {
disableImsSwitch\(slotId: number\): Promise\
-Disables the IMS switch. This API uses a promise to return the result.
+Disables the IMS service. This API uses a promise to return the result.
**System API**: This is a system API.
@@ -3982,7 +4067,7 @@ call.disableImsSwitch(0).then(() => {
isImsSwitchEnabled\(slotId: number, callback: AsyncCallback\\): void
-Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result.
+Checks whether the IMS service is enabled. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
@@ -4020,7 +4105,7 @@ call.isImsSwitchEnabled(0, (err, data) => {
isImsSwitchEnabled\(slotId: number\): Promise\
-Checks whether the IMS switch is enabled. This API uses a promise to return the result.
+Checks whether the IMS service is enabled. This API uses a promise to return the result.
**System API**: This is a system API.
@@ -4062,6 +4147,472 @@ promise.then(data => {
});
```
+
+## call.closeUnfinishedUssd10+
+
+closeUnfinishedUssd\(slotId: number, callback: AsyncCallback\\): void
+
+Cancels the unfinished USSD services. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------- | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+call.closeUnfinishedUssd(slotId, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.closeUnfinishedUssd10+
+
+closeUnfinishedUssd\(slotId: number\): Promise\
+
+Cancels the unfinished USSD services. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+call.closeUnfinishedUssd(slotId).then(() => {
+ console.log(`closeUnfinishedUssd success.`);
+}).catch((err) => {
+ console.error(`closeUnfinishedUssd fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+
+## call.setVoNRState10+
+
+setVoNRState\(slotId: number, state: VoNRState, callback: AsyncCallback\\): void
+
+Sets the status of the VoNR switch. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ----------------------------- | ---- | ---------------------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| state | [VoNRState](#vonrstate10) | Yes | Status of the VoNR switch. |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result. The value **true** indicates that the operation is successful, and value **false** indicates the opposite.|
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+let state = 1;
+call.setVoNRState(slotId, state, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.setVoNRState10+
+
+setVoNRState\(slotId: number, state: VoNRState\): Promise\
+
+Sets the status of the VoNR switch. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.SET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ----------------------------- | ---- | ------------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| state | [VoNRState](#vonrstate10) | Yes | Status of the VoNR switch. |
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | --------------------------------------------- |
+| Promise<boolean> | Promise used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+let state = 1;
+call.setVoNRState(slotId, state).then(() => {
+ console.log(`setVoNRState success, promise: data->${JSON.stringify(data)}`);
+}).catch((err) => {
+ console.error(`setVoNRState fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+
+## call.getVoNRState10+
+
+getVoNRState\(slotId: number, callback: AsyncCallback\\): void
+
+Obtains the status of the VoNR switch. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | --------------------------------------------- | ---- | ------------------------------------------------------ |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| callback | AsyncCallback<[VoNRState](#vonrstate10)>| Yes | Callback used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+call.getVoNRState(slotId, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.getVoNRState10+
+
+getVoNRState\(slotId: number\): Promise\
+
+Obtains the status of the VoNR switch. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ----------------------------- | ---- | ------------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+
+**Return value**
+
+| Type | Description |
+| ---------------------------------------- | ------------------------------------------- |
+| Promise<[VoNRState](#vonrstate10)> | Promise used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+let promise = call.getVoNRState(slotId);
+promise.then(data => {
+ console.log(`getVoNRState success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getVoNRState fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+
+## call.canSetCallTransferTime10+
+
+canSetCallTransferTime\(slotId: number, callback: AsyncCallback\\): void
+
+Checks whether the call forwarding time can be set. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ----------------------------- | ---- | ----------------------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result. The value **true** indicates that the call forwarding time can be set, and the value **false** indicates the opposite.|
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+call.canSetCallTransferTime(slotId, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
+
+
+## call.canSetCallTransferTime10+
+
+canSetCallTransferTime\(slotId: number\): Promise\
+
+Checks whether the call forwarding time can be set. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permission**: ohos.permission.GET_TELEPHONY_STATE
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ----------------------------- | ---- | ------------------------------------------- |
+| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 |
+
+**Return value**
+
+| Type | Description |
+| ---------------------- | --------------------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+| 8300999 | Unknown error code. |
+
+**Example**
+
+```js
+let slotId = 0;
+call.canSetCallTransferTime(slotId).then(() => {
+ console.log(`canSetCallTransferTime success, promise: data->${JSON.stringify(data)}`);
+}).catch((err) => {
+ console.error(`canSetCallTransferTime fail, promise: err->${JSON.stringify(err)}`);
+});
+```
+
+
+## call.inputDialerSpecialCode10+
+
+inputDialerSpecialCode\(inputCode: string, callback: AsyncCallback\\): void
+
+Performs a secret code broadcast. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required Permissions**: ohos.permission.PLACE_CALL
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ---------------------------- | ---- | ----------------------------------------- |
+| inputCode | string | Yes | Secret code, for example, **2846579** (project menu).|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+
+**Example**
+
+```js
+call.inputDialerSpecialCode('2846579', (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
+});
+```
+
+## call.inputDialerSpecialCode10+
+
+inputDialerSpecialCode\(inputCode: string\): Promise\
+
+Performs a secret code broadcast. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required Permissions**: ohos.permission.PLACE_CALL
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | ---------------------------- | ---- | ----------------------------------------- |
+| inputCode | string | Yes | Secret code, for example, **2846579** (project menu).|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | --------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Error codes**
+
+For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Non-system applications use system APIs. |
+| 401 | Parameter error. |
+| 8300001 | Invalid parameter value. |
+| 8300002 | Operation failed. Cannot connect to service. |
+| 8300003 | System internal error. |
+
+**Example**
+
+```js
+try {
+ call.inputDialerSpecialCode('2846579');
+ console.log(`inputDialerSpecialCode success`);
+} catch (error) {
+ console.log(`inputDialerSpecialCode fail, promise: err->${JSON.stringify(error)}`);
+}
+```
+
+
## DialOptions
Provides an option for determining whether a call is a video call.
@@ -4071,23 +4622,25 @@ Provides an option for determining whether a call is a video call.
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- |
| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call |
-| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
|
-| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. |
-| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. |
-| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. |
+| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. |
+| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
+| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
+| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
## DialCallOptions9+
Defines options for initiating a call.
+**System API**: This is a system API.
+
**System capability**: SystemCapability.Telephony.CallManager
-| Name | Type | Mandatory| Description |
-| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| accountId 9+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API.|
-| videoState 9+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
-| dialScene 9+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
-| dialType 9+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
+| Name | Type | Mandatory| Description |
+| ------------------------ | ---------------------------------- | ---- | ------------------------------------------- |
+| accountId 9+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
|
+| videoState 9+ | [VideoStateType](#videostatetype7) | No | Video state type. |
+| dialScene 9+ | [DialScene](#dialscene8) | No | Dialup scenario. |
+| dialType 9+ | [DialType](#dialtype8) | No | Dialup type. |
## CallState
@@ -4138,6 +4691,19 @@ Enumerates IMS call modes.
| CALL_MODE_SEND_RECEIVE | 3 | Sending and receiving calls.|
| CALL_MODE_VIDEO_PAUSED | 4 | Pausing video calls. |
+## VoNRState10+
+
+Enumerates VoNR switch states.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| ---------------------- | ---- | ----------------- |
+| VONR_STATE_OFF | 0 | Disabled. |
+| VONR_STATE_ON | 1 | Enabled. |
+
## AudioDevice8+
Enumerates audio devices.
@@ -4154,6 +4720,36 @@ Enumerates audio devices.
| DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. |
| DEVICE_MIC | 4 | Microphone device|
+## AudioDeviceType10+
+
+Enumerates audio device types.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Value | Description |
+| -------------------- | ---- | ----------- |
+| DEVICE_EARPIECE | 0 | Headset device. |
+| DEVICE_SPEAKER | 1 | Speaker device. |
+| DEVICE_WIRED_HEADSET | 2 | Wired headset device.|
+| DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. |
+
+## AudioDeviceInfo10+
+
+Defines the audio device information.
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
+| Name | Type | Mandatory | Description |
+| --------------------------------- | ------------------------------------- | ---- | ---------------- |
+| audioDeviceList 10+ | [Array\](#audiodevice8) | Yes | Audio device list. |
+| currentAudioDevice 10+ | [AudioDevice](#audiodevice8) | Yes | Audio device type. |
+| isMuted 10+ | boolean | Yes | Whether the audio device is muted. |
+
+
## CallRestrictionType8+
Enumerates call restriction types.
@@ -4511,7 +5107,7 @@ Enumerates call disconnection causes.
| BEARER_SERVICE_NOT_IMPLEMENTED9+ | 65 | Bearer service not implemented. |
| ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE9+ | 68 | ACM greater than or equal to the maximum value. |
| REQUESTED_FACILITY_NOT_IMPLEMENTED9+ | 69 | Requested facility not implemented. |
-| ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE9+ | 70 | Only restricted digital information capability available. |
+| ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE9+ | 70 | Only restricted digital information bearer capability available. |
| SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED9+ | 79 | Service or option not implemented, unspecified. |
| INVALID_TRANSACTION_IDENTIFIER_VALUE9+ | 81 | Invalid transaction identifier value. |
| USER_NOT_MEMBER_OF_CUG9+ | 87 | User not member of CUG. |
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 106aa2ecdcea58b97966a46e1f4ea38bcb2432eb..b8d4e4b54a0d34826962b8d3d66b5e7f1b30be13 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -550,7 +550,7 @@ Listens for camera status changes. This API uses an asynchronous callback to ret
**Example**
```js
-cameraManager.on('cameraStatus', (cameraStatusInfo) => {
+cameraManager.on('cameraStatus', (err, cameraStatusInfo) => {
console.log(`camera : ${cameraStatusInfo.camera.cameraId}`);
console.log(`status: ${cameraStatusInfo.status}`);
})
@@ -1679,7 +1679,7 @@ The coordinate system is based on the horizontal device direction with the devic
| Name | Type | Mandatory| Description |
| ------------- | -------------------------------| ---- | ------------------- |
-| exposurePoint | [Point](#point) | Yes | Exposure point. |
+| exposurePoint | [Point](#point) | Yes | Metering point. The value range of x and y must be within [0,1]. If a value less than 0 is passed, the value **0** is used. If a value greater than **1** is passed, the value **1** is used. |
**Return value**
@@ -1754,7 +1754,7 @@ Before the setting, you are advised to use **[getExposureBiasRange](#getexposure
| Name | Type | Mandatory| Description |
| -------- | -------------------------------| ---- | ------------------- |
-| exposureBias | number | Yes | Exposure bias to set, which must be within the range obtained by running **getExposureBiasRange** interface. If the API call fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+| exposureBias | number | Yes | EV. The supported EV range can be obtained by calling **getExposureBiasRange**. If calling the API fails, an error code defined in [CameraErrorCode](#cameraerrorcode) will be returned. If the value passed is not within the supported range, the nearest critical point is used.|
**Error codes**
@@ -1936,7 +1936,7 @@ The coordinate system is based on the horizontal device direction with the devic
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------- |
-| Point1 | [Point](#point) | Yes | Focal point. |
+| Point1 | [Point](#point) | Yes | Focal point. The value range of x and y must be within [0,1]. If a value less than 0 is passed, the value **0** is used. If a value greater than **1** is passed, the value **1** is used. |
**Return value**
@@ -2075,7 +2075,7 @@ Sets a zoom ratio, with a maximum precision of two decimal places.
| Name | Type | Mandatory| Description |
| --------- | -------------------- | ---- | ------------------- |
-| zoomRatio | number | Yes | Zoom ratio. You can use **getZoomRatioRange** to obtain the supported values.|
+| zoomRatio | number | Yes | Zoom ratio. The supported zoom ratio range can be obtained by calling **getZoomRatioRange**. If the value passed is not within the supported range, the nearest critical point is used.|
**Return value**
@@ -2735,7 +2735,7 @@ Captures a photo with the specified shooting parameters. This API uses a promise
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------- | ---- | -------- |
-| setting | [PhotoCaptureSetting](#photocapturesetting) | No | Shooting settings.|
+| setting | [PhotoCaptureSetting](#photocapturesetting) | No | Shooting parameters. The input of **undefined** is processed as if no parameters were passed.|
**Return value**
diff --git a/en/application-dev/reference/apis/js-apis-enterprise-applicationManager.md b/en/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
new file mode 100644
index 0000000000000000000000000000000000000000..0f9d2852f88f7e6b729326e62fc3886422d63eb2
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
@@ -0,0 +1,434 @@
+# @ohos.enterprise.applicationManager (Application Management)
+
+The **applicationManager** module provides application management capabilities, including adding applications to or removing applications from an application blocklist, and obtaining the application blocklist. The application blocklist contains the applications that are forbidden to run. Only the enterprise device administrator applications can call the APIs provided by this module.
+
+> **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.
+
+## Modules to Import
+
+```js
+import applicationManager from '@ohos.enterprise.applicationManager';
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void;
+
+Adds applications to the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the administrator user.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to add. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void;
+
+Adds applications to the application list for a user using the specified device administrator application. This API uses an asynchronous callback to return the result. The applications added to the blocklist cannot run under the user specified by **userId**.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to add. |
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.addDisallowedRunningBundles
+
+addDisallowedRunningBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>;
+
+Adds applications to the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the added applications cannot run under the specified user. If **userId** is not passed in, the added applications cannot run under the current user.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to add. |
+| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ------------------------- |
+| Promise<void> | Promise that returns no value. An error object is thrown when the applications fail to be added. |
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void;
+
+Removes applications from the application blocklist using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the current user.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to remove. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void;
+
+Removes applications from the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result. If an application blocklist exists, the applications in the blocklist cannot run under the user specified by **userId**.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to remove. |
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.removeDisallowedRunningBundles
+
+removeDisallowedRunningBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>;
+
+Removes applications from the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called to remove applications from the blocklist, the applications in the blocklist cannot run under the specified user. If **userId** is not passed in, the applications in the blocklist cannot run under the current user.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| appIds | Array<string> | Yes | IDs of the applications to remove. |
+| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ------------------------- |
+| Promise<void> | Promise that returns no value. An error object is thrown when the applications fail to be removed. |
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+let appIds = ["com.example.myapplication"];
+
+applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, callback: AsyncCallback<Array<string>>): void;
+
+Obtains the application blocklist of the administrator user using the specified device administrator application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_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<Array<string>> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+
+applicationManager.getDisallowedRunningBundles(wantTemp, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback<Array<string>>): void;
+
+Obtains the application blocklist of a user using the specified device administrator application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. |
+| userId | number | Yes | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
+
+**Error codes**
+
+For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
+
+| ID| Error Message |
+| ------- | ---------------------------------------------------------------------------- |
+| 9200001 | the application is not an administrator of the device. |
+| 9200002 | the administrator application does not have permission to manage the device. |
+
+**Example**
+
+```js
+let wantTemp = {
+ bundleName: "com.example.myapplication",
+ abilityName: "EntryAbility",
+};
+
+applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
+ if (error != null) {
+ console.log("error code:" + error.code + " error message:" + error.message);
+ }
+});
+```
+
+## applicationManager.getDisallowedRunningBundles
+
+getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<string>>;
+
+Obtains the application blocklist using the specified device administrator application. This API uses a promise to return the result. If **userId** is passed in when this API is called, the device administrator application obtains the application blocklist of the specified user. If **userId** is not passed in, the device administrator application obtains the application blocklist of the current user.
+
+**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.|
+| userId | number | No | User ID. The default value is the user ID of the caller. The user ID must be greater than or equal to **0**.|
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ------------------------- |
+| Promise<Array<string>> | Promise used to return the application blocklist of the administrator user.|
+
+**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",
+};
+applicationManager.getDisallowedRunningBundles(wantTemp, 100).then(() => {
+ console.log("success");
+}).catch(error => {
+ console.log("error code:" + error.code + " error message:" + error.message);
+});
+```
diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md
index db85444d68f958ed8af462815a2865ddc02adc0f..fe9a116b82379a17518731accb378484eb71dfc2 100644
--- a/en/application-dev/reference/apis/js-apis-i18n.md
+++ b/en/application-dev/reference/apis/js-apis-i18n.md
@@ -46,7 +46,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -85,7 +85,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -116,7 +116,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -153,7 +153,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -191,7 +191,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -222,7 +222,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -257,7 +257,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -288,7 +288,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -323,7 +323,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -354,7 +354,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -389,7 +389,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -420,7 +420,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -455,7 +455,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -492,7 +492,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -530,7 +530,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -563,7 +563,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -594,7 +594,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -625,7 +625,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```js
@@ -660,7 +660,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```ts
@@ -691,7 +691,7 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| ID | Error Message |
| ------ | ---------------------- |
-| 890001 | Unspported para value. |
+| 890001 | param value not valid |
**Example**
```ts
@@ -1737,6 +1737,35 @@ Obtains the **TimeZone** object corresponding to the specified time zone city ID
let timezone = I18n.TimeZone.getTimezoneFromCity("Shanghai");
```
+### getTimezonesByLocation10+
+
+static getTimezonesByLocation(longitude: number, latitude: number): Array<TimeZone>
+
+Creates an array of **TimeZone** objects corresponding to the specified longitude and latitude.
+
+**System capability**: SystemCapability.Global.I18n
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| --------- | ------ | ---- | ------ |
+| longitude | number | Yes | Longitude. The value ranges from **-180** to **179.9**. A positive value is used for east longitude and a negative value is used for west longitude.|
+| latitude | number | Yes | Latitude. The value ranges from **-90** to **89.9**. A positive value is used for north latitude and a negative value is used for south latitude.|
+
+**Return value**
+
+| Type | Description |
+| -------- | ----------- |
+| Array<[TimeZone](#timezone)> | Array of **TimeZone** objects.|
+
+**Example**
+ ```js
+ let timezoneArray = I18n.TimeZone.getTimezonesByLocation(-118.1, 34.0);
+ for (var i = 0; i < timezoneArray.length; i++) {
+ let tzId = timezoneArray[i].getID();
+ }
+ ```
+
## Transliterator9+
diff --git a/en/application-dev/reference/apis/js-apis-image.md b/en/application-dev/reference/apis/js-apis-image.md
index 9c6037df7f907354d71a6eacb211855b579945a5..34337fa9198edeeeab9d437bc084538777834d31 100644
--- a/en/application-dev/reference/apis/js-apis-image.md
+++ b/en/application-dev/reference/apis/js-apis-image.md
@@ -879,6 +879,53 @@ async function Demo() {
}
```
+### getColorSpace10+
+
+getColorSpace(): colorSpaceManager.ColorSpaceManager
+
+Obtains the color space of this image
+
+**System capability**: SystemCapability.Multimedia.Image.Core
+
+**Return value**
+
+| Type | Description |
+| ----------------------------------- | ---------------- |
+| [colorSpaceManager.ColorSpaceManager](js-apis-colorSpaceManager.md#colorspacemanager) | Color space obtained.|
+
+**Example**
+
+```js
+import colorSpaceManager from '@ohos.graphics.colorSpaceManager';
+async function Demo() {
+ let csm = pixelmap.getColorSpace();
+}
+```
+
+### setColorSpace10+
+
+setColorSpace(colorSpace: colorSpaceManager.ColorSpaceManager): void
+
+Sets the color space for this image.
+
+**System capability**: SystemCapability.Multimedia.Image.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ----------------------------------- | ---- | --------------- |
+| colorSpace | [colorSpaceManager.ColorSpaceManager](js-apis-colorSpaceManager.md#colorspacemanager) | Yes | Color space to set.|
+
+**Example**
+
+```js
+import colorSpaceManager from '@ohos.graphics.colorSpaceManager';
+async function Demo() {
+ var csm = colorSpaceManager.create(colorSpaceName);
+ pixelmap.setColorSpace(csm);
+}
+```
+
### release7+
release():Promise\
@@ -937,7 +984,7 @@ Creates an **ImageSource** instance based on the URI.
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------- |
-| uri | string | Yes | Image path. Currently, only the application sandbox path is supported.
Currently, the following formats are supported: JPG, PNG, GIF, BMP, Webp, and RAW.|
+| uri | string | Yes | Image path. Currently, only the application sandbox path is supported.
Currently, the following formats are supported: .jpg, .png, .gif, .bmp, .webp, and raw. For details, see [SVG Tags10+](#svg-tags). |
**Return value**
@@ -975,7 +1022,7 @@ Creates an **ImageSource** instance based on the URI.
| Name | Type | Mandatory| Description |
| ------- | ------------------------------- | ---- | ----------------------------------- |
-| uri | string | Yes | Image path. Currently, only the application sandbox path is supported.
Currently, the following formats are supported: JPG, PNG, GIF, BMP, Webp, and RAW.|
+| uri | string | Yes | Image path. Currently, only the application sandbox path is supported.
Currently, the following formats are supported: .jpg, .png, .gif, .bmp, .webp, and raw. For details, see [SVG Tags10+](#svg-tags). |
| options | [SourceOptions](#sourceoptions9) | Yes | Image properties, including the image index and default property value.|
**Return value**
@@ -1553,10 +1600,10 @@ let decodeOpts = {
editable: true,
desiredSize: { width: 198, height: 202 },
rotate: 0,
- desiredPixelFormat: RGBA_8888,
+ desiredPixelFormat: 3,
index: 0,
};
-let pixelmaplist = await imageSourceApi.createPixelMapList(decodeOpts);
+let pixelmaplist = imageSourceApi.createPixelMapList(decodeOpts);
```
### createPixelMapList10+
@@ -1604,7 +1651,7 @@ let decodeOpts = {
editable: true,
desiredSize: { width: 198, height: 202 },
rotate: 0,
- desiredPixelFormat: RGBA_8888,
+ desiredPixelFormat: 3,
index: 0,
};
imageSourceApi.createPixelMap(decodeOpts, pixelmaplist => {
@@ -1651,12 +1698,12 @@ Obtains an array of delay times. This API uses a promise to return the result.
**Example**
```js
-let delayTimes = await imageSourceApi.getDelayTime();
+let delayTimes = imageSourceApi.getDelayTime();
```
### getFrameCount10+
-getFrameCount(callback: AsyncCallback): void;
+getFrameCount(callback: AsyncCallback\): void;
Obtains the number of frames. This API uses an asynchronous callback to return the result.
@@ -1693,7 +1740,7 @@ Obtains the number of frames. This API uses a promise to return the result.
**Example**
```js
-let frameCount = await imageSourceApi.getFrameCount();
+let frameCount = imageSourceApi.getFrameCount();
```
### release
@@ -2787,7 +2834,50 @@ Describes the color components of an image.
| pixelStride | number | Yes | No | Pixel stride. |
| byteBuffer | ArrayBuffer | Yes | No | Component buffer.|
-## ResponseCode
+## Supplementary Information
+### SVG Tags
+
+The SVG tags are supported since API verison 10. The used version is (SVG) 1.1. Currently, the following tags are supported:
+- a
+- circla
+- clipPath
+- defs
+- ellipse
+- feBlend
+- feColorMatrix
+- feComposite
+- feDiffuseLighting
+- feDisplacementMap
+- feDistantLight
+- feFlood
+- feGaussianBlur
+- feImage
+- feMorphology
+- feOffset
+- fePointLight
+- feSpecularLighting
+- feSpotLight
+- feTurbulence
+- filter
+- g
+- image
+- line
+- linearGradient
+- mask
+- path
+- pattern
+- polygon
+- polyline
+- radialGradient
+- rect
+- stop
+- svg
+- text
+- textPath
+- tspan
+- use
+
+### ResponseCode
Enumerates the response codes returned upon build errors.
diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md
index cec10d9eef5fbd50d9d81ca6a5358d57d78fdbf0..99131363c58faef8abe196d0e20e01b176a1258e 100644
--- a/en/application-dev/reference/apis/js-apis-intl.md
+++ b/en/application-dev/reference/apis/js-apis-intl.md
@@ -1,7 +1,6 @@
# @ohos.intl (Internationalization)
-The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402.
-
+ The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402.
The [i18n](js-apis-i18n.md) module provides enhanced i18n capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the intl module to provide a complete suite of i18n capabilities.
> **NOTE**
@@ -68,7 +67,7 @@ Creates a **Locale** object.
| Name | Type | Mandatory | Description |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string | Yes | A string containing locale information, including the language, optional script, and region. For details about the international standards and combination modes for the language, script, and country or region, see [intl Development](../../internationalization/intl-guidelines.md#setting-locale-information).|
-| options9+ | [LocaleOptions](#localeoptions9) | No | Options for creating the **Locale** object. |
+| options | [LocaleOptions](#localeoptions6) | No | Options for creating the **Locale** object. |
**Example**
```js
@@ -160,9 +159,10 @@ Minimizes information of the **Locale** object. If the script and locale informa
```
-## LocaleOptions9+
+## LocaleOptions6+
Represents the locale options.
+In API version 9, the attributes in **LocaleOptions** are optional.
**System capability**: SystemCapability.Global.I18n
@@ -207,7 +207,7 @@ Creates a **DateTimeOptions** object for the specified locale.
| Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
-| options9+ | [DateTimeOptions](#datetimeoptions9) | No | Options for creating a **DateTimeFormat** object. |
+| options | [DateTimeOptions](#datetimeoptions6) | No | Options for creating a **DateTimeFormat** object. |
**Example**
```js
@@ -299,7 +299,7 @@ Obtains the formatting options for **DateTimeFormat** object.
| Type | Description |
| ------------------------------------ | ----------------------------- |
-| [DateTimeOptions](#datetimeoptions9) | Formatting options for **DateTimeFormat** objects.|
+| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.|
**Example**
```js
@@ -311,9 +311,10 @@ Obtains the formatting options for **DateTimeFormat** object.
```
-## DateTimeOptions9+
+## DateTimeOptions6+
Provides the options for the **DateTimeFormat** object.
+In API version 9, the attributes in **DateTimeOptions** are optional.
**System capability**: SystemCapability.Global.I18n
@@ -371,7 +372,7 @@ Creates a **NumberFormat** object for the specified locale.
| Name | Type | Mandatory | Description |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
-| options9+ | [NumberOptions](#numberoptions9) | No | Options for creating a **NumberFormat** object. |
+| options | [NumberOptions](#numberoptions6) | No | Options for creating a **NumberFormat** object. |
**Example**
```js
@@ -421,7 +422,7 @@ Obtains the options of the **NumberFormat** object.
| Type | Description |
| -------------------------------- | --------------------------- |
-| [NumberOptions](#numberoptions9) | Formatting options for **NumberFormat** objects.|
+| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.|
**Example**
@@ -434,9 +435,10 @@ Obtains the options of the **NumberFormat** object.
```
-## NumberOptions9+
+## NumberOptions6+
Defines the device capability.
+In API version 9, the attributes in **NumberOptions** are optional.
**System capability**: SystemCapability.Global.I18n
@@ -448,7 +450,7 @@ Defines the device capability.
| currencyDisplay | string | Yes | Yes | Currency display mode. The value can be **symbol**, **narrowSymbol**, **code**, or **name**.|
| unit | string | Yes | Yes | Unit name, for example, **meter**, **inch**, or **hectare**. |
| unitDisplay | string | Yes | Yes | Unit display format. The value can be **long**, **short**, or **narrow**.|
-| unitUsage | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.|
+| unitUsage8+ | string | Yes | Yes | Unit usage scenario. The value can be any of the following: **default**, **area-land-agricult**, **area-land-commercl**, **area-land-residntl**, **length-person**, **length-person-small**, **length-rainfall**, **length-road**, **length-road-small**, **length-snowfall**, **length-vehicle**, **length-visiblty**, **length-visiblty-small**, **length-person-informal**, **length-person-small-informal**, **length-road-informal**, **speed-road-travel**, **speed-wind**, **temperature-person**, **temperature-weather**, **volume-vehicle-fuel**.|
| signDisplay | string | Yes | Yes | Number sign display format. The value can be **auto**, **never**, **always**, or **expectZero**.|
| compactDisplay | string | Yes | Yes | Compact display format. The value can be **long** or **short**. |
| notation | string | Yes | Yes | Number formatting specification. The value can be **standard**, **scientific**, **engineering**, or **compact**.|
@@ -494,7 +496,7 @@ Creates a **Collator** object.
| Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
-| options9+ | [CollatorOptions](#collatoroptions9) | No | Options for creating a **Collator** object. |
+| options | [CollatorOptions](#collatoroptions8) | No | Options for creating a **Collator** object. |
**Example**
```js
@@ -545,7 +547,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
| Type | Description |
| ------------------------------------ | ----------------- |
-| [CollatorOptions](#collatoroptions9) | Properties of the **Collator** object.|
+| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.|
**Example**
```js
@@ -557,9 +559,10 @@ Returns properties reflecting the locale and collation options of a **Collator**
```
-## CollatorOptions9+
+## CollatorOptions8+
Represents the properties of a **Collator** object.
+In API version 9, the attributes in **CollatorOptions** are optional.
**System capability**: SystemCapability.Global.I18n
@@ -605,7 +608,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers.
| Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
-| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | No | Options for creating a **PluralRules** object. |
+| options | [PluralRulesOptions](#pluralrulesoptions8) | No | Options for creating a **PluralRules** object. |
**Example**
```js
@@ -648,9 +651,10 @@ Obtains a string that represents the singular-plural type of the specified numbe
```
-## PluralRulesOptions9+
+## PluralRulesOptions8+
Represents the properties of a **PluralRules** object.
+In API version 9, the attributes in **PluralRulesOptions** are optional.
**System capability**: SystemCapability.Global.I18n
@@ -696,7 +700,7 @@ Creates a **RelativeTimeFormat** object.
| Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.|
-| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | No | Options for creating a **RelativeTimeFormat** object. |
+| options | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No | Options for creating a **RelativeTimeFormat** object. |
**Example**
```js
@@ -788,9 +792,10 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
```
-## RelativeTimeFormatInputOptions9+
+## RelativeTimeFormatInputOptions8+
Represents the properties of a **RelativeTimeFormat** object.
+In API version 9, the attributes in **RelativeTimeFormatInputOptions** are optional.
**System capability**: SystemCapability.Global.I18n
diff --git a/en/application-dev/reference/apis/js-apis-loglibrary.md b/en/application-dev/reference/apis/js-apis-loglibrary.md
new file mode 100644
index 0000000000000000000000000000000000000000..cbb849eab6fca14001bdd9f648fb2ce60cd8e2f1
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-loglibrary.md
@@ -0,0 +1,319 @@
+# @ohos.logLibrary (Log Library)
+
+The **logLibrary** module provides APIs for obtaining various system maintenance and test logs.
+
+> **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 are system APIs.
+
+## Modules to Import
+
+```js
+import logLibrary from '@ohos.logLibrary';
+```
+
+## LogEntry
+
+Defines a **LogEntry** object.
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| name | string | Yes| No| Log file name. |
+| mtime | number | Yes| No | Time of the last modification to the file. The value is the number of seconds elapsed since 00:00:00 on January 1, 1970.|
+| size | number | Yes| No | File size, in bytes.|
+
+## logLibrary.list
+
+list(logType: string): LogEntry[]
+
+Obtains the list of log files of the specified type in synchronous mode. This API accepts objects of the string type as input parameters and returns a list log files of the specified type.
+
+**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
+| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------------------------------------------ |
+| LogEntry[] | Array of log file objects.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| ------- | ----------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ let logObj = logLibrary.list('HILOG');
+ // do something here.
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
+
+## logLibrary.copy
+
+copy(logType: string, logName: string, dest: string): Promise<void>
+
+Copies log files of the specified type to the target application directory. This API uses a promise to return the result.
+
+**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description|
+| --------- | ----------------------- | ---- | --------------- |
+| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+| logName | string | Yes | Log file name.|
+| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.
If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------------------------------------------ |
+| Promise<void> | Promise used to return the result. Depending on whether the operation is successful, you can use the **then()** or **catch()** method to process the callback.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+| 21300001 | Source file does not exists. |
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ logLibrary.copy('HILOG', 'hiapplogcat-1.zip', ''
+ ).then(
+ (val) => {
+ // do something here.
+ }
+ ).catch(
+ (err) => {
+ // do something here.
+ }
+ )
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
+
+## logLibrary.copy
+
+copy(logType: string, logName: string, dest: string, callback: AsyncCallback<void>): void
+
+Copies log files of the specified type to the target application directory. This API uses an asynchronous callback to return the result.
+
+**Required permission**: ohos.permission.READ_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
+| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+| logName | string | Yes | Log file name.|
+| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.
If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
+| callback | AsyncCallback<void> | Yes| Callback used to process the received return value. The value **0** indicates that the operation is successful, and any other value indicates that the operation has failed.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| ------- | ----------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+| 21300001 | Source file does not exists. |
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ logLibrary.copy('HILOG', 'hiapplogcat-1.zip', 'dir1', (error, val) => {
+ if (val === undefined) {
+ // copy failed.
+ } else {
+ // copy success.
+ }
+ });
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
+
+## logLibrary.move
+
+move(logType: string, logName: string, dest: string): Promise<void>
+
+Moves log files of the specified type to the target application directory. This API uses a promise to return the result.
+
+**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description|
+| --------- | ----------------------- | ---- | --------------- |
+| logType | string | Yes| Log type, for example, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+| logName | string | Yes | Log file name.|
+| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.
If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
+
+**Return value**
+
+| Type | Description |
+| ------------------- | ------------------------------------------------------------ |
+| Promise<void> | Promise used to return the result. Depending on whether the operation is successful, you can use the **then()** or **catch()** method to process the callback.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| -------- | ---------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+| 21300001 | Source file does not exists. |
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ logLibrary.move('FAULTLOG', 'fault_log_test.zip', ''
+ ).then(
+ (val) => {
+ // do something here.
+ }
+ ).catch(
+ (err) => {
+ // do something here.
+ }
+ )
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
+
+## logLibrary.move
+
+move(logType: string, logName: string, dest: string, callback: AsyncCallback<void>): void
+
+Moves log files of the specified type to the target application directory. This API uses an asynchronous callback to return the result.
+
+**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
+| logType | string | Yes| Log type, for example, **HILOG**, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+| logName | string | Yes | Log file name.|
+| dest | string | Yes | Target directory. Enter the relative path of the directory. If this parameter is specified, log files will be saved to the **hiview/dest** folder in the application cache path, that is, **../cache/hiview/dest**. You can enter a multi-level directory.
If you leave this parameter empty, log files will be saved to the root directory, that is, the **hiview** folder in the application cache path.|
+| callback | AsyncCallback<void> | Yes| Callback used to process the received return value. The value **0** indicates that the operation is successful, and any other value indicates that the operation has failed.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| ------- | ----------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+| 21300001 | Source file does not exists. |
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ logLibrary.move('FAULTLOG', 'fault_log_test.zip', 'dir1/dir2', (error, val) => {
+ if (val === undefined) {
+ // move failed.
+ } else {
+ // move success.
+ }
+ });
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
+
+## logLibrary.remove
+
+remove(logType: string, logName: string): void
+
+Deletes log files of the specified type in synchronous mode.
+
+**Required permission**: ohos.permission.WRITE_HIVIEW_SYSTEM
+
+**System capability**: SystemCapability.HiviewDFX.Hiview.LogLibrary
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------- | ------------------------- | ---- | ------------------------------------------------------------ |
+| logType | string | Yes| Log type, for example, **FAULTLOG**, **BETACLUB**, or **REMOTELOG**.|
+| logName | string | Yes | Log file name.|
+
+**Error codes**
+
+For details about error codes, see [Log Library Error Codes](../errorcodes/errorcode-loglibrary.md).
+
+| ID| Error Message|
+| ------- | ----------------------------------------------------------------- |
+| 201 | Permission denied. |
+| 202 | Permission denied, non-system app called system api. |
+| 401 | Invalid argument.|
+| 21300001 | Source file does not exists. |
+
+**Example**
+
+```js
+import logLibrary from '@ohos.logLibrary';
+
+try {
+ logLibrary.remove('FAULTLOG', 'fault_log_test.zip');
+} catch (error) {
+ console.error(`error code: ${error.code}, error msg: ${error.message}`);
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-logs.md b/en/application-dev/reference/apis/js-apis-logs.md
index b2d837bae04d378938b355d535971cf6d56e48c5..fa73f169b26bec6240b6205c2970af08f5def1f8 100644
--- a/en/application-dev/reference/apis/js-apis-logs.md
+++ b/en/application-dev/reference/apis/js-apis-logs.md
@@ -1,8 +1,6 @@
-# console (Log Printing)
+# Console
-The **console** module provides basic log printing capabilities and supports log printing by log level.
-
-If you want to use more advanced log printing services, for example, filtering logs by the specified ID, you are advised to use [`@ohos.hilog`](js-apis-hilog.md).
+The **console** module provides a simple debugging console, which is similar to the JavaScript console provided by the browser.
> **NOTE**
>
@@ -10,9 +8,9 @@ If you want to use more advanced log printing services, for example, filtering l
## console.debug
-debug(message: string): void
+debug(message: string, ...arguments: any[]): void
-Prints debug-level logs.
+Prints debugging information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -20,14 +18,25 @@ Prints debug-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| message | string | Yes | Text to print.|
+| message | string | Yes | Text to be printed.|
+| arguments | any | No | Arguments in the message or other information to be printed.|
+**Example**
+```js
+const number = 5;
+console.debug('count: %d', number); // Print the debugging information with arguments in the message replaced.
+// count: 5
+console.debug('count:', number); // Print the message and other information.
+// count: 5
+console.debug('count:'); // Print the message only.
+// count:
+```
## console.log
-log(message: string): void
+log(message: string, ...arguments: any[]): void
-Prints debug-level logs.
+Prints log information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -35,14 +44,25 @@ Prints debug-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| message | string | Yes | Text to print.|
+| message | string | Yes | Text to be printed.|
+| arguments | any | No |Arguments in the message or other information to be printed.|
+**Example**
+```js
+const number = 5;
+console.log('count: %d', number); // Print the log information with arguments in the message replaced.
+// count: 5
+console.log('count:', number); // Print the message and other information.
+// count: 5
+console.log('count:'); // Print the message only.
+// count:
+```
## console.info
-info(message: string): void
+info(message: string, ...arguments: any[]): void
-Prints info-level logs.
+Prints log information in formatted output mode. This API is the alias of **console.log ()**.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -50,14 +70,25 @@ Prints info-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| message | string | Yes | Text to print.|
+| message | string | Yes | Text to be printed.|
+| arguments | any | No | Arguments in the message or other information to be printed.|
+**Example**
+```js
+const number = 5;
+console.info('count: %d', number); // Print the log information with arguments in the message replaced.
+// count: 5
+console.info('count:', number); // Print the message and other information.
+// count: 5
+console.info('count:'); // Print the message only.
+// count:
+```
## console.warn
-warn(message: string): void
+warn(message: string, ...arguments: any[]): void
-Prints warn-level logs.
+Prints warning information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -65,14 +96,25 @@ Prints warn-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| message | string | Yes | Text to print.|
+| message | string | Yes | Warning information to be printed.|
+| arguments | any | No | Arguments in the message or other information to be printed.|
+**Example**
+```js
+const str = "name should be string";
+console.warn('warn: %d', str); // Print the warning information with arguments in the message replaced.
+// warn: name should be string
+console.warn('warn:', str); // Print the message and other information.
+// warn: name should be string
+console.warn('warn:'); // Print the message only.
+// warn:
+```
## console.error
-error(message: string): void
+error(message: string, ...arguments: any[]): void
-Prints error-level logs.
+Prints error information in formatted output mode.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
@@ -80,31 +122,26 @@ Prints error-level logs.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| message | string | Yes | Text to print.|
+| message | string | Yes | Error information to be printed.|
+| arguments | any | No | Arguments in the message or other information to be printed.|
**Example**
-
+```js
+const str = "value is not defined";
+console.error('error: %d', str); // Print the error information with arguments in the message replaced.
+// error: value is not defined
+console.error('error:', str); // Print the message and other information.
+// error: value is not defined
+console.error('error:'); // Print the message only.
+// error:
```
-export default {
- clickConsole(){
- var versionCode = 1;
- console.info('Hello World. The current version code is ' + versionCode);
- console.log(`versionCode: ${versionCode}`);
- / / The following is supported since API version 6: console.log('versionCode:%d.', versionCode);
- }
-}
-```
-
-Switch to the HiLog window at the bottom of HUAWEI DevEco Studio. Specifically, select the current device and process, set the log level to Info, and enter Hello World in the search box. Logs that meet the search criteria are displayed, as shown in the following figure.
-
-
## console.assert10+
assert(value?: Object, ...arguments: Object[]): void
-If **value** is false, the subsequent content will be printed.
+Prints assertion information.
**System capability**: SystemCapability.Utils.Lang
@@ -112,24 +149,26 @@ If **value** is false, the subsequent content will be printed.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| value | Object | No | Value|
-| arguments | Object | No | Prints error messages.|
+| value | Object | No | Result value. If **value** is **false** or left blank, the output starting with "Assertion failed" is printed. If **value** is **true**, no information is printed.|
+| arguments | Object | No | Other information to be printed when **value** is **false**. If this parameter is left blank, other information is not printed.|
**Example**
-```
-console.assert(true, 'does nothing');
+```js
+console.assert(true, 'does nothing'); // Do not print error information as value is true.
+console.assert(2% 1 == 0,'does nothing'); // Do not print error information as value is true.
console.assert(false, 'console %s work', 'didn\'t');
-// Assertion console:ohos didn't work
+// Assertion failed: console didn't work
console.assert();
// Assertion failed
```
+
## console.count10+
count(label?: string): void
-Adds a counter by the specified label name to count the number of times **console.count()** is called. The default value is **default**.
+Maintains an internal counter. When this counter is invoked, its label name and the corresponding call count are printed.
**System capability**: SystemCapability.Utils.Lang
@@ -137,10 +176,11 @@ Adds a counter by the specified label name to count the number of times **consol
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| label | string | No | Counter label name.|
+| label | string | No | Counter label name. The default value is **default**.|
+
**Example**
-```
+```js
console.count()
// default: 1
console.count('default')
@@ -150,7 +190,7 @@ console.count('abc')
console.count('xyz')
// xyz: 1
console.count('abc')
-abc: 2
+// abc: 2
console.count()
// default: 3
```
@@ -159,7 +199,7 @@ console.count()
countReset(label?: string): void
-Resets a counter by the specified label name. The default value is **default**.
+Resets a counter based on the specified label name.
**System capability**: SystemCapability.Utils.Lang
@@ -167,10 +207,10 @@ Resets a counter by the specified label name. The default value is **default**.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| label | string | No | Counter label name.|
+| label | string | No | Counter label name. The default value is **default**.|
**Example**
-```
+```js
console.count('abc');
// abc: 1
console.countReset('abc');
@@ -190,13 +230,24 @@ Prints content of the specified object.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| dir | Object | No | Object whose content needs to be printed.|
+| dir | Object | No | Object whose content needs to be printed. If this parameter is left blank, no information is printed.|
+
+
+**Example**
+```js
+let a = { foo: { bar: { baz: true } }};
+console.dir(a);
+// Object: {"foo":{"bar":{"baz":true}}}
+
+console.dir(); // No information is printed.
+```
+
## console.dirxml10+
dirxml(...arguments: Object[]): void
-Calls **console.log()** and passes the received parameters to it. This API does not produce any content of the XML format.
+Displays an interactive tree of the descendant elements of the specified XML element. This API is implemented by calling **console.log()** internally. It does not produce any XML elements. The usage method is the same as that of **console.log()**.
**System capability**: SystemCapability.Utils.Lang
@@ -204,13 +255,24 @@ Calls **console.log()** and passes the received parameters to it. This API does
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| arguments | Object | No | Information to be printed.|
+| arguments | Object | Yes | Information to be printed.|
+
+**Example**
+```js
+const number = 5;
+console.dirxml('count: %d', number);
+// count: 5
+console.dirxml('count:', number);
+// count: 5
+console.dirxml('count:');
+// count:
+```
## console.group10+
group(...arguments: Object[]): void
-Creates an inline group so that subsequent lines are indented by the value specified by **groupIndentation**.
+Increases the indentation of subsequent lines by two spaces.
If the information to be printed is provided, the information is printed without extra indentation.
**System capability**: SystemCapability.Utils.Lang
@@ -220,11 +282,26 @@ If the information to be printed is provided, the information is printed without
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Information to be printed.|
+
+**Example**
+```js
+console.log("outter");
+// outter
+console.group();
+console.log("level 1");
+// level 1
+console.group("in level1");
+// in level1
+console.log("level 2");
+// level 2
+```
+
+
## console.groupCollapsed10+
groupCollapsed(...arguments: Object[]): void
-Creates a collapsed inline group.
+Creates a new inline group in collapsed mode. The usage and function of this API are the same as those of **console.group()**.
**System capability**: SystemCapability.Utils.Lang
@@ -234,14 +311,42 @@ Creates a collapsed inline group.
| ------- | ------ | ---- | ----------- |
| arguments | Object | No | Information to be printed.|
+
+**Example**
+```js
+console.groupCollapsed("outter");
+// outter
+console.groupCollapsed();
+console.log("level 1");
+// level 1
+console.groupCollapsed("in level1");
+// in level1
+console.log("level 2");
+// level 2
+```
+
## console.groupEnd10+
groupEnd(): void
-Exits an inline group so that subsequent lines are not indented by the value specified by **groupIndentation** .
+Reduces the indentation of subsequent lines by two spaces.
**System capability**: SystemCapability.Utils.Lang
+
+**Example**
+```js
+console.log("outter");
+// outter
+console.group();
+console.log("level 1");
+// level 1
+console.groupEnd();
+console.log("outter");
+// outter
+```
+
+
## console.table10+
table(tableData?: Object): void
@@ -254,10 +359,10 @@ Prints data in a table.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| tableData | Object | No | Data to be printed in a table.|
+| tableData | Object | No | Data to be printed in a table. If this parameter is left blank, no information is printed.|
**Example**
-```
+```js
console.table([1, 2, 3]);
// ┌─────────┬────────┐
// │ (index) │ Values │
@@ -281,7 +386,7 @@ console.table({ a: [1, 2, 3, 4, 5], b: 5, c: { e: 5 } });
time(label?: string): void
-Starts a timer to track the duration of an operation. The default value is **default**. You can use **console.timeEnd()** to disable the timer and print the result.
+Starts a timer to track the duration of an operation. You can use **console.timeEnd()** to close the timer and print the elapsed time (in ms).
**System capability**: SystemCapability.Utils.Lang
@@ -289,13 +394,18 @@ Starts a timer to track the duration of an operation. The default value is **def
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| label | string | No | Timer label.|
+| label | string | No | Timer label. The default value is **default**.|
+
+**Example**
+```js
+console.time('abc');
+```
## console.timeEnd10+
timeEnd(label?: string): void
-Stops the timer started by **console.time()** and prints the result. The default value is **default**.
+Stops the timer started by calling **console.time()** and prints the elapsed time (in ms).
**System capability**: SystemCapability.Utils.Lang
@@ -303,10 +413,10 @@ Stops the timer started by **console.time()** and prints the result. The default
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| label | string | No | Timer label.|
+| label | string | No | Timer label. The default value is **default**.|
**Example**
-```
+```js
console.time('abc');
console.timeEnd('abc');
// abc: 225.438ms
@@ -316,7 +426,7 @@ console.timeEnd('abc');
timeLog(label?: string, ...arguments: Object[]): void
-Prints the elapsed time and other logs for the timer started by **console.time()**.
+Prints the elapsed time and other data parameters for the timer started by **console.time()**.
**System capability**: SystemCapability.Utils.Lang
@@ -324,14 +434,13 @@ Prints the elapsed time and other logs for the timer started by **console.time()
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| label | string | No | Timer label.|
+| label | string | No | Timer label. The default value is **default**.|
| arguments | Object | No | Logs to be printed.|
**Example**
-```
+```js
console.time('timer1');
-const value = aaa (); // Return 17.
-console.timeLog('timer1', value);
+console.timeLog('timer1', 17);
// timer1: 365.227ms 17
console.timeEnd('timer1');
// timer1: 513.22ms
@@ -349,10 +458,14 @@ Creates a stack trace.
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ----------- |
-| arguments | Object | No | Logs to be printed.|
+| arguments | Object | No | Logs to be printed. If this parameter is left blank, only stack information is printed.|
**Example**
-```
+```js
console.trace();
+// Trace:
+// xxxxxxxxxx (current stack information)
console.trace("Show the trace");
+// Trace: Show the trace
+// xxxxxxxxxx (current stack information)
```
diff --git a/en/application-dev/reference/apis/js-apis-net-ethernet.md b/en/application-dev/reference/apis/js-apis-net-ethernet.md
index ec15531de49c13ab4b2c85b0da9eacf37400d195..eca9a04d0e42791e19a3620f6582f3d7284dc6d4 100644
--- a/en/application-dev/reference/apis/js-apis-net-ethernet.md
+++ b/en/application-dev/reference/apis/js-apis-net-ethernet.md
@@ -55,8 +55,7 @@ ethernet.setIfaceConfig("eth0", {
route: "192.168.xx.xxx",
gateway: "192.168.xx.xxx",
netMask: "255.255.255.0",
- dnsServers: "1.1.1.1",
- domain: "2.2.2.2"
+ dnsServers: "1.1.1.1"
}, (error) => {
if (error) {
console.log("setIfaceConfig callback error = " + JSON.stringify(error));
@@ -115,8 +114,7 @@ ethernet.setIfaceConfig("eth0", {
route: "192.168.xx.xxx",
gateway: "192.168.xx.xxx",
netMask: "255.255.255.0",
- dnsServers: "1.1.1.1",
- domain: "2.2.2.2"
+ dnsServers: "1.1.1.1"
}).then(() => {
console.log("setIfaceConfig promise ok ");
}).catch(error => {
@@ -168,7 +166,6 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway));
console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask));
console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers));
- console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain));
}
});
```
@@ -219,7 +216,6 @@ ethernet.getIfaceConfig("eth0").then((data) => {
console.log("getIfaceConfig promise gateway = " + JSON.stringify(data.gateway));
console.log("getIfaceConfig promise netMask = " + JSON.stringify(data.netMask));
console.log("getIfaceConfig promise dnsServers = " + JSON.stringify(data.dnsServers));
- console.log("getIfaceConfig promise domain = " + JSON.stringify(data.domain));
}).catch(error => {
console.log("getIfaceConfig promise error = " + JSON.stringify(error));
});
diff --git a/en/application-dev/reference/apis/js-apis-net-policy.md b/en/application-dev/reference/apis/js-apis-net-policy.md
deleted file mode 100644
index cb5f1624f6a3508d25ee1019525ebac8ea9c5475..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/apis/js-apis-net-policy.md
+++ /dev/null
@@ -1,1555 +0,0 @@
-# @ohos.net.policy (Network Policy Management)
-
-The **policy** module provides APIs for managing network policies, through which you can control and manage the data volume used.
-
-> **NOTE**
->
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-
-## Modules to Import
-
-```js
-import policy from '@ohos.net.policy'
-```
-
-## policy.setBackgroundAllowed
-
-setBackgroundAllowed(isAllowed: boolean, callback: AsyncCallback\): void
-
-Sets a background network policy. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| isAllowed | boolean | Yes | Whether applications running in the background are allowed to use mobile data.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.setBackgroundAllowed(Boolean(Number.parseInt(this.isBoolean)), (error) => {
- console.log(JSON.stringify(error))
-})
-;
-```
-
-## policy.setBackgroundAllowed
-
-setBackgroundAllowed(isAllowed: boolean): Promise\
-
-Sets a background network policy. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| isAllowed | boolean | Yes | Whether applications running in the background are allowed to use mobile data.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Example**
-
-```js
-policy.setBackgroundAllowed(Boolean(Number.parseInt(this.isBoolean))).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.isBackgroundAllowed
-
-isBackgroundAllowed(callback: AsyncCallback\): void
-
-Obtains the background network policy. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **true** is returned, which means that applications running in the background are allowed to use mobile data. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.isBackgroundAllowed((error, data) => {
- this.callBack(error, data);
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-});
-```
-
-## policy.isBackgroundAllowed
-
-isBackgroundAllowed(): Promise\;
-
-Obtains the background network policy. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result. If the operation is successful, **true** is returned, which means that applications running in the background are allowed to use mobile data. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.isBackgroundAllowed().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.setPolicyByUid
-
-setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void
-
-Sets an application-specific network policy. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes | Unique ID of the application.|
-| policy | [NetUidPolicy](#netuidpolicy) | Yes| Application-specific network policy to set.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy)
-}
-policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (error) => {
- this.callBack(error);
-});
-```
-
-## policy.setPolicyByUid
-
-setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\;
-
-Sets an application-specific network policy. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes | Unique ID of the application.|
-| policy | [NetUidPolicy](#netuidpolicy) | Yes| Application-specific network policy to set.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy)
-}
-policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.getPolicyByUid
-
-getPolicyByUid(uid: number, callback: AsyncCallback\): void
-
-Obtains an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| callback | AsyncCallback\<[NetUidPolicy](#netuidpolicy)> | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getPolicyByUid(Number.parseInt(this.firstParam), (error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getPolicyByUid
-
-getPolicyByUid(uid: number): Promise\;
-
-Obtains an application-specific network policy by **uid**. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\<[NetUidPolicy](#netuidpolicy)> | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getPolicyByUid(Number.parseInt(this.firstParam)).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.getUidsByPolicy
-
-getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void
-
-Obtains the UID array of applications configured with a certain application-specific network policy. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| policy | [NetUidPolicy](#netuidpolicy) | Yes| Target application-specific network policy.|
-| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getUidsByPolicy
-
-function getUidsByPolicy(policy: NetUidPolicy): Promise\>;
-
-Obtains the UID array of applications configured with a certain application-specific network policy. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| policy | [NetUidPolicy](#netuidpolicy) | Yes| Target application-specific network policy.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\> | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.getNetQuotaPolicies
-
-getNetQuotaPolicies(callback: AsyncCallback\>): void
-
-Obtains the network quota policies. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| callback | AsyncCallback\> | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getNetQuotaPolicies((error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getNetQuotaPolicies
-
-getNetQuotaPolicies(): Promise\>;
-
-Obtains the network quota policies. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\> | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getNetQuotaPolicies().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-
-```
-
-## policy.setNetQuotaPolicies
-
-setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void
-
-Sets an array of network quota policies. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | Yes| An array of network quota policies to set.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- netType: Number.parseInt(this.netType),
- iccid: this.iccid,
- ident: this.ident,
- periodDuration: this.periodDuration,
- warningBytes: Number.parseInt(this.warningBytes),
- limitBytes: Number.parseInt(this.limitBytes),
- lastWarningRemind: this.lastWarningRemind,
- lastLimitRemind: this.lastLimitRemind,
- metered: Boolean(Number.parseInt(this.metered)),
- limitAction: this.limitAction
-};
-this.netQuotaPolicyList.push(param);
-
-policy.setNetQuotaPolicies(this.netQuotaPolicyList, (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.setNetQuotaPolicies
-
-setNetQuotaPolicies(quotaPolicies: Array\): Promise\;
-
-Sets an array of network quota policies. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | Yes| An array of network quota policies to set.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```js
-let param = {
- netType: Number.parseInt(this.netType),
- iccid: this.iccid,
- ident: this.ident,
- periodDuration: this.periodDuration,
- warningBytes: Number.parseInt(this.warningBytes),
- limitBytes: Number.parseInt(this.limitBytes),
- lastWarningRemind: this.lastWarningRemind,
- lastLimitRemind: this.lastLimitRemind,
- metered: Boolean(Number.parseInt(this.metered)),
- limitAction: this.limitAction
-};
-this.netQuotaPolicyList.push(param);
-
-policy.setNetQuotaPolicies(this.netQuotaPolicyList).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.restoreAllPolicies
-
-restoreAllPolicies(iccid: string, callback: AsyncCallback\): void
-
-Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| iccid | string | Yes| SIM card ID.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-this.firstParam = iccid;
-policy.restoreAllPolicies(this.firstParam, (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.restoreAllPolicies
-
-restoreAllPolicies(iccid: string): Promise\;
-
-Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| iccid | string | Yes| SIM card ID.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-this.firstParam = iccid;
-policy.restoreAllPolicies(this.firstParam).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.isUidNetAllowed
-
-isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void
-
-Checks whether an application is allowed to access metered networks. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isMetered | boolean | Yes| Whether the network is a metered network.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the application is allowed to access metered networks, and **false** means the opposite.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.isUidNetAllowed
-
-isUidNetAllowed(uid: number, isMetered: boolean): Promise\;
-
-Checks whether an application is allowed to access metered networks. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isMetered | boolean | Yes| Whether the network is a metered network.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.isUidNetAllowed
-
-isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void
-
-Checks whether an application is allowed to access the given network. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| iface | string | Yes| Name of the target network.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the application is allowed to access the given network, and **false** means the opposite.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), iface: this.secondParam
-}
-policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam, (error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.isUidNetAllowed
-
-isUidNetAllowed(uid: number, iface: string): Promise\;
-
-Checks whether an application is allowed to access the given network. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| iface | string | Yes| Name of the target network.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), iface: this.secondParam
-}
-policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.setDeviceIdleAllowList
-
-setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void
-
-Sets whether to add an application to the device idle allowlist. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isAllowed | boolean | Yes| Whether to add the application to the allowlist.|
-| callback | callback: AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.setDeviceIdleAllowList
-
-setDeviceIdleAllowList(uid: number, isAllowed: boolean): Promise\;
-
-Sets whether to add an application to the device idle allowlist. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isAllowed | boolean | Yes| Whether to add the application to the allowlist.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.getDeviceIdleAllowList
-
-getDeviceIdleAllowList(callback: AsyncCallback\>): void
-
-Obtains the UID array of applications that are on the device idle allowlist. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| callback | AsyncCallback\> | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getDeviceIdleAllowList((error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getDeviceIdleAllowList
-
-getDeviceIdleAllowList(): Promise\>;
-
-Obtains the UID array of applications that are on the device idle allowlist. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\> | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getDeviceIdleAllowList().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.getBackgroundPolicyByUid
-
-getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void
-
-Obtains the background network policies configured for the given application. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| callback | AsyncCallback\<[NetBackgroundPolicy](#netbackgroundpolicy)> | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-this.firstParam = uid
-policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getBackgroundPolicyByUid
-
-getBackgroundPolicyByUid(uid: number): Promise\;
-
-Obtains the background network policies configured for the given application. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\<[NetBackgroundPolicy](#netbackgroundpolicy)> | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-this.firstParam = uid
-policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.resetPolicies
-
-resetPolicies(iccid: string, callback: AsyncCallback\): void
-
-Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| iccid | string | Yes| SIM card ID.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-this.firstParam = iccid
-policy.resetPolicies(this.firstParam, (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.resetPolicies
-
-resetPolicies(iccid: string): Promise\;
-
-Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| iccid | string | Yes| SIM card ID.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function (error, data) {
-
-})
-this.firstParam = iccid
-policy.resetPolicies(this.firstParam).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.updateRemindPolicy
-
-updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void
-
-Updates a reminder policy. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Yes| Network type.|
-| iccid | string | Yes| SIM card ID.|
-| remindType | [RemindType](#remindtype) | Yes| Reminder type.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType
-}
-policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.updateRemindPolicy
-
-updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType): Promise\;
-
-Updates a reminder policy. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Yes| Network type.|
-| iccid | string | Yes| SIM card ID.|
-| remindType | [RemindType](#remindtype) | Yes| Reminder type.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType
-}
-policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.setPowerSaveAllowList
-
-setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void
-
-Sets whether to add an application to the power-saving allowlist. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isAllowed | boolean | Yes| Whether to add the application to the allowlist.|
-| callback | callback: AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error) => {
- console.log(JSON.stringify(error))
-});
-```
-
-## policy.setPowerSaveAllowList
-
-setPowerSaveAllowList(uid: number, isAllowed: boolean): Promise\;
-
-Sets whether to add an application to the power-saving allowlist. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| uid | number | Yes| Unique ID of the application.|
-| isAllowed | boolean | Yes| Whether to add the application to the allowlist.|
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 2100001 | Invalid parameter value. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-let param = {
- uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean))
-}
-policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error) {
- console.log(JSON.stringify(error))
-})
-```
-
-## policy.getPowerSaveAllowList
-
-getPowerSaveAllowList(callback: AsyncCallback\>): void
-
-Obtains the UID array of applications that are on the power-saving allowlist. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | --------------------------------------- | ---- | ---------- |
-| callback | AsyncCallback\> | Yes | Callback used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getPowerSaveAllowList((error, data) => {
- this.callBack(error, data);
-});
-```
-
-## policy.getPowerSaveAllowList
-
-getPowerSaveAllowList(): Promise\>;
-
-Obtains the UID array of applications that are on the device idle allowlist. This API uses a promise to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Return value**
-
-| Type | Description |
-| --------------------------------- | ------------------------------------- |
-| Promise\> | Promise used to return the result.|
-
-**Error codes**
-
-| ID| Error Message |
-| ------- | -------------------------------------------- |
-| 201 | Permission denied. |
-| 2100002 | Operation failed. Cannot connect to service.|
-| 2100003 | System internal error. |
-
-**Example**
-
-```js
-policy.getPowerSaveAllowList().then(function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
-})
-```
-
-## policy.on
-
-Functions as the handle to a network policy.
-
-### on('netUidPolicyChange')
-
-on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void
-
-Subscribes to policy changes. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| type | netUidPolicyChange | Yes| Event type. The value **netUidPolicyChange** indicates a policy change event.|
-| callback | Callback\<{ uid: number, policy: [NetUidPolicy](#netuidpolicy) }> | Yes | Callback used to return the result. It is called when the registered network policy changes.|
-
-**Example**
-
-```js
-policy.on('netUidPolicyChange', (data) => {
- this.log('on netUidPolicyChange: ' + JSON.stringify(data));
-})
-```
-
-### on('netUidRuleChange')
-
-on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void
-
-Subscribes to rule changes. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| type | netUidRuleChange | Yes| Event type. The value **netUidRuleChange** indicates a rule change event.|
-| callback | Callback\<{ uid: number, rule: [NetUidRule](#netuidrule) }> | Yes | Callback used to return the result. It is called when the registered rule changes.|
-
-**Example**
-
-```js
-policy.on('netUidRuleChange', (data) => {
- this.log('on netUidRuleChange: ' + JSON.stringify(data));
-})
-```
-
-### on('netMeteredIfacesChange')
-
-on(type: "netMeteredIfacesChange", callback: Callback\>): void
-
-Subscribes to metered **iface** changes. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| type | netMeteredIfacesChange | Yes| Event type. The value **netMeteredIfacesChange** indicates a metered **iface** change event.|
-| callback | Callback\> | Yes | Callback used to return the result. It is called when the registered metered **iface** changes.|
-
-**Example**
-
-```js
-policy.on('netMeteredIfacesChange', (data) => {
- this.log('on netMeteredIfacesChange: ' + JSON.stringify(data));
-})
-```
-
-### on('netQuotaPolicyChange')
-
-on(type: "netQuotaPolicyChange", callback: Callback\>): void
-
-Subscribes to network quota policy changes. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| type | netQuotaPolicyChange | Yes| Event type. The value **netQuotaPolicyChange** indicates a network quota policy change event.|
-| callback | Callback\> | Yes | Callback used to return the result. It is called when the registered network quota policy changes.|
-
-**Example**
-
-```js
-policy.on('netQuotaPolicyChange', (data) => {
- this.log('on netQuotaPolicyChange: ' + JSON.stringify(data));
-})
-```
-
-### on('netBackgroundPolicyChange')
-
-on(type: "netBackgroundPolicyChange", callback: Callback\): void
-
-Subscribes to background network policy changes. This API uses an asynchronous callback to return the result.
-
-**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| type | netBackgroundPolicyChange | Yes| Event type. The value **netBackgroundPolicyChange** indicates a background network policy change event.|
-| callback | Callback\ | Yes | Callback used to return the result. It is called when the registered background network policy changes.|
-
-**Example**
-
-```js
-policy.on('netBackgroundPolicyChange', (data) => {
- this.log('on netBackgroundPolicyChange: ' + JSON.stringify(data));
-})
-```
-
-## NetBackgroundPolicy
-
-Enumerates the background network policies.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name | Value | Description |
-| ------------------------ | ---- | ---------------------- |
-| NET_BACKGROUND_POLICY_NONE | 0 | Default policy.|
-| NET_BACKGROUND_POLICY_ENABLE | 1 | Applications running in the background are allowed to access metered networks.|
-| NET_BACKGROUND_POLICY_DISABLE | 2 | Applications running in the background are not allowed to access metered networks.|
-| NET_BACKGROUND_POLICY_ALLOW_LIST | 3 | Only applications on the allowlist are allowed to access metered networks when they are running in the background.|
-
-## NetQuotaPolicy
-
-Defines a network quota policy.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name | Type | Description |
-| ----------------------- | ----------------------------------- | ------------------------------------------------------------ |
-| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Network type.|
-| iccid | string | Identifier of the SIM card on the metered cellular network. It is not used for Wi-Fi networks.|
-| ident | string | Identifier of the SIM card on the metered cellular network. It is used for Wi-Fi networks. It is used together with **iccid**.|
-| periodDuration | string | Start time of metering.|
-| warningBytes | number | Data volume threshold for generating an alarm.|
-| limitBytes | number | Data volume quota.|
-| lastWarningRemind | string | Last time when an alarm was generated.|
-| lastLimitRemind | string | Last time when the quota was exhausted.|
-| metered | string | Whether the network is a metered network.|
-| limitAction | [LimitAction](#limitaction) | Action to take when the data volume quota is reached.|
-
-## LimitAction
-
-Enumerates the actions that can be taken when the data volume quota is reached.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name | Value| Description |
-| ---------------------- | ----- | ------------ |
-| LIMIT_ACTION_NONE | -1 | Default policy.|
-| LIMIT_ACTION_DISABLE | 0 | Internet access is disabled.|
-| LIMIT_ACTION_AUTO_BILL| 1 | Users will be automatically charged for the data volume they use.|
-
-## NetUidRule
-
-Enumerates the metered network rules.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name | Value| Description |
-| ---------------------- | ----- | ------------ |
-| NET_RULE_NONE | 0 | Default rule.|
-| NET_RULE_ALLOW_METERED_FOREGROUND | 1 | Applications running in the foreground are allowed to access metered networks.|
-| NET_RULE_ALLOW_METERED | 2 | Applications are allowed to access metered networks.|
-| NET_RULE_REJECT_METERED | 4 | Applications are not allowed to access metered networks.|
-| NET_RULE_ALLOW_ALL | 32 | Applications are allowed to access all networks (metered or non-metered).|
-| NET_RULE_REJECT_ALL | 64 | Applications are not allowed to access any networks (metered or non-metered).|
-
-## RemindType
-
-Enumerates the reminder types.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name| Value| Description|
-| ---------------------- | - | ------- |
-| REMIND_TYPE_WARNING | 1 | Warning.|
-| REMIND_TYPE_LIMIT | 2 | Limit.|
-
-## NetUidPolicy
-
-Enumerates the application-specific network policies.
-
-**System capability**: SystemCapability.Communication.NetManager.Core
-
-| Name | Value| Description |
-| ---------------------- | ----- | ------------ |
-| NET_POLICY_NONE | 0 | Default network policy.|
-| NET_POLICY_ALLOW_METERED_BACKGROUND | 1 | Applications running in the background are allowed to access metered networks.|
-| NET_POLICY_REJECT_METERED_BACKGROUND | 2 | Applications running in the background are not allowed to access metered networks.|
diff --git a/en/application-dev/reference/apis/js-apis-reminderAgent.md b/en/application-dev/reference/apis/js-apis-reminderAgent.md
index 3f9387defec0e68dc6414fdb4b21c5bca9cb1490..dc0a33ab0c33f9978b1985e5962067c2f2097cc2 100644
--- a/en/application-dev/reference/apis/js-apis-reminderAgent.md
+++ b/en/application-dev/reference/apis/js-apis-reminderAgent.md
@@ -1,4 +1,4 @@
-# @ohos.reminderAgent (Reminder Agent)
+# @ohos.reminderAgent (reminderAgent)
The **reminderAgent** module provides APIs for publishing scheduled reminders through the reminder agent.
@@ -18,14 +18,18 @@ import reminderAgent from'@ohos.reminderAgent';
```
-## reminderAgent.publishReminder
+## reminderAgent.publishReminder(deprecated)
```ts
-publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void
+publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\): void
```
Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder).
+
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -50,14 +54,18 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c
```
-## reminderAgent.publishReminder
+## reminderAgent.publishReminder(deprecated)
```ts
-publishReminder(reminderReq: ReminderRequest): Promise
+publishReminder(reminderReq: ReminderRequest): Promise\
```
Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder-1).
+
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
**System capability**: SystemCapability.Notification.ReminderAgent
@@ -85,14 +93,18 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu
```
-## reminderAgent.cancelReminder
+## reminderAgent.cancelReminder(deprecated)
```ts
-cancelReminder(reminderId: number, callback: AsyncCallback): void
+cancelReminder(reminderId: number, callback: AsyncCallback\): void
```
Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -100,7 +112,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel. The value is obtained by calling [publishReminder](#reminderagentpublishreminder).|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -111,14 +123,18 @@ reminderAgent.cancelReminder(1, (err, data) => {
```
-## reminderAgent.cancelReminder
+## reminderAgent.cancelReminder(deprecated)
```ts
-cancelReminder(reminderId: number): Promise
+cancelReminder(reminderId: number): Promise\
```
Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder-1).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -141,21 +157,25 @@ reminderAgent.cancelReminder(1).then(() => {
});
```
-## reminderAgent.getValidReminders
+## reminderAgent.getValidReminders(deprecated)
```ts
-getValidReminders(callback: AsyncCallback>): void
+getValidReminders(callback: AsyncCallback\>): void
```
Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|
+| callback | AsyncCallback\\> | Yes| Callback used to return an array of all valid reminders set by the current application.|
**Example**
@@ -187,14 +207,18 @@ reminderAgent.getValidReminders((err, reminders) => {
```
-## reminderAgent.getValidReminders
+## reminderAgent.getValidReminders(deprecated)
```ts
-getValidReminders(): Promise>
+getValidReminders(): Promise\>
```
Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders-1).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Return value**
@@ -233,21 +257,25 @@ reminderAgent.getValidReminders().then((reminders) => {
```
-## reminderAgent.cancelAllReminders
+## reminderAgent.cancelAllReminders(deprecated)
```ts
-cancelAllReminders(callback: AsyncCallback): void
+cancelAllReminders(callback: AsyncCallback\): void
```
Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -258,14 +286,18 @@ reminderAgent.cancelAllReminders((err, data) =>{
```
-## reminderAgent.cancelAllReminders
+## reminderAgent.cancelAllReminders(deprecated)
```ts
-cancelAllReminders(): Promise
+cancelAllReminders(): Promise\
```
Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders-1).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Return value**
@@ -282,14 +314,18 @@ reminderAgent.cancelAllReminders().then(() => {
})
```
-## reminderAgent.addNotificationSlot
+## reminderAgent.addNotificationSlot(deprecated)
```ts
-addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void
+addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\): void
```
Adds a notification slot. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -297,7 +333,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -313,14 +349,18 @@ reminderAgent.addNotificationSlot(mySlot, (err, data) => {
```
-## reminderAgent.addNotificationSlot
+## reminderAgent.addNotificationSlot(deprecated)
```ts
-addNotificationSlot(slot: NotificationSlot): Promise
+addNotificationSlot(slot: NotificationSlot): Promise\
```
Adds a notification slot. This API uses a promise to return the result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot-1).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -349,7 +389,7 @@ reminderAgent.addNotificationSlot(mySlot).then(() => {
```
-## reminderAgent.removeNotificationSlot
+## reminderAgent.removeNotificationSlot(deprecated)
```ts
removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void
@@ -357,6 +397,10 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<
Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -364,7 +408,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -377,7 +421,7 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION,
```
-## reminderAgent.removeNotificationSlot
+## reminderAgent.removeNotificationSlot(deprecated)
```ts
removeNotificationSlot(slotType: notification.SlotType): Promise
@@ -385,6 +429,10 @@ removeNotificationSlot(slotType: notification.SlotType): Promise
Removes a notification slot of a specified type. This API uses a promise to return the result.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot-1).
+
**System capability**: SystemCapability.Notification.ReminderAgent
**Parameters**
@@ -410,10 +458,14 @@ reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).
```
-## ActionButtonType
+## ActionButtonType(deprecated)
Enumerates button types.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButtonType](js-apis-reminderAgentManager.md#ActionButtonType).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Value| Description|
@@ -422,10 +474,14 @@ Enumerates button types.
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|
-## ReminderType
+## ReminderType(deprecated)
Enumerates reminder types.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderType](js-apis-reminderAgentManager.md#ReminderType).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Value| Description|
@@ -435,10 +491,14 @@ Enumerates reminder types.
| REMINDER_TYPE_ALARM | 2 | Alarm reminder.|
-## ActionButton
+## ActionButton(deprecated)
Defines a button displayed in the reminder notification.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButton](js-apis-reminderAgentManager.md#ActionButton).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -447,10 +507,14 @@ Defines a button displayed in the reminder notification.
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|
-## WantAgent
+## WantAgent(deprecated)
Sets the package and ability that are redirected to when the reminder notification is clicked.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.WantAgent](js-apis-reminderAgentManager.md#WantAgent).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -459,10 +523,14 @@ Sets the package and ability that are redirected to when the reminder notificati
| abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.|
-## MaxScreenWantAgent
+## MaxScreenWantAgent(deprecated)
Provides the information about the target package and ability to start automatically when the reminder is displayed in full-screen mode. This API is reserved.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.MaxScreenWantAgent](js-apis-reminderAgentManager.md#MaxScreenWantAgent).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -471,10 +539,14 @@ Provides the information about the target package and ability to start automatic
| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|
-## ReminderRequest
+## ReminderRequest(deprecated)
Defines the reminder to publish.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequest](js-apis-reminderAgentManager.md#ReminderRequest).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -494,12 +566,16 @@ Defines the reminder to publish.
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | No| Type of the slot used by the reminder.|
-## ReminderRequestCalendar
+## ReminderRequestCalendar(deprecated)
ReminderRequestCalendar extends ReminderRequest
Defines a reminder for a calendar event.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestCalendar](js-apis-reminderAgentManager.md#ReminderRequestCalendar).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -509,12 +585,16 @@ Defines a reminder for a calendar event.
| repeatDays | Array\ | No| Date on which the reminder repeats.|
-## ReminderRequestAlarm
+## ReminderRequestAlarm(deprecated)
ReminderRequestAlarm extends ReminderRequest
Defines a reminder for an alarm.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestAlarm](js-apis-reminderAgentManager.md#ReminderRequestAlarm).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -524,12 +604,16 @@ Defines a reminder for an alarm.
| daysOfWeek | Array\ | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.|
-## ReminderRequestTimer
+## ReminderRequestTimer(deprecated)
ReminderRequestTimer extends ReminderRequest
Defines a reminder for a scheduled timer.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestTimer](js-apis-reminderAgentManager.md#ReminderRequestTimer).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
@@ -537,10 +621,14 @@ Defines a reminder for a scheduled timer.
| triggerTimeInSeconds | number | Yes| Number of seconds in the countdown timer.|
-## LocalDateTime
+## LocalDateTime(deprecated)
Sets the time information for a calendar reminder.
+> **NOTE**
+>
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.LocalDateTime](js-apis-reminderAgentManager.md#LocalDateTime).
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
diff --git a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
index 4380dd084573117be6f2ea5db284969884cad0a3..7ec9eeb2c2070acee07603811e0bbd6417590555 100644
--- a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
+++ b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md
@@ -18,9 +18,7 @@ import reminderAgentManager from'@ohos.reminderAgentManager';
## reminderAgentManager.publishReminder
-```ts
-publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback): void
-```
+publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\): void
Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
@@ -33,7 +31,7 @@ Publishes a reminder through the reminder agent. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
- | callback | AsyncCallback\ | Yes| Callback used to return the published reminder's ID.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the published reminder's ID.|
**Error codes**
@@ -67,9 +65,7 @@ try {
## reminderAgentManager.publishReminder
-```ts
-publishReminder(reminderReq: ReminderRequest): Promise
-```
+publishReminder(reminderReq: ReminderRequest): Promise\
Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8).
@@ -85,7 +81,7 @@ Publishes a reminder through the reminder agent. This API uses a promise to retu
**Return value**
| Type| Description|
| -------- | -------- |
- | Promise\ | Promise used to return the published reminder's ID.|
+ | Promise\ | Promise used to return the published reminder's ID.|
**Error codes**
@@ -117,9 +113,7 @@ try {
## reminderAgentManager.cancelReminder
-```ts
-cancelReminder(reminderId: number, callback: AsyncCallback): void
-```
+cancelReminder(reminderId: number, callback: AsyncCallback\): void
Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result.
@@ -130,7 +124,7 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Error codes**
@@ -160,9 +154,7 @@ try {
## reminderAgentManager.cancelReminder
-```ts
-cancelReminder(reminderId: number): Promise
-```
+cancelReminder(reminderId: number): Promise\
Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.
@@ -178,7 +170,7 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| PPromise\ | Promise used to return the result.|
**Error codes**
@@ -205,10 +197,8 @@ try {
## reminderAgentManager.getValidReminders
-```ts
-getValidReminders(callback: AsyncCallback>): void
+getValidReminders(callback: AsyncCallback>): void
-```
Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.
@@ -218,7 +208,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|
+| callback | AsyncCallback\> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|
**Error codes**
@@ -267,9 +257,7 @@ try {
## reminderAgentManager.getValidReminders
-```ts
-getValidReminders(): Promise>
-```
+getValidReminders(): Promise\>
Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders.
@@ -279,7 +267,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
| Type| Description|
| -------- | -------- |
-| Promise\\> | Promise used to return an array of all valid reminders set by the current application.|
+| Promise\> | Promise used to return an array of all valid reminders set by the current application.|
**Error codes**
@@ -327,9 +315,7 @@ try {
## reminderAgentManager.cancelAllReminders
-```ts
-cancelAllReminders(callback: AsyncCallback): void
-```
+cancelAllReminders(callback: AsyncCallback\): void
Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.
@@ -339,7 +325,7 @@ Cancels all reminders set by the current application. This API uses an asynchron
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Error codes**
@@ -368,9 +354,7 @@ try {
## reminderAgentManager.cancelAllReminders
-```ts
-cancelAllReminders(): Promise
-```
+cancelAllReminders(): Promise\
Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
@@ -380,7 +364,7 @@ Cancels all reminders set by the current application. This API uses a promise to
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise used to return the result.|
**Error codes**
@@ -407,9 +391,7 @@ try {
## reminderAgentManager.addNotificationSlot
-```ts
-addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback): void
-```
+addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\): void
Adds a notification slot. This API uses an asynchronous callback to return the result.
@@ -420,7 +402,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -446,9 +428,7 @@ try {
## reminderAgentManager.addNotificationSlot
-```ts
-addNotificationSlot(slot: NotificationSlot): Promise
-```
+addNotificationSlot(slot: NotificationSlot): Promise\
Adds a notification slot. This API uses a promise to return the result.
@@ -464,7 +444,7 @@ Adds a notification slot. This API uses a promise to return the result.
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise used to return the result.|
**Example**
@@ -488,9 +468,7 @@ try {
## reminderAgentManager.removeNotificationSlot
-```ts
-removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback): void
-```
+removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\): void
Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.
@@ -501,7 +479,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
-| callback | AsyncCallback\ | Yes| Asynchronous callback used to return the result.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
**Example**
@@ -524,9 +502,7 @@ try {
## reminderAgentManager.removeNotificationSlot
-```ts
-removeNotificationSlot(slotType: notification.SlotType): Promise
-```
+removeNotificationSlot(slotType: notification.SlotType): Promise\
Removes a notification slot of a specified type. This API uses a promise to return the result.
@@ -542,7 +518,7 @@ Removes a notification slot of a specified type. This API uses a promise to retu
| Type| Description|
| -------- | -------- |
-| Promise\ | Promise used to return the result.|
+| Promise\ | Promise used to return the result.|
**Example**
@@ -570,7 +546,7 @@ Enumerates button types.
| -------- | -------- | -------- |
| ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.|
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|
-| ACTION_BUTTON_TYPE_CUSTOM10+ | 2 | Custom button. (This is a system API.)|
+| ACTION_BUTTON_TYPE_CUSTOM10+ | 2 | Custom button.
**System API**: This is a system API and cannot be called by third-party applications.|
## ReminderType
@@ -590,13 +566,14 @@ Enumerates reminder types.
Defines a button displayed for the reminder in the notification panel.
+
**System capability**: SystemCapability.Notification.ReminderAgent
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| title | string | Yes| Text on the button.|
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|
-| wantAgent10+ | [WantAgent](#wantagent) | No| Ability information that is displayed after the button is clicked. (This is a system API.)|
+| wantAgent10+ | [WantAgent](#wantagent) | No| Ability information that is displayed after the button is clicked.
**System API**: This is a system API and cannot be called by third-party applications.|
## WantAgent
@@ -605,10 +582,12 @@ Defines the information about the redirected-to ability.
**System capability**: SystemCapability.Notification.ReminderAgent
+
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the target package.|
| abilityName | string | Yes| Name of the target ability.|
+| uri10+ | string | No| URI of the target ability.
**System API**: This is a system API and cannot be called by third-party applications.|
## MaxScreenWantAgent
@@ -632,7 +611,7 @@ Defines the reminder to publish.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
-| actionButton | [ActionButton](#actionbutton) | No| Button displayed for the reminder in the notification panel. For common applications, a maximum of two buttons are supported. For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions. |
+| actionButton10+ | [ActionButton](#actionbutton) | No| Button displayed for the reminder in the notification panel. For common applications, a maximum of two buttons are supported. For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions. |
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.|
| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
@@ -659,8 +638,8 @@ Defines a reminder for a calendar event.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.|
-| repeatMonths | Array\ | No| Month in which the reminder repeats.|
-| repeatDays | Array\ | No| Date on which the reminder repeats.|
+| repeatMonths | Array\ | No| Month in which the reminder repeats.|
+| repeatDays | Array\ | No| Date on which the reminder repeats.|
## ReminderRequestAlarm
@@ -675,7 +654,7 @@ Defines a reminder for an alarm.
| -------- | -------- | -------- | -------- |
| hour | number | Yes| Hour portion of the reminder time.|
| minute | number | Yes| Minute portion of the reminder time.|
-| daysOfWeek | Array\ | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.|
+| daysOfWeek | Array\ | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.|
## ReminderRequestTimer
diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
index ab02ed0f2c5bf6bf553f6a36f6a94442db2bb378..9118b8b56684cc021cbd83511a905e28d5ddaead 100644
--- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
+++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md
@@ -39,7 +39,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
-| 9700004 | Checking workInfo failed. |
+| 9700004 | Check workInfo failed. |
| 9700005 | StartWork failed. |
@@ -80,7 +80,7 @@ Instructs the **WorkSchedulerService** to stop the specified task.
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------- |
| work | [WorkInfo](#workinfo) | Yes | Task to stop. |
-| needCancel | boolean | Yes | Whether to cancel the task.|
+| needCancel | boolean | No | Whether to cancel the task. The default value is **false**.|
**Error codes**
@@ -91,7 +91,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
-| 9700004 | Checking workInfo failed. |
+| 9700004 | Check workInfo failed. |
**Example**
@@ -118,7 +118,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
}
```
-## workScheduler.getWorkStatus:callback
+## workScheduler.getWorkStatus
getWorkStatus(workId: number, callback : AsyncCallback\): void
Obtains the latest task status. This API uses an asynchronous callback to return the result.
@@ -141,7 +141,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
-| 9700004 | Checking workInfo failed. |
+| 9700004 | Check workInfo failed. |
**Example**
@@ -161,7 +161,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
}
```
-## workScheduler.getWorkStatus:promise
+## workScheduler.getWorkStatus
getWorkStatus(workId: number): Promise\
Obtains the latest task status. This API uses a promise to return the result.
@@ -189,7 +189,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
-| 9700004 | Checking workInfo failed. |
+| 9700004 | Check workInfo failed. |
**Example**
@@ -207,7 +207,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
}
```
-## workScheduler.obtainAllWorks:callback
+## workScheduler.obtainAllWorks
obtainAllWorks(callback : AsyncCallback\): Array\
Obtains all tasks associated with this application. This API uses an asynchronous callback to return the result.
@@ -252,8 +252,8 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
}
```
-## workScheduler.obtainAllWorks:promise
-obtainAllWorks(): Promise