diff --git a/en/application-dev/quick-start/module-configuration-file.md b/en/application-dev/quick-start/module-configuration-file.md
index 58342507a06818c5cdb84996d63fe777c9eb34a5..65907daeaa07d2ce42ff7d4bedb17e199928f1c0 100644
--- a/en/application-dev/quick-start/module-configuration-file.md
+++ b/en/application-dev/quick-start/module-configuration-file.md
@@ -302,7 +302,7 @@ Set **icon**, **label**, and **skills** under **abilities** in the **module.json
| [metadata](#metadata)| Metadata information of the UIAbility component.| Object array| Yes (initial value: left empty)|
| exported | Whether the UIAbility component can be called by other applications.
- **true**: The UIAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
| continuable | Whether the UIAbility component can be [migrated](../application-models/hop-cross-device-migration.md).
- **true**: The UIAbility component can be migrated.
- **false**: The UIAbility component cannot be migrated.| Boolean| Yes (initial value: **false**)|
-| [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.
Configuring rule:
- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony application. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.)
- For HAPs of the feature type, you can configure **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service.| Object array| Yes (initial value: left empty)|
+| [skills](#skills) | Feature set of [wants](../application-models/want-overview.md) that can be received by the current UIAbility or ExtensionAbility component.
Configuration rules:
- For HAPs of the entry type, you can configure multiple **skills** attributes with the entry capability for an OpenHarmony application. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.)
- For HAPs of the feature type, you can configure **skills** attributes with the entry capability for an OpenHarmony application, but not for an OpenHarmony service. | Object array| Yes (initial value: left empty)|
| backgroundModes | Continuous tasks of the UIAbility component.
Continuous tasks are classified into the following types:
- **dataTransfer**: service for downloading, backing up, sharing, or transferring data from the network or peer devices.
- **audioPlayback**: audio playback service.
- **audioRecording**: audio recording service.
- **location**: location and navigation services.
- **bluetoothInteraction**: Bluetooth scanning, connection, and transmission services (wearables).
- **multiDeviceConnection**: multi-device interconnection service.
- **wifiInteraction**: Wi-Fi scanning, connection, and transmission services (as used in the Multi-screen Collaboration and clone features)
- **voip**: voice/video call and VoIP services.
- **taskKeeping**: computing service.| String array| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the UIAbility component startup page. Example: **$media:icon**.
The value is a string with a maximum of 255 bytes.| String| No|
| startWindowBackground | Index to the background color resource file of the UIAbility component startup page. Example: **$color:red**.
The value is a string with a maximum of 255 bytes.| String| No|
diff --git a/en/application-dev/quick-start/quickfix-principles.md b/en/application-dev/quick-start/quickfix-principles.md
index 53cb1c3fa2848cb4576a12838d45313d9005c6ed..ef9608ce20cdd54a451162d2a1194b81d3b54338 100644
--- a/en/application-dev/quick-start/quickfix-principles.md
+++ b/en/application-dev/quick-start/quickfix-principles.md
@@ -10,7 +10,7 @@ Quick fix is a technical means provided by the OpenHarmony system for developers
* The bundle name and application version number configured in the quick fix package must be the same as those of the installed application. Otherwise, the deployment will fail.
* Make sure the version of the quick fix package to deploy is later than that of the one previously deployed. Otherwise, the deployment will fail.
* The signature information of the quick fix package must be the same as that of the application to be fixed. Otherwise, the deployment will fail.
-* Installing an application update will delete quick fix package.
+* Installing an application update will delete the quick fix package.
## Structure of the Quick Fix Package
@@ -27,7 +27,7 @@ Quick fix is a technical means provided by the OpenHarmony system for developers
* .abc file: modified TS code in the application, which is a bytecode file created after the build.
* **libs** directory: a collection of .so.diff files, which are differential files of the .so library files, organized by system CPU architecture, such as arm and x86.
* **patch.json**:
-
This file is used to describe the version information of the .hqf file and is filled in by developers. The details are as follows:
+
This file is used to describe the version information of the .hqf file and is filled in by developers. The details are as follows:
```json
{
"app" : {
diff --git a/en/application-dev/quick-start/resource-categories-and-access.md b/en/application-dev/quick-start/resource-categories-and-access.md
index b8b2d912bf19f66fa97f5e65901b8985a8aaa6bd..f87ae3594a44b17b34233adfd0d8127a2be34028 100644
--- a/en/application-dev/quick-start/resource-categories-and-access.md
+++ b/en/application-dev/quick-start/resource-categories-and-access.md
@@ -49,22 +49,22 @@ resources
**Table 1** Classification of the resources directory
-| Category | base Subdirectory | Qualifiers Subdirectory | rawfile Subdirectory |
+| Category | base Subdirectory | Qualifiers Subdirectory | rawfile Subdirectory |
| ---- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- |
-| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second-level subdirectories in the **base** directory to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectory](#resource-group-subdirectory).| **en_US** and **zh_CN** are two default qualifiers subdirectories. You need to create other qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectory](#qualifiers-subdirectory).
Resource group subdirectories are located at the second level of qualifiers subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectory](#resource-group-subdirectory).| You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.|
-| Compilation| Resource files in the subdirectories are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectories are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. |
-| Reference| Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the file path and file name. |
+| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| **en_US** and **zh_CN** are two default qualifiers subdirectories. You need to create other qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.|
+| Compilation| Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. |
+| Reference| Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the file path and file name. |
-### Qualifiers Subdirectory
+### Qualifiers Subdirectories
-The name of a qualifiers subdirectory consists of one or more qualifiers that represent the application scenarios or device characteristics, covering the mobile country code (MCC), mobile network code (MNC), language, script, country or region, screen orientation, device type, night mode, and screen density. The qualifiers are separated using underscores (\_) or hyphens (\-). When creating a qualifiers subdirectory, you need to understand the directory naming conventions and the rules for matching qualifiers subdirectories and the device status.
+The name of a qualifiers subdirectory consists of one or more qualifiers that represent the application scenarios or device characteristics, covering the mobile country code (MCC), mobile network code (MNC), language, script, country or region, screen orientation, device type, night mode, and screen density. The qualifiers are separated using underscores (\_) or hyphens (\-). Before creating a qualifiers subdirectory, familiarize yourself with the directory naming conventions and the rules for matching qualifiers subdirectories and the device status.
**Naming Conventions for Qualifiers Subdirectories**
-- Qualifiers are ordered in the following sequence: **\_MCC_MNC-language_script_country/region-orientation-device-color mode-density**. You can select one or multiple qualifiers to name your subdirectory based on your application scenarios and device characteristics.
+- Qualifiers are ordered in the following sequence: **\_MCC_MNC-language_script_country/region-orientation-device-color mode-density_**. You can select one or multiple qualifiers to name your subdirectory based on your application scenarios and device characteristics.
-- Separation between qualifiers: The language, script, and country/region qualifiers are separated using underscores (\_); the MNC and MCC qualifiers are also separated using underscores (\_); other qualifiers are separated using hyphens (-). For example, **zh_Hant_CN** and **zh_CN-car-ldpi**.
+- Separation between qualifiers: The language, script, and country/region qualifiers are separated using underscores (\_); the MNC and MCC qualifiers are also separated using underscores (\_); other qualifiers are separated using hyphens (\-). For example, **zh_Hant_CN** and **zh_CN-car-ldpi**.
- Value range of qualifiers: The value of each qualifier must meet the requirements specified in the following table. Otherwise, the resource files in the resources directory cannot be matched.
@@ -72,34 +72,34 @@ The name of a qualifiers subdirectory consists of one or more qualifiers that re
| Qualifier Type | Description and Value Range |
| ----------- | ---------------------------------------- |
-| MCC&MNC| Mobile country code and mobile network code, which are obtained from the network where the device is registered. The MCC can be either followed by the MNC with an underscore (\_) in between or be used independently. For example, **mcc460** indicates China, and **mcc460\_mnc00** indicates China\_China Mobile.
For details about the value range, refer to **ITU-T E.212** (the international identification plan for public networks and subscriptions).|
-| Language | Language used by the device. The value consists of two or three lowercase letters. for example, **zh** indicates Chinese, en indicates English, and **mai** indicates Maithili.
For details about the value range, refer to **ISO 639** (codes for the representation of names of languages).|
-| Script | Script type used by the device. The value starts with one uppercase letter followed by three lowercase letters. For example, **Hans** indicates simplified Chinese, and **Hant** indicates traditional Chinese.
For details about the value range, refer to **ISO 15924** (codes for the representation of names of scripts).||
-| Country/Region | Country or region where the user is located. The value consists of two or three uppercase letters or three digits. For example, **CN** indicates China, and **GB** indicates the United Kingdom.
For details about the value range, refer to **ISO 3166-1** (codes for the representation of names of countries and their subdivisions).||
-| Screen orientation | Screen orientation of the device. The value can be:
- **vertical**: portrait orientation
- **horizontal**: landscape orientation|
-| Type of the registered device. | Device type. The value can be:
- **car**: head unit
- **tv**: smart TV
- **wearable**: smart wearable|
-| Color mode | Color mode of the device. The value can be:
- **dark**: dark mode
- **light**: light mode|
-| Screen density | Screen density of the device, in dpi. The value can be:
- **sdpi**: screen density with small-scale dots per inch (SDPI). This value is applicable for devices with a DPI range of (0, 120].
- **mdpi**: screen density with medium-scale dots per inch (MDPI). This value is applicable for devices with a DPI range of (120, 160].
- **ldpi**: screen density with large-scale dots per inch (LDPI). This value is applicable for devices with a DPI range of (160, 240].
- **xldpi**: screen density with extra-large-scale dots per inch (XLDPI). This value is applicable for devices with a DPI range of (240, 320].
- **xxldpi**: screen density with extra-extra-large-scale dots per inch (XXLDPI). This value is applicable for devices with a DPI range of (320, 480].
- **xxxldpi**: screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI). This value is applicable for devices with a DPI range of (480, 640].|
+| MCC&MNC| Indicates the MCC and MNC, which are obtained from the network where the device is registered. The MCC can be either followed by the MNC with an underscore (\_) in between or be used independently. For example, **mcc460** indicates China, and **mcc460\_mnc00** indicates China\_China Mobile.
For details about the value range, refer to **ITU-T E.212** (the international identification plan for public networks and subscriptions).|
+| Language | Indicates the language used by the device. The value consists of two or three lowercase letters. For example, **zh** indicates Chinese, **en** indicates English, and **mai** indicates Maithili.
For details about the value range, refer to **ISO 639** (codes for the representation of names of languages).|
+| Text | Indicates the script type used by the device. The value starts with one uppercase letter followed by three lowercase letters. For example, **Hans** indicates simplified Chinese, and **Hant** indicates traditional Chinese.
For details about the value range, refer to **ISO 15924** (codes for the representation of names of scripts).|
+| Country/Region | Indicates the country or region where the user is located. The value consists of two or three uppercase letters or three digits. For example, **CN** indicates China, and **GB** indicates the United Kingdom.
For details about the value range, refer to **ISO 3166-1** (codes for the representation of names of countries and their subdivisions).|
+| Screen orientation | Indicates the screen orientation of the device. The value can be:
- **vertical**: portrait orientation
- **horizontal**: landscape orientation|
+| Device type | Indicates the device type. The value can be:
- **car**: head unit
- **tv**: smart TV
- **wearable**: smart wearable|
+| Color mode | Indicates the color mode of the device. The value can be:
- **dark**: dark mode
- **light**: light mode|
+| Screen density | Indicates the screen density of the device, in dpi. The value can be:
- **sdpi**: screen density with small-scale dots per inch (SDPI). This value is applicable for devices with a DPI range of (0, 120].
- **mdpi**: medium-scale screen density (Medium-scale Dots Per Inch), applicable to DPI whose value is (120, 160] device.
- **ldpi**: screen density with large-scale dots per inch (LDPI). This value is applicable for devices with a DPI range of (160, 240].
- **xldpi**: screen density with extra-large-scale dots per inch (XLDPI). This value is applicable for devices with a DPI range of (240, 320].
- **xxldpi**: screen density with extra-extra-large-scale dots per inch (XXLDPI). This value is applicable for devices with a DPI range of (320, 480].
- **xxxldpi**: screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI). This value is applicable for devices with a DPI range of (480, 640].|
-**Rules for Matching Qualifiers subdirectories and Device Resources**
+**Rules for Matching Qualifiers Subdirectories and Device Resources**
-- Qualifiers are matched with the device resources in the following priorities: MCC&MNC > locale (options: language, language\_script, language\_country/region, and language\_script\_country/region) > screen orientation > device type > color mode > screen density.
+- Qualifiers are matched with the device resources in the following priorities: MCC&MNC > locale (options: language, language_script, language_country/region, and language_script_country/region) > screen orientation > device type > color mode > screen density.
-- If the qualifiers subdirectories contain the **MCC, MNC, language, script, screen orientation, device type, and color mode** qualifiers, their values must be consistent with the current device status so that the subdirectories can be used for matching the device resources. For example, the qualifiers subdirectory **zh\_CN-car-ldpi** cannot be used for matching the resource files labeled **en\_US**.
+- If the qualifiers subdirectories contain the **MCC, MNC, language, script, screen orientation, device type, and color mode** qualifiers, their values must be consistent with the current device status so that the subdirectories can be used for matching the device resources. For example, the qualifiers subdirectory **zh_CN-car-ldpi** cannot be used for matching the resource files labeled **en_US**.
-### Resource Group Subdirectory
+### Resource Group Subdirectories
-You can create resource group subdirectories (including element, media, and profile) in the **base** and qualifiers subdirectories to store resource files of specific types.
+You can create resource group subdirectories (including element, media, and profile) in the **base** and qualifiers subdirectories to store resource files of specific types.
**Table 3** Resource group subdirectories
| Resource Group Subdirectory | Description | Resource File |
| ------- | ---------------------------------------- | ---------------------------------------- |
-| element | Element resources. Each type of data is represented by a JSON file. (Only files are supported in this directory.) The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json |
-| media | Media resources, including non-text files such as images, audios, and videos. (Only files are supported in this directory.) | The file name can be customized, for example, **icon.png**. |
-| profile | Custom configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. (Only files are supported in this directory.) | The file name can be customized, for example, **test_profile.json**. |
+| element | Indicates element resources. Each type of data is represented by a JSON file. (Only files are supported in this directory.) The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json |
+| media | Indicates media resources, including non-text files such as images, audios, and videos. (Only files are supported in this directory.) | The file name can be customized, for example, **icon.png**. |
+| profile | Indicates a custom configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. (Only files are supported in this directory.) | The file name can be customized, for example, **test_profile.json**. |
**Media Resource Types**
@@ -212,41 +212,41 @@ The content of the **plural.json** file is as follows:
**Creating a Resource File**
-You can create a subdirectory and its files under the **resources** directory based on the above descriptions of the qualifiers subdirectories and resource group subdirectories.
+You can create a subdirectory and its files under the **resources** directory based on the preceding descriptions of the qualifiers subdirectories and resource group subdirectories.
DevEco Studio provides a wizard for you to create resource directories and resource files.
-- Creating a resource directory and resource file
+- Creating a Resource Directory and Resource File
- Right-click the **resources** directory and choose **New > Resource File**. This operation creates a subdirectory and a resource file simultaneously. If no qualifier is selected, the file is created in a resource type subdirectory under **base**. If one or more qualifiers are selected, the system automatically generates a subdirectory and creates the file in this subdirectory. To select a qualifier, highlight it under **Available qualifiers** and click the right arrow. To deselect a qualifier, highlight it under **Selected qualifiers** and click the left arrow. In **File name**, enter the name of the resource file to create. In **Resource type**, select the type of the resource group, which is **element** by default. In **Root Element**, select a resource type. The created subdirectory is automatically named in the format of *Qualifiers.Resource group type*. For example, if you create a subdirectory by setting **Color Mode** to **Dark** and **Resource type** to **Element**, the system automatically generates a subdirectory named **dark.element**.
+ Right-click the **resources** directory and choose **New > Resource File**. If no qualifier is selected, the file is created in a resource type subdirectory under **base**. If one or more qualifiers are selected, the system automatically generates a subdirectory and creates the file in this subdirectory. To select a qualifier, highlight it under **Available qualifiers** and click the right arrow. To deselect a qualifier, highlight it under **Selected qualifiers** and click the left arrow. In **File name**, enter the name of the resource file to create. In **Resource type**, select the type of the resource group, which is **element** by default. In **Root Element**, select a resource type. The created subdirectory is automatically named in the format of *Qualifiers.Resource group type*. For example, if you create a subdirectory by setting **Color Mode** to **Dark** and **Resource type** to **Element**, the system automatically generates a subdirectory named **dark.element**.
![create-resource-file-1](figures/create-resource-file-1.png)
-- Creating a resource directory
+- Creating a Resource Directory
- Right-click the **resources** directory and choose **New > Resource Directory**. This operation creates a subdirectory only. By default, the **base** subdirectory is created. You can create qualifiers subdirectories as required, by specifying the qualifier and resource group type. After determining the qualifier, select a resource group type. Currently, the resource group type can be **Element**, **Media**, or **Profile**. After a resource group is created, a directory name is automatically generated.
+ Right-click the **resources** directory and choose **New > Resource Directory** to create a subdirectory only. By default, the **base** subdirectory is created. You can create qualifiers subdirectories as required, by specifying the qualifier and resource group type.
![create-resource-file-2](figures/create-resource-file-2.png)
-- Creating a resource file
+- Creating a Resource File
- Right-click a subdirectory under **resources** and choose **New > *example* Resource File**. This operation creates a resource file under this subdirectory. For example, you can create an element resource file in the **element** subdirectory.
+ Right-click a subdirectory under **resources** and choose **New > *XXX* Resource File**. This operation creates a resource file under this subdirectory. For example, you can create an element resource file in the **element** subdirectory.
![create-resource-file-3](figures/create-resource-file-3.png)
**Accessing Application Resources**
-To reference an application resource in a project, use the `"$r('app.type.name')"` format. **app** indicates the resource defined in the **resources** directory of the application. **type** indicates the resource type (or the location where the resource is stored). The value can be **color**, **float**, **string**, **plural**, or **media**. **name** indicates the resource name, which you set when defining the resource.
+To reference an application resource in a project, use the **"$r('app.type.name')"** format. **app** indicates the resource defined in the **resources** directory of the application. **type** indicates the resource type (or the location where the resource is stored). The value can be **color**, **float**, **string**, **plural**, or **media**. **name** indicates the resource name, which you set when defining the resource.
-When referencing resources in the **rawfile** subdirectory, use the `"$rawfile('filename')"` format. Wherein **filename** indicates the relative path of a file in the **rawfile** subdirectory, which must contain the file name extension and cannot start with a slash (/).
+When referencing resources in the **rawfile** subdirectory, use the **"$rawfile('filename')"** format. Wherein **filename** indicates the relative path of a file in the **rawfile** subdirectory, which must contain the file name extension and cannot start with a slash (/).
> **NOTE**
>
-> Resource descriptors accept only strings, such as `'app.type.name'`, and cannot be combined.
+> Resource descriptors accept only strings, such as **'app.type.name'**, and cannot be combined.
>
-> The return value of `$r` is a Resource object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md#getstringvalue9) method.
+> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md#getstringvalue9) API.
-In the ***example*.ets** file, you can use the resources defined in the **resources** directory. The following is a resource usage example based on the resource file examples in [Resource Group Subdirectory](#resource-group-subdirectory):
+In the **.ets** file, you can use the resources defined in the **resources** directory. As described in [Resource Group Subdirectories](#resource-group-subdirectories), you can reference .json resource files, including **color.json**, **string.json**, and **plural.json**. The usage is as follows:
```ts
Text($r('app.string.string_hello'))
@@ -257,13 +257,14 @@ Text($r('app.string.string_world'))
.fontColor($r('app.color.color_world'))
.fontSize($r('app.float.font_world'))
-// Reference string resources. The second parameter of $r is used to replace %s, and value is "We will arrive at five of the clock".
+// Reference string resources. The first parameter of $r indicates the string resource, and the second parameter is used to replace %s in the string.json file.
+// In this example, the resultant value is "We will arrive at five of the clock".
Text($r('app.string.message_arrive', "five of the clock"))
.fontColor($r('app.color.color_hello'))
.fontSize($r('app.float.font_hello'))
-// Reference plural resources. The first parameter indicates the plural resource, the second parameter indicates the number of plural resources, and the third parameter indicates the substitute of %d.
-// The value is "5 apple" in singular form and "5 apples" in plural form.
+// Reference plural resources. The first parameter of $r indicates the plural resource, the second parameter indicates the number of plural resources (for English, **one** indicates singular and is represented by **1**, and **other** indicates plural and is represented by an integer greater than or equal to 1; for Chinese, **other** indicates both singular and plural), and the third parameter is used to replace %d.
+// In this example, the resultant value is "5 apples".
Text($r('app.plural.eat_apple', 5, 5))
.fontColor($r('app.color.color_world'))
.fontSize($r('app.float.font_world'))
@@ -279,13 +280,13 @@ Image($rawfile('newDir/newTest.png')) // Reference an image in the rawfile
System resources include colors, rounded corners, fonts, spacing, character strings, and images. By using system resources, you can develop different applications with the same visual style.
-To reference a system resource, use the `"$r('sys.type.resource_id')"` format. Wherein: **sys** indicates a system resource; **type** indicates the resource type, which can be **color**, **float**, **string**, or **media**; **resource_id** indicates the resource ID.
+To reference a system resource, use the **"$r('sys.type.resource_id')"** format. Wherein: **sys** indicates a system resource; **type** indicates the resource type, which can be **color**, **float**, **string**, or **media**; **resource_id** indicates the resource ID.
> **NOTE**
>
> - Use of system resources is supported in the declarative development paradigm, but not in the web-like development paradigm.
>
-> - For details about the implementation of preconfigured resources, visit the [OpenHarmony/resources repository](https://gitee.com/openharmony/resources/tree/master/systemres/main/resources). The directory structure there is similar to that of the **resources** directory in the project. Resource qualifiers are used to match resources with different devices and device status.
+> - For details about the implementation of preconfigured resources, visit the [OpenHarmony/resources repository](https://gitee.com/openharmony/resources/tree/master/systemres/main/resources). The directory structure there is similar to that of the **resources** directory in the project. Resource qualifiers are used to match resources with different devices and device states.
```ts
Text('Hello')
diff --git a/en/application-dev/quick-start/start-with-ets-fa.md b/en/application-dev/quick-start/start-with-ets-fa.md
index 019490d354b8d7c6b6ff7771065aae1b7534b76c..36fe7adfb84fa9ea5a5e735a61d71ca44dbe6dab 100644
--- a/en/application-dev/quick-start/start-with-ets-fa.md
+++ b/en/application-dev/quick-start/start-with-ets-fa.md
@@ -10,7 +10,7 @@
## Creating an ArkTS Project
-1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click Next.
+1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click **Next**.
![createProject](figures/createProject.png)
diff --git a/en/application-dev/quick-start/start-with-ets-stage.md b/en/application-dev/quick-start/start-with-ets-stage.md
index d18a01875cf2e52abd45b493f8223c596912276d..978ffd47a206abc5f5b3e047a8d7f3dcc0e599e9 100644
--- a/en/application-dev/quick-start/start-with-ets-stage.md
+++ b/en/application-dev/quick-start/start-with-ets-stage.md
@@ -10,7 +10,7 @@
## Creating an ArkTS Project
-1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click Next.
+1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click **Next**.
![createProject](figures/createProject.png)
diff --git a/en/application-dev/quick-start/start-with-js-fa.md b/en/application-dev/quick-start/start-with-js-fa.md
index abb27d9fb942a406e22d98285626984bdc63d197..812be6247b4ed3aae55dd1f67b0ee5bb47f01065 100644
--- a/en/application-dev/quick-start/start-with-js-fa.md
+++ b/en/application-dev/quick-start/start-with-js-fa.md
@@ -8,7 +8,7 @@
## Creating a JavaScript Project
-1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click Next.
+1. If you are opening DevEco Studio for the first time, click **Create Project**. If a project is already open, choose **File** > **New** > **Create Project** from the menu bar. On the **Choose Your Ability Template** page, select **Application** (or **Atomic Service**, depending on your project), select **Empty Ability** as the template, and click **Next**.
![createProject](figures/createProject.png)
diff --git a/en/application-dev/reference/apis/js-apis-commonEvent.md b/en/application-dev/reference/apis/js-apis-commonEvent.md
index 1551404f13c5d662cda9cf77b25155f7e9d04e92..d77715182ee3c166d571b95f84ef0ed683dfad4d 100644
--- a/en/application-dev/reference/apis/js-apis-commonEvent.md
+++ b/en/application-dev/reference/apis/js-apis-commonEvent.md
@@ -19,12 +19,16 @@ A system common event is an event that is published by a system service or syste
For details about the definitions of all system common events, see [System Common Events](./commonEvent-definitions.md).
-## CommonEvent.publish
+## CommonEvent.publish(deprecated)
publish(event: string, callback: AsyncCallback\): void
Publishes a common event. 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 [commonEventManager.publish](js-apis-commonEventManager.md#commoneventmanagerpublish) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -50,14 +54,16 @@ function publishCallBack(err) {
CommonEvent.publish("event", publishCallBack);
```
-
-
-## CommonEvent.publish
+## CommonEvent.publish(deprecated)
publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\): void
Publishes a common event with given attributes. 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 [commonEventManager.publish](js-apis-commonEventManager.md#commoneventmanagerpublish-1) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -66,7 +72,7 @@ Publishes a common event with given attributes. This API uses an asynchronous ca
| -------- | ---------------------- | ---- | ---------------------- |
| event | string | Yes | Name of the common event to publish. |
| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | Yes | Attributes of the common event to publish.|
-| callback | syncCallback\ | Yes | Callback used to return the result. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
**Example**
@@ -92,14 +98,16 @@ function publishCallBack(err) {
CommonEvent.publish("event", options, publishCallBack);
```
-
-
-## CommonEvent.publishAsUser8+
+## CommonEvent.publishAsUser(deprecated)
publishAsUser(event: string, userId: number, callback: AsyncCallback\): void
Publishes a common event to a specific user. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [commonEventManager.publishAsUser](js-apis-commonEventManager.md#commoneventmanagerpublishasuser) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**System API**: This is a system API and cannot be called by third-party applications.
@@ -131,14 +139,16 @@ let userId = 100;
CommonEvent.publishAsUser("event", userId, publishAsUserCallBack);
```
-
-
-## CommonEvent.publishAsUser8+
+## CommonEvent.publishAsUser(deprecated)
publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\): void
Publishes a common event with given attributes to a specific user. This API uses an asynchronous callback to return the result.
+> **NOTE**
+>
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [commonEventManager.publishAsUser](js-apis-commonEventManager.md#commoneventmanagerpublishasuser-1) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**System API**: This is a system API and cannot be called by third-party applications.
@@ -178,14 +188,16 @@ let userId = 100;
CommonEvent.publishAsUser("event", userId, options, publishAsUserCallBack);
```
-
-
-## CommonEvent.createSubscriber
+## CommonEvent.createSubscriber(deprecated)
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\): void
Creates a subscriber. 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 [commonEventManager.createSubscriber](js-apis-commonEventManager.md#commoneventmanagercreatesubscriber) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -220,14 +232,16 @@ function createSubscriberCallBack(err, commonEventSubscriber) {
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack);
```
-
-
-## CommonEvent.createSubscriber
+## CommonEvent.createSubscriber(deprecated)
createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\
Creates a subscriber. 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 [commonEventManager.createSubscriber](js-apis-commonEventManager.md#commoneventmanagercreatesubscriber-1) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -260,14 +274,16 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
});
```
-
-
-## CommonEvent.subscribe
+## CommonEvent.subscribe(deprecated)
subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\): void
Subscribes to common events. 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 [commonEventManager.subscribe](js-apis-commonEventManager.md#commoneventmanagersubscribe) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -312,14 +328,16 @@ function createSubscriberCallBack(err, commonEventSubscriber) {
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack);
```
-
-
-## CommonEvent.unsubscribe
+## CommonEvent.unsubscribe(deprecated)
unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\): void
Unsubscribes from common events. 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 [commonEventManager.subscribe](js-apis-commonEventManager.md#commoneventmanagerunsubscribe) instead.
+
**System capability**: SystemCapability.Notification.CommonEvent
**Parameters**
@@ -370,10 +388,10 @@ function unsubscribeCallBack(err) {
}
// Create a subscriber.
-CommonEvent.createSubscriber(subscribeInfo, createCB);
+CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack);
// Unsubscribe from the common event.
-CommonEvent.unsubscribe(subscriber, unsubscribeCB);
+CommonEvent.unsubscribe(subscriber, unsubscribeCallBack);
```
## CommonEventSubscriber
diff --git a/en/application-dev/reference/apis/js-apis-commonEventManager.md b/en/application-dev/reference/apis/js-apis-commonEventManager.md
index 225bd59b0ae8e7fa2b33b50efaa875bdb82705be..f58c4096876b4a63dc1ed54d541c7fc6f9c9283b 100644
--- a/en/application-dev/reference/apis/js-apis-commonEventManager.md
+++ b/en/application-dev/reference/apis/js-apis-commonEventManager.md
@@ -38,8 +38,7 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
-| 1500004 | not System services. |
+| 1500004 | not System services or System app. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
@@ -83,8 +82,7 @@ Publishes a common event with given attributes. This API uses an asynchronous ca
**Error codes**
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
-| 1500004 | not System services. |
+| 1500004 | not System services or System app. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
@@ -139,9 +137,7 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
**Error codes**
| ID| Error Message |
| -------- | ----------------------------------- |
-| 202 | not system app. |
-| 401 | The parameter check failed. |
-| 1500004 | not System services. |
+| 1500004 | not System services or System app. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
@@ -193,9 +189,7 @@ Publishes a common event with given attributes to a specific user. This API uses
**Error codes**
| ID| Error Message |
| -------- | ----------------------------------- |
-| 202 | not system app. |
-| 401 | The parameter check failed. |
-| 1500004 | not System services. |
+| 1500004 | not System services or System app. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
| 1500009 | error obtaining system parameters. |
@@ -246,14 +240,6 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul
| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. |
| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.|
-**Error codes**
-
- For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
-
-| ID| Error Message |
-| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
-
**Example**
@@ -304,14 +290,6 @@ Creates a subscriber. This API uses a promise to return the result.
| --------------------------------------------------------- | ---------------- |
| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Promise used to return the subscriber object.|
-**Error codes**
-
- For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
-
-| ID| Error Message |
-| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
-
**Example**
```ts
@@ -359,7 +337,6 @@ Subscribes to common events. This API uses an asynchronous callback to return th
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 801 | capability not supported. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
@@ -431,7 +408,6 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 801 | capability not supported. |
| 1500007 | error sending message to Common Event Service. |
| 1500008 | Common Event Service does not complete initialization. |
@@ -490,737 +466,6 @@ try {
}
```
-## CommonEventSubscriber
-
-### getCode
-
-getCode(callback: AsyncCallback\): void
-
-Obtains the result code of this common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------- | ---- | ------------------ |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Error codes**
-
- For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
-
-| ID| Error Message |
-| -------- | ----------------------------------- |
-| 201 | The application dose not have permission to call the interface. |
-| 202 | not system app. |
-| 401 | The parameter check failed. |
-| 1500004 | not system service. |
-| 1500007 | The message send error. |
-| 1500008 | The CEMS error. |
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for result code obtaining of an ordered common event.
-function getCodeCallback(err, Code) {
- if (err) {
- console.error("getCode failed " + JSON.stringify(err));
- } else {
- console.info("getCode " + JSON.stringify(Code));
- }
-}
-subscriber.getCode(getCodeCallback);
-```
-
-### getCode
-
-getCode(): Promise\
-
-Obtains the result code of this common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Error codes**
-
- For details about the error codes, see [Event Error Codes](../errorcodes/errorcode-CommonEventService.md).
-
-| ID| Error Message |
-| -------- | ----------------------------------- |
-| 201 | The application dose not have permission to call the interface. |
-| 202 | not system app. |
-| 401 | The parameter check failed. |
-| 1500004 | not system service. |
-| 1500007 | The message send error. |
-| 1500008 | The CEMS error. |
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.getCode().then((Code) => {
- console.info("getCode " + JSON.stringify(Code));
-}).catch((err) => {
- console.error("getCode failed " + JSON.stringify(err));
-});
-```
-
-### setCode
-
-setCode(code: number, callback: AsyncCallback\): void
-
-Sets the result code for this common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | ---------------------- |
-| code | number | Yes | Result code of the common event. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for result code setting of an ordered common event.
-function setCodeCallback(err) {
- if (err) {
- console.error("setCode failed " + JSON.stringify(err));
- } else {
- console.info("setCode");
- }
-}
-subscriber.setCode(1, setCodeCallback);
-```
-
-### setCode
-
-setCode(code: number): Promise\
-
-Sets the result code for this common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | ------------------ |
-| code | number | Yes | Result code of the common event.|
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.setCode(1).then(() => {
- console.info("setCode");
-}).catch((err) => {
- console.error("setCode failed " + JSON.stringify(err));
-});
-```
-
-### getData
-
-getData(callback: AsyncCallback\): void
-
-Obtains the result data of this common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ---------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result data.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for result data obtaining of an ordered common event.
-function getDataCallback(err, Data) {
- if (err) {
- console.error("getData failed " + JSON.stringify(err));
- } else {
- console.info("getData " + JSON.stringify(Data));
- }
-}
-subscriber.getData(getDataCallback);
-```
-
-### getData
-
-getData(): Promise\
-
-Obtains the result data of this common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ---------------- | ------------------ |
-| Promise\ | Promise used to return the result data.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.getData().then((Data) => {
- console.info("getData " + JSON.stringify(Data));
-}).catch((err) => {
- console.error("getData failed " + JSON.stringify(err));
-});
-```
-
-### setData
-
-setData(data: string, callback: AsyncCallback\): void
-
-Sets the result data for this common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | -------------------- |
-| data | string | Yes | Result data of the common event. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for result data setting of an ordered common event
-function setDataCallback(err) {
- if (err) {
- console.error("setData failed " + JSON.stringify(err));
- } else {
- console.info("setData");
- }
-}
-subscriber.setData("publish_data_changed", setDataCallback);
-```
-
-### setData
-
-setData(data: string): Promise\
-
-Sets the result data for this common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | -------------------- |
-| data | string | Yes | Result data of the common event.|
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.setData("publish_data_changed").then(() => {
- console.info("setData");
-}).catch((err) => {
- console.error("setData failed " + JSON.stringify(err));
-});
-```
-
-### setCodeAndData
-
-setCodeAndData(code: number, data: string, callback:AsyncCallback\): void
-
-Sets the result code and result data for this common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | ---------------------- |
-| code | number | Yes | Result code of the common event. |
-| data | string | Yes | Result data of the common event. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for result code and result data setting of an ordered common event.
-function setCodeDataCallback(err) {
- if (err) {
- console.error("setCodeAndData failed " + JSON.stringify(err));
- } else {
- console.info("setCodeDataCallback");
- }
-}
-subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCallback);
-```
-
-### setCodeAndData
-
-setCodeAndData(code: number, data: string): Promise\
-
-Sets the result code and result data for this common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ------ | ---- | -------------------- |
-| code | number | Yes | Result code of the common event.|
-| data | string | Yes | Result data of the common event.|
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
- console.info("setCodeAndData");
-}).catch((err) => {
- console.info("setCodeAndData failed " + JSON.stringify(err));
-});
-```
-
-### isOrderedCommonEvent
-
-isOrderedCommonEvent(callback: AsyncCallback\): void
-
-Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result.
-
-
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | ---------------------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the common event is an ordered one; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for checking whether the current common event is an ordered one.
-function isOrderedCallback(err, isOrdered) {
- if (err) {
- console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
- } else {
- console.info("isOrdered " + JSON.stringify(isOrdered));
- }
-}
-subscriber.isOrderedCommonEvent(isOrderedCallback);
-```
-
-### isOrderedCommonEvent
-
-isOrderedCommonEvent(): Promise\
-
-Checks whether this common event is an ordered one. This API uses a promise to return the result.
-
-
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ----------------- | -------------------------------- |
-| Promise\ | Promise used to return the result. The value **true** means that the common event is an ordered one; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.isOrderedCommonEvent().then((isOrdered) => {
- console.info("isOrdered " + JSON.stringify(isOrdered));
-}).catch((err) => {
- console.error("isOrdered failed " + JSON.stringify(err));
-});
-```
-
-### isStickyCommonEvent
-
-isStickyCommonEvent(callback: AsyncCallback\): void
-
-Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
-
-
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | ---------------------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the common event is a sticky one; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for checking whether the current common event is a sticky one.
-function isStickyCallback(err, isSticky) {
- if (err) {
- console.error("isStickyCommonEvent failed " + JSON.stringify(err));
- } else {
- console.info("isSticky " + JSON.stringify(isSticky));
- }
-}
-subscriber.isStickyCommonEvent(isStickyCallback);
-```
-
-### isStickyCommonEvent
-
-isStickyCommonEvent(): Promise\
-
-Checks whether this common event is a sticky one. This API uses a promise to return the result.
-
-
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ----------------- | -------------------------------- |
-| Promise\ | Promise used to return the result. The value **true** means that the common event is a sticky one; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.isStickyCommonEvent().then((isSticky) => {
- console.info("isSticky " + JSON.stringify(isSticky));
-}).catch((err) => {
- console.error("isSticky failed " + JSON.stringify(err));
-});
-```
-
-### abortCommonEvent
-
-abortCommonEvent(callback: AsyncCallback\): void
-
-Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for common event aborting.
-function abortCallback(err) {
- if (err) {
- console.error("abortCommonEvent failed " + JSON.stringify(err));
- } else {
- console.info("abortCommonEvent");
- }
-}
-subscriber.abortCommonEvent(abortCallback);
-```
-
-### abortCommonEvent
-
-abortCommonEvent(): Promise\
-
-Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.abortCommonEvent().then(() => {
- console.info("abortCommonEvent");
-}).catch((err) => {
- console.error("abortCommonEvent failed " + JSON.stringify(err));
-});
-```
-
-### clearAbortCommonEvent
-
-clearAbortCommonEvent(callback: AsyncCallback\): void
-
-Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for clearing the aborted state of the current common event.
-function clearAbortCallback(err) {
- if (err) {
- console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
- } else {
- console.info("clearAbortCommonEvent");
- }
-}
-subscriber.clearAbortCommonEvent(clearAbortCallback);
-```
-
-### clearAbortCommonEvent
-
-clearAbortCommonEvent(): Promise\
-
-Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.clearAbortCommonEvent().then(() => {
- console.info("clearAbortCommonEvent");
-}).catch((err) => {
- console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
-});
-```
-
-### getAbortCommonEvent
-
-getAbortCommonEvent(callback: AsyncCallback\): void
-
-Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------- | ---- | ---------------------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the ordered common event is in the aborted state; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for checking whether the current common event is in the aborted state.
-function getAbortCallback(err, AbortCommonEvent) {
- if (err) {
- console.error("getAbortCommonEvent failed " + JSON.stringify(err));
- } else {
- console.info("AbortCommonEvent " + AbortCommonEvent)
- }
-}
-subscriber.getAbortCommonEvent(getAbortCallback);
-```
-
-### getAbortCommonEvent
-
-getAbortCommonEvent(): Promise\
-
-Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ----------------- | ---------------------------------- |
-| Promise\ | Promise used to return the result. The value **true** means that the ordered common event is in the aborted state; and **false** means the opposite.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.getAbortCommonEvent().then((AbortCommonEvent) => {
- console.info("AbortCommonEvent " + JSON.stringify(AbortCommonEvent));
-}).catch((err) => {
- console.error("getAbortCommonEvent failed " + JSON.stringify(err));
-});
-```
-
-### getSubscribeInfo
-
-getSubscribeInfo(callback: AsyncCallback\): void
-
-Obtains the subscriber information. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------------------------------------ | ---- | ---------------------- |
-| callback | AsyncCallback\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Yes | Callback used to return the subscriber information.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for subscriber information obtaining.
-function getSubscribeInfoCallback(err, SubscribeInfo) {
- if (err) {
- console.error("getSubscribeInfo failed " + JSON.stringify(err));
- } else {
- console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo));
- }
-}
-subscriber.getSubscribeInfo(getSubscribeInfoCallback);
-```
-
-### getSubscribeInfo
-
-getSubscribeInfo(): Promise\
-
-Obtains the subscriber information. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ------------------------------------------------------------ | ---------------------- |
-| Promise\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Promise used to return the subscriber information.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.getSubscribeInfo().then((SubscribeInfo) => {
- console.info("SubscribeInfo " + JSON.stringify(SubscribeInfo));
-}).catch((err) => {
- console.error("getSubscribeInfo failed " + JSON.stringify(err));
-});
-```
-
-### finishCommonEvent9+
-
-finishCommonEvent(callback: AsyncCallback\): void
-
-Finishes this ordered common event. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | -------------------- | ---- | -------------------------------- |
-| callback | AsyncCallback\ | Yes | Callback returned after the ordered common event is finished.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-// Callback for ordered common event finishing.
-function finishCommonEventCallback(err) {
- if (err) {
- console.error("finishCommonEvent failed " + JSON.stringify(err));
-} else {
- console.info("FinishCommonEvent");
-}
-}
-subscriber.finishCommonEvent(finishCommonEventCallback);
-```
-
-### finishCommonEvent9+
-
-finishCommonEvent(): Promise\
-
-Finishes this ordered common event. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.CommonEvent
-
-**Return value**
-
-| Type | Description |
-| ---------------- | -------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```ts
-var subscriber; // Subscriber object successfully created.
-
-subscriber.finishCommonEvent().then(() => {
- console.info("FinishCommonEvent");
-}).catch((err) => {
- console.error("finishCommonEvent failed " + JSON.stringify(err));
-});
-```
-
## CommonEventData
**System capability**: SystemCapability.Notification.CommonEvent
diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md
index a73c80d7c5fa09e19f901b3c947f445eb61989e1..a8afc035794c4e35fbdf9d68a715fe2bb67e7b36 100644
--- a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md
+++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md
@@ -1,5 +1,10 @@
# CommonEventData
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+
**System capability**: SystemCapability.Notification.CommonEvent
| Name | Type | Readable| Writable| Description |
diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
index 94963860fe1b57a6abfd6fff6fdba38816a63294..332fd934c7ee9799d4356acc45996d3632b4f9d2 100644
--- a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
+++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
@@ -1,5 +1,9 @@
# CommonEventPublishData
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
**System capability**: SystemCapability.Notification.CommonEvent
| Name | Type | Readable| Writable| Description |
diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
index 2b9db9ec46f479d5d0607c33f07601b1ef721446..c5de47b81e6b928a7d26909a54aa9ba798078417 100644
--- a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
+++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
@@ -1,5 +1,9 @@
# CommonEventSubscribeInfo
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
**System capability**: SystemCapability.Notification.CommonEvent
| Name | Type | Readable| Writable| Description |
diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
index 18eeac506b75dc96b27b56b9369070215ff8892a..02112d5b265e73139c9cd662246a819bc16c0b1f 100644
--- a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
+++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
@@ -1,11 +1,40 @@
# CommonEventSubscriber
-## getCode
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Usage
+
+Before using the **CommonEventSubscriber** module, you must obtain a **subscriber** object by calling **CommonEvent.createSubscriber**.
```ts
-getCode(callback: AsyncCallback): void
+import CommonEvent from '@ohos.commonEvent';
+let subscriber; // Used to save the created subscriber object for subsequent subscription and unsubscription.
+
+// Subscriber information.
+let subscribeInfo = {
+ events: ["event"]
+};
+
+// Callback for subscriber creation.
+function createCB(err, commonEventSubscriber) {
+ if (err.code) {
+ console.error(`createSubscriber failed, code is ${err.code}`);
+ } else {
+ console.info("createSubscriber");
+ subscriber = commonEventSubscriber;
+ }
+}
+
+// Create a subscriber.
+CommonEvent.createSubscriber(subscribeInfo, createCB);
```
+## getCode
+
+getCode(callback: AsyncCallback\): void
+
Obtains the code of this common event. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent
@@ -19,8 +48,6 @@ Obtains the code of this common event. This API uses an asynchronous callback to
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for result code obtaining of an ordered common event.
function getCodeCB(err, code) {
if (err.code) {
@@ -34,9 +61,7 @@ subscriber.getCode(getCodeCB);
## getCode
-```ts
-getCode(): Promise
-```
+getCode(): Promise\
Obtains the code of this common event. This API uses a promise to return the result.
@@ -51,8 +76,6 @@ Obtains the code of this common event. This API uses a promise to return the res
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code));
}).catch((err) => {
@@ -62,9 +85,7 @@ subscriber.getCode().then((code) => {
## setCode
-```ts
-setCode(code: number, callback: AsyncCallback): void
-```
+setCode(code: number, callback: AsyncCallback\): void
Sets the code for this common event. This API uses an asynchronous callback to return the result.
@@ -80,8 +101,6 @@ Sets the code for this common event. This API uses an asynchronous callback to r
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for result code setting of an ordered common event.
function setCodeCB(err) {
if (err.code) {
@@ -95,9 +114,7 @@ subscriber.setCode(1, setCodeCB);
## setCode
-```ts
-setCode(code: number): Promise
-```
+setCode(code: number): Promise\
Sets the code for this common event. This API uses a promise to return the result.
@@ -118,8 +135,6 @@ Sets the code for this common event. This API uses a promise to return the resul
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.setCode(1).then(() => {
console.info("setCode");
}).catch((err) => {
@@ -129,9 +144,7 @@ subscriber.setCode(1).then(() => {
## getData
-```ts
-getData(callback: AsyncCallback): void
-```
+getData(callback: AsyncCallback\): void
Obtains the data of this common event. This API uses an asynchronous callback to return the result.
@@ -146,8 +159,6 @@ Obtains the data of this common event. This API uses an asynchronous callback to
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for result data obtaining of an ordered common event.
function getDataCB(err, data) {
if (err.code) {
@@ -161,9 +172,7 @@ subscriber.getData(getDataCB);
## getData
-```ts
-getData(): Promise
-```
+getData(): Promise\
Obtains the data of this common event. This API uses a promise to return the result.
@@ -178,8 +187,6 @@ Obtains the data of this common event. This API uses a promise to return the res
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data));
}).catch((err) => {
@@ -205,8 +212,6 @@ Sets the data for this common event. This API uses an asynchronous callback to r
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for result data setting of an ordered common event
function setDataCB(err) {
if (err.code) {
@@ -220,9 +225,7 @@ subscriber.setData("publish_data_changed", setDataCB);
## setData
-```ts
-setData(data: string): Promise
-```
+setData(data: string): Promise\
Sets the data for this common event. This API uses a promise to return the result.
@@ -243,8 +246,6 @@ Sets the data for this common event. This API uses a promise to return the resul
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.setData("publish_data_changed").then(() => {
console.info("setData");
}).catch((err) => {
@@ -254,9 +255,7 @@ subscriber.setData("publish_data_changed").then(() => {
## setCodeAndData
-```ts
-setCodeAndData(code: number, data: string, callback:AsyncCallback): void
-```
+setCodeAndData(code: number, data: string, callback:AsyncCallback\): void
Sets the code and data for this common event. This API uses an asynchronous callback to return the result.
@@ -273,8 +272,6 @@ Sets the code and data for this common event. This API uses an asynchronous call
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for code and data setting of an ordered common event.
function setCodeDataCB(err) {
if (err.code) {
@@ -288,9 +285,7 @@ subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB);
## setCodeAndData
-```ts
-setCodeAndData(code: number, data: string): Promise
-```
+setCodeAndData(code: number, data: string): Promise\
Sets the code and data for this common event. This API uses a promise to return the result.
@@ -312,8 +307,6 @@ Sets the code and data for this common event. This API uses a promise to return
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData");
}).catch((err) => {
@@ -323,9 +316,7 @@ subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
## isOrderedCommonEvent
-```ts
-isOrderedCommonEvent(callback: AsyncCallback): void
-```
+isOrderedCommonEvent(callback: AsyncCallback\): void
Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result.
@@ -340,8 +331,6 @@ Checks whether this common event is an ordered one. This API uses an asynchronou
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for checking whether the current common event is an ordered one.
function isOrderedCB(err, isOrdered) {
if (err.code) {
@@ -355,9 +344,7 @@ subscriber.isOrderedCommonEvent(isOrderedCB);
## isOrderedCommonEvent
-```ts
-isOrderedCommonEvent(): Promise
-```
+isOrderedCommonEvent(): Promise\
Checks whether this common event is an ordered one. This API uses a promise to return the result.
@@ -372,8 +359,6 @@ Checks whether this common event is an ordered one. This API uses a promise to r
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => {
@@ -383,9 +368,7 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => {
## isStickyCommonEvent
-```ts
-isStickyCommonEvent(callback: AsyncCallback): void
-```
+isStickyCommonEvent(callback: AsyncCallback\): void
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
@@ -400,8 +383,6 @@ Checks whether this common event is a sticky one. This API uses an asynchronous
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for checking whether the current common event is a sticky one.
function isStickyCB(err, isSticky) {
if (err.code) {
@@ -415,9 +396,7 @@ subscriber.isStickyCommonEvent(isStickyCB);
## isStickyCommonEvent
-```ts
-isStickyCommonEvent(): Promise
-```
+isStickyCommonEvent(): Promise\
Checks whether this common event is a sticky one. This API uses a promise to return the result.
@@ -432,8 +411,6 @@ Checks whether this common event is a sticky one. This API uses a promise to ret
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky));
}).catch((err) => {
@@ -443,9 +420,7 @@ subscriber.isStickyCommonEvent().then((isSticky) => {
## abortCommonEvent
-```ts
-abortCommonEvent(callback: AsyncCallback): void
-```
+abortCommonEvent(callback: AsyncCallback\): void
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
@@ -460,8 +435,6 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for common event aborting.
function abortCB(err) {
if (err.code) {
@@ -475,9 +448,7 @@ subscriber.abortCommonEvent(abortCB);
## abortCommonEvent
-```ts
-abortCommonEvent(): Promise
-```
+abortCommonEvent(): Promise\
Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result.
@@ -492,8 +463,6 @@ Aborts this common event. After the abort, the common event is not sent to the n
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent");
}).catch((err) => {
@@ -503,9 +472,7 @@ subscriber.abortCommonEvent().then(() => {
## clearAbortCommonEvent
-```ts
-clearAbortCommonEvent(callback: AsyncCallback): void
-```
+clearAbortCommonEvent(callback: AsyncCallback\): void
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
@@ -520,8 +487,6 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for clearing the aborted state of the current common event.
function clearAbortCB(err) {
if (err.code) {
@@ -535,9 +500,7 @@ subscriber.clearAbortCommonEvent(clearAbortCB);
## clearAbortCommonEvent
-```ts
-clearAbortCommonEvent(): Promise
-```
+clearAbortCommonEvent(): Promise\
Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
@@ -552,8 +515,6 @@ Clears the aborted state of this common event. This API takes effect only for or
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent");
}).catch((err) => {
@@ -563,9 +524,7 @@ subscriber.clearAbortCommonEvent().then(() => {
## getAbortCommonEvent
-```ts
-getAbortCommonEvent(callback: AsyncCallback): void
-```
+getAbortCommonEvent(callback: AsyncCallback\): void
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
@@ -580,8 +539,6 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for checking whether the current common event is in the aborted state.
function getAbortCB(err, abortEvent) {
if (err.code) {
@@ -595,9 +552,7 @@ subscriber.getAbortCommonEvent(getAbortCB);
## getAbortCommonEvent
-```ts
-getAbortCommonEvent(): Promise
-```
+getAbortCommonEvent(): Promise\
Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result.
@@ -612,8 +567,6 @@ Checks whether this common event is in the aborted state. This API takes effect
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.getAbortCommonEvent().then((abortEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortEvent));
}).catch((err) => {
@@ -623,9 +576,7 @@ subscriber.getAbortCommonEvent().then((abortEvent) => {
## getSubscribeInfo
-```ts
-getSubscribeInfo(callback: AsyncCallback): void
-```
+getSubscribeInfo(callback: AsyncCallback\): void
Obtains the subscriber information. This API uses an asynchronous callback to return the result.
@@ -640,8 +591,6 @@ Obtains the subscriber information. This API uses an asynchronous callback to re
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for subscriber information obtaining.
function getCB(err, subscribeInfo) {
if (err.code) {
@@ -655,9 +604,7 @@ subscriber.getSubscribeInfo(getCB);
## getSubscribeInfo
-```ts
-getSubscribeInfo(): Promise
-```
+getSubscribeInfo(): Promise\
Obtains the subscriber information. This API uses a promise to return the result.
@@ -672,8 +619,6 @@ Obtains the subscriber information. This API uses a promise to return the result
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => {
@@ -683,9 +628,7 @@ subscriber.getSubscribeInfo().then((subscribeInfo) => {
## finishCommonEvent9+
-```ts
-finishCommonEvent(callback: AsyncCallback): void
-```
+finishCommonEvent(callback: AsyncCallback\): void
Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result.
@@ -700,14 +643,13 @@ Finishes this common event. This API takes effect only for ordered common events
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
// Callback for ordered common event finishing.
function finishCB(err) {
if (err.code) {
console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
-} else {
+ } else {
console.info("FinishCommonEvent");
+ }
}
subscriber.finishCommonEvent(finishCB);
@@ -715,9 +657,7 @@ subscriber.finishCommonEvent(finishCB);
## finishCommonEvent9+
-```ts
-finishCommonEvent(): Promise
-```
+finishCommonEvent(): Promise\
Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result.
@@ -732,8 +672,6 @@ Finishes this common event. This API takes effect only for ordered common events
**Example**
```ts
-let subscriber; // Subscriber object successfully created.
-
subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent");
}).catch((err) => {
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md
index 88e58e4bea766398e24ae1870c061e0dc385953a..ee7f0e37c7d85cdfdde76ae9b852bb05964af358 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md
@@ -8,9 +8,9 @@ The **NotificationActionButton** module describes the button displayed in the no
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| --------- | ----------------------------------------------- | --- | ---- | ------------------------- |
-| title | string | Yes | Yes | Button title. |
-| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** of the button.|
-| extras | { [key: string]: any } | Yes | Yes | Extra information of the button. |
-| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | Yes | Yes | User input object. |
+| title | string | No | Yes | Button title. |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | No | Yes | **WantAgent** of the button.|
+| extras | { [key: string]: any } | No | No | Extra information of the button. |
+| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | No | No | User input object. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md
index dcd2a4ce8de27431ea343b27bb933d829fcad74c..48f8c4cc28912aab4b3cc0446c951fe539b6ba4e 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md
@@ -10,7 +10,7 @@ Provides the bundle information of an application.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Mandatory| Description |
-| ------ | ------ |---- | ------ |
-| bundle | string | Yes| Bundle information of the application.|
-| uid | number | No| User ID.|
+| Name | Type | Read-only| Mandatory| Description |
+| ------ | ------ | ---- | ---- | ------ |
+| bundle | string | No | Yes| Bundle information of the application.|
+| uid | number | No | No| User ID.|
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md
index 7c2b3a78da9b2c22c7ae9967552655f6e70a6c8c..9f5de8d911f2533c0dd789fd3bce1eeaf1adeef6 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md
@@ -8,13 +8,13 @@ The **NotificationContent** module describes the notification content.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ |
-| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | Yes | Yes | Notification content type. |
-| normal | [NotificationBasicContent](#notificationbasiccontent) | Yes | Yes | Normal text. |
-| longText | [NotificationLongTextContent](#notificationlongtextcontent) | Yes | Yes | Long text.|
-| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | Yes | Yes | Multi-line text. |
-| picture | [NotificationPictureContent](#notificationpicturecontent) | Yes | Yes | Picture-attached. |
+| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | No | Yes | Notification content type. |
+| normal | [NotificationBasicContent](#notificationbasiccontent) | No | No | Normal text. |
+| longText | [NotificationLongTextContent](#notificationlongtextcontent) | No | No | Long text.|
+| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | No | No | Multi-line text. |
+| picture | [NotificationPictureContent](#notificationpicturecontent) | No | No | Picture-attached. |
## NotificationBasicContent
@@ -22,11 +22,11 @@ Describes the normal text notification.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| -------------- | ------ | ---- | ---- | ---------------------------------- |
-| title | string | Yes | Yes | Notification title. |
-| text | string | Yes | Yes | Notification content. |
-| additionalText | string | Yes | Yes | Additional information of the notification.|
+| title | string | No | Yes | Notification title. |
+| text | string | No | Yes | Notification content. |
+| additionalText | string | No | No | Additional information of the notification.|
## NotificationLongTextContent
@@ -35,14 +35,14 @@ Describes the long text notification.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| -------------- | ------ | ---- | --- | -------------------------------- |
-| title | string | Yes | Yes | Notification title. |
-| text | string | Yes | Yes | Notification content. |
-| additionalText | string | Yes | Yes | Additional information of the notification.|
-| longText | string | Yes | Yes | Long text of the notification. |
-| briefText | string | Yes | Yes | Brief text of the notification.|
-| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. |
+| title | string | No | Yes | Notification title. |
+| text | string | No | Yes | Notification content. |
+| additionalText | string | No | No | Additional information of the notification.|
+| longText | string | No | Yes | Long text of the notification. |
+| briefText | string | No | Yes | Brief text of the notification. |
+| expandedTitle | string | No | Yes | Title of the notification in the expanded state. |
## NotificationMultiLineContent
@@ -53,12 +53,12 @@ Describes the multi-line text notification.
| Name | Type | Readable| Writable| Description |
| -------------- | --------------- | --- | --- | -------------------------------- |
-| title | string | Yes | Yes | Notification title. |
-| text | string | Yes | Yes | Notification content. |
-| additionalText | string | Yes | Yes | Additional information of the notification.|
-| briefText | string | Yes | Yes | Brief text of the notification.|
-| longTitle | string | Yes | Yes | Title of the notification in the expanded state. |
-| lines | Array\ | Yes | Yes | Multi-line text of the notification. |
+| title | string | No | Yes | Notification title. |
+| text | string | No | Yes | Notification content. |
+| additionalText | string | No | No | Additional information of the notification.|
+| briefText | string | No | Yes | Brief text of the notification.|
+| longTitle | string | No | Yes | Title of the notification in the expanded state. |
+| lines | Array\ | No | Yes | Multi-line text of the notification. |
## NotificationPictureContent
@@ -69,9 +69,9 @@ Describes the picture-attached notification.
| Name | Type | Readable| Writable| Description |
| -------------- | -------------- | ---- | --- | -------------------------------- |
-| title | string | Yes | Yes | Notification title. |
-| text | string | Yes | Yes | Notification content. |
-| additionalText | string | Yes | Yes | Additional information of the notification.|
-| briefText | string | Yes | Yes | Brief text of the notification.|
-| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. |
-| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Picture attached to the notification. |
+| title | string | No | Yes | Notification title. |
+| text | string | No | Yes | Notification content. |
+| additionalText | string | No | No | Additional information of the notification.|
+| briefText | string | No | Yes | Brief text of the notification.|
+| expandedTitle | string | No | Yes | Title of the notification in the expanded state. |
+| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | No | Yes | Picture attached to the notification. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md
index f7e1a995b51bcc193e2cd21115eb8e934233eec5..e0b84a9fbac8e59070b598960bdb447c9cc24dbe 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md
@@ -8,7 +8,7 @@ The **NotificationFlags** module implements a **NotificationFlags** instance.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| ---------------- | ---------------------- | ---- | ---- | --------------------------------- |
| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable the sound alert for the notification. |
| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable vibration for the notification. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md
index 205a6c04bdf7fff97c80e44b882fb487712e2c01..ac3646f424f7701e2fa85c671a76ba90c511d212 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md
@@ -8,45 +8,45 @@ The **NotificationRequest** module describes the notification request.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- |
-| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | Yes | Yes | Notification content. |
-| id | number | Yes | Yes | Notification ID. |
-| slotType | [SlotType](js-apis-notificationManager.md#slottype) | Yes | Yes | Notification slot type. |
-| isOngoing | boolean | Yes | Yes | Whether the notification is an ongoing notification. |
-| isUnremovable | boolean | Yes | Yes | Whether the notification can be removed. |
-| deliveryTime | number | Yes | Yes | Time when the notification is sent. |
-| tapDismissed | boolean | Yes | Yes | Whether the notification is automatically cleared. |
-| autoDeletedTime | number | Yes | Yes | Time when the notification is automatically cleared. |
-| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.|
-| extraInfo | {[key: string]: any} | Yes | Yes | Extended parameters. |
-| color | number | Yes | Yes | Background color of the notification. Not supported currently.|
-| colorEnabled | boolean | Yes | Yes | Whether the notification background color can be enabled. Not supported currently.|
-| isAlertOnce | boolean | Yes | Yes | Whether the notification triggers an alert only once.|
-| isStopwatch | boolean | Yes | Yes | Whether to display the stopwatch. |
-| isCountDown | boolean | Yes | Yes | Whether to display the countdown time. |
-| isFloatingIcon | boolean | Yes | Yes | Whether the notification is displayed as a floating icon in the status bar. |
-| label | string | Yes | Yes | Notification label. |
-| badgeIconStyle | number | Yes | Yes | Notification badge type. |
-| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. |
-| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. |
-| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
-| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
+| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | No | Yes | Notification content. |
+| id | number | No | No | Notification ID. |
+| slotType | [SlotType](js-apis-notificationManager.md#slottype) | Yes | No | Notification slot type. |
+| isOngoing | boolean | No | No | Whether the notification is an ongoing notification. |
+| isUnremovable | boolean | No | No | Whether the notification can be removed. |
+| deliveryTime | number | No | No | Time when the notification is sent. |
+| tapDismissed | boolean | No | No | Whether the notification is automatically cleared. |
+| autoDeletedTime | number | No | No | Time when the notification is automatically cleared. |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | No | No | **WantAgent** instance to which the notification will be redirected after being clicked.|
+| extraInfo | {[key: string]: any} | No | No | Extended parameters. |
+| color | number | No | No | Background color of the notification. Not supported currently.|
+| colorEnabled | boolean | No | No | Whether the notification background color can be enabled. Not supported currently.|
+| isAlertOnce | boolean | No | No | Whether the notification triggers an alert only once.|
+| isStopwatch | boolean | No | No | Whether to display the stopwatch. |
+| isCountDown | boolean | No | No | Whether to display the countdown time. |
+| isFloatingIcon | boolean | No | No | Whether the notification is displayed as a floating icon in the status bar. |
+| label | string | No | No | Notification label. |
+| badgeIconStyle | number | No | No | Notification badge type. Not supported currently. |
+| showDeliveryTime | boolean | No | No | Whether to display the time when the notification is delivered. |
+| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | No | No | Buttons in the notification. Up to three buttons are allowed. |
+| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | No | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
+| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | No | No | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. |
| creatorUid8+ | number | Yes | No | UID used for creating the notification. |
| creatorPid | number | Yes | No | PID used for creating the notification. |
-| creatorUserId| number | Yes | No | ID of the user who creates the notification. |
+| creatorUserId | number | Yes | No | ID of the user who creates the notification. |
| hashCode | string | Yes | No | Unique ID of the notification. |
-| classification | string | Yes | Yes | Notification category.
**System API**: This is a system API and cannot be called by third-party applications. |
-| groupName8+ | string | Yes | Yes | Notification group name. |
-| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | Yes | Yes | Notification template. |
+| classification | string | No | No | Notification category.
**System API**: This is a system API and cannot be called by third-party applications. |
+| groupName8+ | string | No | No | Notification group name. |
+| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | No | No | Notification template. |
| isRemoveAllowed8+ | boolean | Yes | No | Whether the notification can be removed.
**System API**: This is a system API and cannot be called by third-party applications. |
| source8+ | number | Yes | No | Notification source.
**System API**: This is a system API and cannot be called by third-party applications. |
-| distributedOption8+ | [DistributedOptions](#distributedoptions) | Yes | Yes | Distributed notification options. |
+| distributedOption8+ | [DistributedOptions](#distributedoptions) | No | No | Distributed notification options. |
| deviceId8+ | string | Yes | No | Device ID of the notification source.
**System API**: This is a system API and cannot be called by third-party applications. |
-| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags) | Yes | No | Notification flags. |
-| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected when it is removed. |
-| badgeNumber9+ | number | Yes | Yes | Number of notifications displayed on the application icon. |
+| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationFlags.md#notificationflags) | Yes | No | Notification flags. |
+| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | No | No | **WantAgent** instance to which the notification will be redirected when it is removed. |
+| badgeNumber9+ | number | No | No | Number of notifications displayed on the application icon. |
## DistributedOptions
@@ -55,9 +55,9 @@ Describes distributed notification options.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
-| isDistributed8+ | boolean | Yes | Yes | Whether the notification is a distributed notification. |
-| supportDisplayDevices8+ | Array\ | Yes | Yes | List of the devices to which the notification can be synchronized. |
-| supportOperateDevices8+ | Array\ | Yes | Yes | List of the devices on which the notification can be opened. |
+| isDistributed8+ | boolean | No | No | Whether the notification is a distributed notification. |
+| supportDisplayDevices8+ | Array\ | No | No | List of the devices to which the notification can be synchronized. |
+| supportOperateDevices8+ | Array\ | No | No | List of the devices on which the notification can be opened. |
| remindType8+ | number | Yes | No | Notification reminder type.
**System API**: This is a system API and cannot be called by third-party applications. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md
index 8bf9e286d59504be03ff8454d59ce60c31a9a597..9757ef2c007501439c509adc691e8f57aa3b354c 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md
@@ -8,17 +8,17 @@ The **NotificationSlot** module describes the notification slot.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
-| type | [SlotType](js-apis-notificationManager.md#slottype) | Yes | Yes | Notification slot type. |
-| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.|
-| desc | string | Yes | Yes | Notification slot description. |
-| badgeFlag | boolean | Yes | Yes | Whether to display the badge. |
-| bypassDnd | boolean | Yes | Yes | Whether to bypass DND mode in the system. |
-| lockscreenVisibility | number | Yes | Yes | Mode for displaying the notification on the lock screen. |
-| vibrationEnabled | boolean | Yes | Yes | Whether to enable vibration for the notification. |
-| sound | string | Yes | Yes | Notification alert tone. |
-| lightEnabled | boolean | Yes | Yes | Whether the indicator blinks for the notification. |
-| lightColor | number | Yes | Yes | Indicator color of the notification. |
-| vibrationValues | Array\ | Yes | Yes | Vibration mode of the notification. |
+| type | [SlotType](js-apis-notificationManager.md#slottype) | No | Yes | Notification slot type. |
+| level | number | No | No | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.|
+| desc | string | No | No | Notification slot description. |
+| badgeFlag | boolean | No | No | Whether to display the badge. |
+| bypassDnd | boolean | No | No | Whether to bypass DND mode in the system. |
+| lockscreenVisibility | number | No | No | Mode for displaying the notification on the lock screen. |
+| vibrationEnabled | boolean | No | No | Whether to enable vibration for the notification. |
+| sound | string | No | No | Notification alert tone. |
+| lightEnabled | boolean | No | No | Whether the indicator blinks for the notification. |
+| lightColor | number | No | No | Indicator color of the notification. |
+| vibrationValues | Array\ | No | No | Vibration mode of the notification. |
| enabled9+ | boolean | Yes | No | Whether the notification slot is enabled. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSorting.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSorting.md
new file mode 100644
index 0000000000000000000000000000000000000000..8062a16f3ac0305025130bcd73f91bd41ba6abdf
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSorting.md
@@ -0,0 +1,17 @@
+# NotificationSorting
+
+Provides sorting information of active notifications.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Type | Read-only| Mandatory| Description |
+| -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
+| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Yes | Notification slot type. |
+| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value is used based on the notification slot type.|
+| desc | string | Yes | Yes | Description of the notification slot. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSortingMap.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSortingMap.md
new file mode 100644
index 0000000000000000000000000000000000000000..0e75e98d2ce00b55aefc7d640f6590332782b451
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSortingMap.md
@@ -0,0 +1,17 @@
+# NotificationSortingMap
+
+Provides sorting information of active notifications in all subscribed notifications.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Type | Read-only| Mandatory| Description |
+| -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
+| sortings | { [key: string]: [NotificationSorting](js-apis-inner-notification-notificationSorting.md) } | Yes | Yes | Array of notification sorting information.|
+| sortedHashCode | Array\ | Yes | Yes | Hash codes for notification sorting.|
+
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSubscribeInfo.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSubscribeInfo.md
new file mode 100644
index 0000000000000000000000000000000000000000..8bd477d99c99ba3cc5f494b12fb83c993b0ca682
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSubscribeInfo.md
@@ -0,0 +1,16 @@
+# NotificationSubscribeInfo
+
+Provides the information about the publisher for notification subscription.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Type | Read-only| Mandatory| Description |
+| -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
+| bundleNames | Array\ | No | No | Bundle names of the applications whose notifications are to be subscribed to. |
+| userId | number | No | No | User ID. |
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md
index 557fad664de00eb37567cb2d055c0c0ec2f8d484..3f9825e1d8cf63848d70e2282498e0d85f37cab0 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md
@@ -8,7 +8,7 @@ The **NotificationTemplate** module describes the notification template.
**System capability**: SystemCapability.Notification.Notification
-| Name| Type | Readable| Writable| Description |
+| Name| Type | Read-only| Mandatory| Description |
| ---- | ---------------------- | ---- | ---- | ---------- |
-| name | string | Yes | Yes | Template name.|
-| data | {[key:string]: Object} | Yes | Yes | Template data.|
+| name | string | No | Yes | Template name.|
+| data | {[key:string]: Object} | No | Yes | Template data.|
diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md
index 76e673c886d4208354b680501c6ddbb0000e6438..bfda17b7872a816c4eb05a3af9fc5c10098f0a90 100644
--- a/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md
+++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md
@@ -8,6 +8,6 @@ The **NotificationUserInput** module provides the notification user input.
**System capability**: SystemCapability.Notification.Notification
-| Name | Type | Readable| Writable| Description |
+| Name | Type | Read-only| Mandatory| Description |
| -------- | ------ | --- | ---- | ----------------------------- |
-| inputKey | string | Yes | Yes | Key to identify the user input.|
+| inputKey | string | No | Yes | Key to identify the user input.|
diff --git a/en/application-dev/reference/apis/js-apis-notification.md b/en/application-dev/reference/apis/js-apis-notification.md
index 7cdf0119a33ed1724fa99d7ffc783bf2ef357d67..c5301e9ca4b5d7257d591bce88d705c63fc5e202 100644
--- a/en/application-dev/reference/apis/js-apis-notification.md
+++ b/en/application-dev/reference/apis/js-apis-notification.md
@@ -586,7 +586,7 @@ Notification.getSlot(slotType).then((data) => {
## Notification.getSlots
-getSlots(callback: AsyncCallback>): void
+getSlots(callback: AsyncCallback\>): void
Obtains all notification slots. This API uses an asynchronous callback to return the result.
@@ -596,7 +596,7 @@ Obtains all notification slots. This API uses an asynchronous callback to return
| Name | Type | Mandatory| Description |
| -------- | --------------------------------- | ---- | -------------------- |
-| callback | AsyncCallback\\> | Yes | Callback used to return the result.|
+| callback | AsyncCallback\> | Yes | Callback used to return the result.|
**Example**
@@ -1364,7 +1364,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
## Notification.getSlotsByBundle
-getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback>): void
+getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\>): void
Obtains the notification slots of a specified application. This API uses an asynchronous callback to return the result.
@@ -1379,7 +1379,7 @@ Obtains the notification slots of a specified application. This API uses an asyn
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------- | ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. |
-| callback | AsyncCallback> | Yes | Callback used to return the result.|
+| callback | AsyncCallback\> | Yes | Callback used to return the result.|
**Example**
@@ -1401,7 +1401,7 @@ Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
## Notification.getSlotsByBundle
-getSlotsByBundle(bundle: BundleOption): Promise>
+getSlotsByBundle(bundle: BundleOption): Promise\>
Obtains the notification slots of a specified application. This API uses a promise to return the result.
@@ -1421,7 +1421,7 @@ Obtains the notification slots of a specified application. This API uses a promi
| Type | Description |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
-| Promise> | Promise used to return the result.|
+| Promise\> | Promise used to return the result.|
**Example**
@@ -1823,7 +1823,7 @@ Notification.removeAll(userId).then(() => {
## Notification.getAllActiveNotifications
-getAllActiveNotifications(callback: AsyncCallback>): void
+getAllActiveNotifications(callback: AsyncCallback\>): void
Obtains all active notifications. This API uses an asynchronous callback to return the result.
@@ -1837,7 +1837,7 @@ Obtains all active notifications. This API uses an asynchronous callback to retu
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------- |
-| callback | AsyncCallback> | Yes | Callback used to return the result.|
+| callback | AsyncCallback\> | Yes | Callback used to return the result.|
**Example**
@@ -1857,7 +1857,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
## Notification.getAllActiveNotifications
-getAllActiveNotifications(): Promise\\>
+getAllActiveNotifications(): Promise\>
Obtains all active notifications. This API uses a promise to return the result.
@@ -1871,7 +1871,7 @@ Obtains all active notifications. 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**
@@ -2903,476 +2903,6 @@ Notification.getDeviceRemindType().then((data) => {
});
```
-
-## Notification.publishAsBundle9+
-
-publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\): void
-
-Publishes an agent-powered notification. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------------------- | ------------------------------------------- | ---- | ---------------------------------------- |
-| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
-| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. |
-| userId | number | Yes | User ID. |
-| callback | AsyncCallback | Yes | Callback used to return the result. |
-
-**Example**
-
-```js
-// publishAsBundle callback
-function callback(err) {
- if (err.code) {
- console.info("publishAsBundle failed " + JSON.stringify(err));
- } else {
- console.info("publishAsBundle success");
- }
-}
-// Bundle name of the application whose notification function is taken over by the reminder agent
-let representativeBundle = "com.example.demo";
-// User ID
-let userId = 100;
-// NotificationRequest object
-let request = {
- id: 1,
- content: {
- contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
- normal: {
- title: "test_title",
- text: "test_text",
- additionalText: "test_additionalText"
- }
- }
-};
-
-Notification.publishAsBundle(request, representativeBundle, userId, callback);
-```
-
-## Notification.publishAsBundle9+
-
-publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise\
-
-Publishes a notification through the reminder agent. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-
-| Name | Type | Mandatory| Description |
-| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
-| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
-| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. |
-| userId | number | Yes | User ID. |
-
-**Example**
-
-```js
-// Bundle name of the application whose notification function is taken over by the reminder agent
-let representativeBundle = "com.example.demo";
-// User ID
-let userId = 100;
-// NotificationRequest object
-let request = {
- id: 1,
- content: {
- contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
- normal: {
- title: "test_title",
- text: "test_text",
- additionalText: "test_additionalText"
- }
- }
-};
-
-Notification.publishAsBundle(request, representativeBundle, userId).then(() => {
- console.info("publishAsBundle success");
-});
-```
-
-## Notification.cancelAsBundle9+
-
-cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback\): void
-
-Cancels a notification published by the reminder agent. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------------------- | ------------- | ---- | ------------------------ |
-| id | number | Yes | Notification ID. |
-| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. |
-| userId | number | Yes | User ID. |
-| callback | AsyncCallback | Yes | Callback used to return the result.|
-
-**Example**
-
-```js
-// cancelAsBundle
-function cancelAsBundleCallback(err) {
- if (err.code) {
- console.info("cancelAsBundle failed " + JSON.stringify(err));
- } else {
- console.info("cancelAsBundle success");
- }
-}
-// Bundle name of the application whose notification function is taken over by the reminder agent
-let representativeBundle = "com.example.demo";
-// User ID
-let userId = 100;
-
-Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback);
-```
-
-## Notification.cancelAsBundle9+
-
-cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\
-
-Cancels a notification published by the reminder agent. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------------------- | ------ | ---- | ------------------ |
-| id | number | Yes | Notification ID. |
-| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent.|
-| userId | number | Yes | User ID.|
-
-**Example**
-
-```js
-// Bundle name of the application whose notification function is taken over by the reminder agent
-let representativeBundle = "com.example.demo";
-// User ID
-let userId = 100;
-
-Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
- console.info("cancelAsBundle success");
-});
-```
-
-## Notification.enableNotificationSlot 9+
-
-enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\): void
-
-Sets the enabled status of a notification slot type for a specified application. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------------- | ---- | ---------------------- |
-| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. |
-| type | [SlotType](#slottype) | Yes | Notification slot type. |
-| enable | boolean | Yes | Whether to enable notification. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```js
-// enableNotificationSlot
-function enableSlotCallback(err) {
- if (err.code) {
- console.info("enableNotificationSlot failed " + JSON.stringify(err));
- } else {
- console.info("enableNotificationSlot success");
- }
-};
-
-Notification.enableNotificationSlot(
- { bundle: "ohos.samples.notification", },
- Notification.SlotType.SOCIAL_COMMUNICATION,
- true,
- enableSlotCallback);
-```
-
-## Notification.enableNotificationSlot 9+
-
-enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\
-
-Sets the enabled status of a notification slot type for a specified application. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. |
-| type | [SlotType](#slottype) | Yes | Notification slot type.|
-| enable | boolean | Yes | Whether to enable notification. |
-
-**Example**
-
-```js
-// enableNotificationSlot
-Notification.enableNotificationSlot({ bundle: "ohos.samples.notification", },
- Notification.SlotType.SOCIAL_COMMUNICATION,true).then(() => {
- console.info("enableNotificationSlot success");
-});
-```
-
-## Notification.isNotificationSlotEnabled 9+
-
-isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\): void
-
-Checks whether a specified notification slot type is enabled for a specified application. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name | Type | Mandatory| Description |
-| -------- | ----------------------------- | ---- | ---------------------- |
-| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. |
-| type | [SlotType](#slottype) | Yes | Notification slot type. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```js
-// isNotificationSlotEnabled
-function getEnableSlotCallback(err, data) {
- if (err.code) {
- console.info("isNotificationSlotEnabled failed " + JSON.stringify(err));
- } else {
- console.info("isNotificationSlotEnabled success");
- }
-};
-
-Notification.isNotificationSlotEnabled(
- { bundle: "ohos.samples.notification", },
- Notification.SlotType.SOCIAL_COMMUNICATION,
- getEnableSlotCallback);
-```
-
-## Notification.isNotificationSlotEnabled 9+
-
-isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\
-
-Checks whether a specified notification slot type is enabled for a specified application. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. |
-| type | [SlotType](#slottype) | Yes | Notification slot type.|
-
-**Return value**
-
-| Type | Description |
-| ------------------ | ------------------------------- |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```js
-// isNotificationSlotEnabled
-Notification.isNotificationSlotEnabled({ bundle: "ohos.samples.notification", },
- Notification.SlotType.SOCIAL_COMMUNICATION).then((data) => {
- console.info("isNotificationSlotEnabled success, data: " + JSON.stringify(data));
-});
-```
-
-
-## Notification.setSyncNotificationEnabledWithoutApp9+
-
-setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: AsyncCallback\): void
-
-Sets whether to enable the notification sync feature for devices where the application is not installed. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| userId | number | Yes | User ID. |
-| enable | boolean | Yes | Whether the feature is enabled. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```js
-let userId = 100;
-let enable = true;
-
-function callback(err) {
- if (err.code) {
- console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err));
- } else {
- console.info("setSyncNotificationEnabledWithoutApp success");
- }
-}
-
-Notification.setSyncNotificationEnabledWithoutApp(userId, enable, callback);
-```
-
-
-## Notification.setSyncNotificationEnabledWithoutApp9+
-
-setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\
-
-Sets whether to enable the notification sync feature for devices where the application is not installed. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| userId | number | Yes | User ID. |
-| enable | boolean | Yes | Whether the feature is enabled. |
-
-**Return value**
-
-| Type | Description |
-| ----------------------------------------------------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```js
-let userId = 100;
-let enable = true;
-
-Notification.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
- console.info('setSyncNotificationEnabledWithoutApp success');
-}).catch((err) => {
- console.info('setSyncNotificationEnabledWithoutApp, err:' + JSON.stringify(err));
-});
-```
-
-
-## Notification.getSyncNotificationEnabledWithoutApp9+
-
-getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\): void
-
-Obtains whether the notification sync feature is enabled for devices where the application is not installed. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| userId | number | Yes | User ID. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
-
-**Example**
-
-```js
-let userId = 100;
-
-function getSyncNotificationEnabledWithoutAppCallback(err, data) {
- if (err) {
- console.info('getSyncNotificationEnabledWithoutAppCallback, err:' + err);
- } else {
- console.info('getSyncNotificationEnabledWithoutAppCallback, data:' + data);
- }
-}
-
-Notification.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEnabledWithoutAppCallback);
-```
-
-
-## Notification.getSyncNotificationEnabledWithoutApp9+
-
-getSyncNotificationEnabledWithoutApp(userId: number): Promise\
-
-Obtains whether the notification sync feature is enabled for devices where the application is not installed. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
-
-**Parameters**
-
-| Name| Type | Mandatory| Description |
-| ------ | ----------------------------- | ---- | -------------- |
-| userId | number | Yes | User ID. |
-
-**Return value**
-
-| Type | Description |
-| ------------------ | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the result.|
-
-**Example**
-
-```js
-let userId = 100;
-Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => {
- console.info('getSyncNotificationEnabledWithoutApp, data:' + data);
-}).catch((err) => {
- console.info('getSyncNotificationEnabledWithoutApp, err:' + err);
-});
-```
-
-
-
## NotificationSubscriber
Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribe).
@@ -4111,5 +3641,5 @@ Provides the notification user input.
| Name | Value | Description |
| -------------------- | --- | -------------------- |
-| CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. |
-| CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. |
+| CLICK_REASON_REMOVE9+ | 1 | The notification is removed after a click on it. |
+| CANCEL_REASON_REMOVE9+ | 2 | The notification is removed by the user. |
diff --git a/en/application-dev/reference/apis/js-apis-notificationManager.md b/en/application-dev/reference/apis/js-apis-notificationManager.md
index 875b6129d039e09172fa9a1e366bd48a813749fc..0c136cad2373439709255dea4e829b5d3ec1eb7c 100644
--- a/en/application-dev/reference/apis/js-apis-notificationManager.md
+++ b/en/application-dev/reference/apis/js-apis-notificationManager.md
@@ -33,7 +33,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -89,8 +88,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -145,8 +142,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -208,8 +203,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 201 | Permission denied. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -263,7 +256,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -306,7 +298,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -343,7 +334,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -379,7 +369,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -420,7 +409,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -460,9 +448,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -511,9 +496,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -553,7 +535,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -594,7 +575,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -634,9 +614,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -689,9 +666,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -735,7 +709,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -783,7 +756,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -801,7 +773,7 @@ Notification.getSlot(slotType).then((data) => {
## Notification.getSlots
-getSlots(callback: AsyncCallback>): void
+getSlots(callback: AsyncCallback\>): void
Obtains all notification slots of this application. This API uses an asynchronous callback to return the result.
@@ -819,7 +791,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -842,7 +813,7 @@ Notification.getSlots(getSlotsCallback);
## Notification.getSlots
-getSlots(): Promise\>
+getSlots(): Promise\>
Obtains all notification slots of this application. This API uses a promise to return the result.
@@ -860,7 +831,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -896,7 +866,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -938,7 +907,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -974,7 +942,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1008,7 +975,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1049,9 +1015,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1100,9 +1063,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1146,9 +1106,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1202,9 +1159,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1247,9 +1201,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1282,11 +1233,93 @@ Checks whether notification is enabled for the current application. This API use
**System API**: This is a system API and cannot be called by third-party applications.
+**Return value**
+
+| Type | Description |
+| ----------------------------------------------------------- | ------------------------------------------------------------ |
+| Promise\ | Promise used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
+
+| ID| Error Message |
+| -------- | ---------------------------------------- |
+| 1600001 | Internal error. |
+| 1600002 | Marshalling or unmarshalling error. |
+| 1600003 | Failed to connect service. |
+
+**Example**
+
+```ts
+notificationManager.isNotificationEnabled().then((data) => {
+ console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
+});
+```
+
+## notificationManager.isNotificationEnabled
+
+isNotificationEnabled(userId: number, callback: AsyncCallback\): void
+
+Checks whether notification is enabled for a specified user. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------- | ---- | ------------------------ |
+| userId | number | Yes | User ID.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+**Error codes**
+
+For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
+
+| ID| Error Message |
+| -------- | ----------------------------------- |
+| 1600001 | Internal error. |
+| 1600002 | Marshalling or unmarshalling error. |
+| 1600003 | Failed to connect service. |
+| 1600008 | The user is not exist. |
+
+**Example**
+
+```ts
+function isNotificationEnabledCallback(err, data) {
+ if (err) {
+ console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("isNotificationEnabled success");
+ }
+}
+
+let userId = 1;
+
+notificationManager.isNotificationEnabled(userId, isNotificationEnabledCallback);
+```
+
+## notificationManager.isNotificationEnabled
+
+isNotificationEnabled(userId: number): Promise\
+
+Checks whether notification is enabled for a specified user. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Notification.Notification
+
+**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
| Name | Type | Mandatory| Description |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.|
+| userId | number | Yes | User ID.|
**Return value**
@@ -1300,18 +1333,17 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
-| 17700001 | The specified bundle name was not found. |
+| 1600008 | The user is not exist.. |
**Example**
-```js
-Notification.isNotificationEnabled().then((data) => {
+```ts
+let userId = 1;
+
+notificationManager.isNotificationEnabled(userId).then((data) => {
console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
});
```
@@ -1344,9 +1376,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1395,9 +1424,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1441,9 +1467,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1497,9 +1520,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1542,9 +1562,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1598,9 +1615,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1624,7 +1638,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
## Notification.getSlotsByBundle
-getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback>): void
+getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\>): void
Obtains the notification slots of a specified application. This API uses an asynchronous callback to return the result.
@@ -1647,9 +1661,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1695,7 +1706,7 @@ Obtains the notification slots of a specified application. This API uses a promi
| Type | Description |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
-| Promise> | Promise used to return the result.|
+| Promise\> | Promise used to return the result.|
**Error codes**
@@ -1703,9 +1714,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1749,9 +1757,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1805,9 +1810,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1829,7 +1831,7 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
## Notification.getAllActiveNotifications
-getAllActiveNotifications(callback: AsyncCallback>): void
+getAllActiveNotifications(callback: AsyncCallback\>): void
Obtains all active notifications. This API uses an asynchronous callback to return the result.
@@ -1851,9 +1853,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1898,9 +1897,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1935,7 +1931,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1976,7 +1971,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -1993,7 +1987,7 @@ Notification.getActiveNotificationCount().then((data) => {
## Notification.getActiveNotifications
-getActiveNotifications(callback: AsyncCallback>): void
+getActiveNotifications(callback: AsyncCallback\>): void
Obtains active notifications of this application. This API uses an asynchronous callback to return the result.
@@ -2003,7 +1997,7 @@ Obtains active notifications of this application. This API uses an asynchronous
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
-| callback | AsyncCallback> | Yes | Callback used to return the result.|
+| callback | AsyncCallback\> | Yes | Callback used to return the result.|
**Error codes**
@@ -2011,7 +2005,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2052,7 +2045,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2088,7 +2080,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2104,7 +2095,7 @@ function cancelGroupCallback(err) {
}
}
-var groupName = "GroupName";
+let groupName = "GroupName";
Notification.cancelGroup(groupName, cancelGroupCallback);
```
@@ -2131,7 +2122,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2173,9 +2163,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2225,9 +2212,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2270,9 +2254,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2323,9 +2304,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2370,9 +2348,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2427,9 +2402,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2476,9 +2448,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2523,9 +2492,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2564,9 +2530,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2620,9 +2583,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2663,9 +2623,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2710,9 +2667,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2748,11 +2702,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
-| 1600011 | Read template config failed. |
**Example**
@@ -2797,11 +2749,9 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
-| 1600011 | Read template config failed. |
**Example**
@@ -2835,7 +2785,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2870,7 +2819,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2910,9 +2858,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2960,9 +2905,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -2999,7 +2941,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3041,7 +2982,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3083,9 +3023,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3139,9 +3076,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3187,9 +3121,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3246,9 +3177,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3292,9 +3220,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3339,9 +3264,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3382,9 +3304,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3451,9 +3370,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3516,9 +3432,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3572,9 +3485,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3621,9 +3531,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3674,9 +3581,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3720,9 +3624,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3777,9 +3678,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3822,9 +3720,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3879,9 +3774,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3926,9 +3818,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -3981,9 +3870,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
diff --git a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
index 4380c521dc82bf34771c17e238e4a7b56809276a..1ca931fa6f5671e6c7a9cdb4032910983745a516 100644
--- a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
+++ b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md
@@ -40,9 +40,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -95,9 +92,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -148,9 +142,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -196,9 +187,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -246,9 +234,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -294,9 +279,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -352,9 +334,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -371,7 +350,7 @@ let notificationKey = {
id: 0,
label: "label",
};
-let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
+let reason = notificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
notificationSubscribe.remove(bundle, notificationKey, reason).then(() => {
console.info("remove success");
});
@@ -393,7 +372,7 @@ Removes a specified notification. This API uses an asynchronous callback to retu
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | -------------------- |
-| hashCode | string | Yes | Unique notification ID. It is the value of **hashCode** in the [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) object of [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) in the [onConsume](#onconsume) callback. |
+| hashCode | string | Yes | Unique notification ID. It is the **hashCode** in the [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) object of [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) of the [onConsume](js-apis-notification.md#onconsume) callback.|
| reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
@@ -403,9 +382,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -423,7 +399,7 @@ function removeCallback(err) {
console.info("remove success");
}
}
-let reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
+let reason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
notificationSubscribe.remove(hashCode, reason, removeCallback);
```
@@ -452,9 +428,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -486,7 +459,7 @@ Removes all notifications for a specified application. This API uses an asynchro
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ---------------------------- |
-| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. |
+| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. |
| callback | AsyncCallback\ | Yes | Callback used to return the result.|
**Error codes**
@@ -495,9 +468,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -516,7 +486,7 @@ function removeAllCallback(err) {
let bundle = {
bundle: "bundleName1",
};
-NotificationSubscribe.removeAll(bundle, removeAllCallback);
+notificationSubscribe.removeAll(bundle, removeAllCallback);
```
## NotificationSubscribe.removeAll
@@ -543,9 +513,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -588,9 +555,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ---------------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -630,9 +594,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -678,9 +639,6 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| ID| Error Message |
| -------- | ----------------------------------- |
-| 201 | Permission denied. |
-| 202 | Not system application to call the interface. |
-| 401 | The parameter check failed. |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
@@ -702,319 +660,6 @@ let userId = 1;
notificationSubscribe.removeAll(userId, removeAllCallback);
```
-## NotificationSubscriber
-
-Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribesubscribe).
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-### onConsume
-
-onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void
-
-Called when a notification is received.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------------ | ------------------------ | ---- | -------------------------- |
-| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | Yes| Information about the notification received.|
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onConsumeCallback(data) {
- console.info('===> onConsume in test');
- let req = data.request;
- console.info('===> onConsume callback req.id:' + req.id);
-};
-
-let subscriber = {
- onConsume: onConsumeCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-### onCancel
-
-onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void
-
-Called when a notification is canceled.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------------ | ------------------------ | ---- | -------------------------- |
-| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | Yes| Information about the notification to cancel.|
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onCancelCallback(data) {
- console.info('===> onCancel in test');
- let req = data.request;
- console.info('===> onCancel callback req.id:' + req.id);
-}
-
-let subscriber = {
- onCancel: onCancelCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-### onUpdate
-
-onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void
-
-Called when the notification sorting list is updated.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------------ | ------------------------ | ---- | -------------------------- |
-| data | [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) | Yes| Latest notification sorting list.|
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onUpdateCallback(map) {
- console.info('===> onUpdateCallback map:' + JSON.stringify(map));
-}
-
-let subscriber = {
- onUpdate: onUpdateCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-### onConnect
-
-onConnect?:() => void
-
-Called when subscription is complete.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onConnectCallback() {
- console.info('===> onConnect in test');
-}
-
-let subscriber = {
- onConnect: onConnectCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-### onDisconnect
-
-onDisconnect?:() => void
-
-Called when unsubscription is complete.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-function unsubscribeCallback(err) {
- if (err.code) {
- console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("unsubscribeCallback");
- }
-};
-
-function onConnectCallback() {
- console.info('===> onConnect in test');
-}
-function onDisconnectCallback() {
- console.info('===> onDisconnect in test');
-}
-
-let subscriber = {
- onConnect: onConnectCallback,
- onDisconnect: onDisconnectCallback
-};
-
-// The onConnect callback is invoked when subscription to the notification is complete.
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-// The onDisconnect callback is invoked when unsubscription to the notification is complete.
-notificationSubscribe.unsubscribe(subscriber, unsubscribeCallback);
-```
-
-### onDestroy
-
-onDestroy?:() => void
-
-Callback for service disconnection.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onDestroyCallback() {
- console.info('===> onDestroy in test');
-}
-
-let subscriber = {
- onDestroy: onDestroyCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-### onDoNotDisturbDateChange
-
-onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notificationManager.md#donotdisturbdate)) => void
-
-Called when the DND time setting is updated.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------------ | ------------------------ | ---- | -------------------------- |
-| mode | notification.[DoNotDisturbDate](js-apis-notificationManager.md#DoNotDisturbDate) | Yes| DND time setting updates.|
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onDoNotDisturbDateChangeCallback(mode) {
- console.info('===> onDoNotDisturbDateChange:' + mode);
-}
-
-let subscriber = {
- onDoNotDisturbDateChange: onDoNotDisturbDateChangeCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
-
-### onEnabledNotificationChanged
-
-onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)) => void
-
-Listens for the notification enabled status changes. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.Notification.Notification
-
-**System API**: This is a system API and cannot be called by third-party applications.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ------------ | ------------------------ | ---- | -------------------------- |
-| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata8)\> | Yes| Callback used to return the result.|
-
-**Example**
-
-```javascript
-function subscribeCallback(err) {
- if (err) {
- console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
- } else {
- console.info("subscribeCallback");
- }
-};
-
-function onEnabledNotificationChangedCallback(callbackData) {
- console.info("bundle: ", callbackData.bundle);
- console.info("uid: ", callbackData.uid);
- console.info("enable: ", callbackData.enable);
-};
-
-let subscriber = {
- onEnabledNotificationChanged: onEnabledNotificationChangedCallback
-};
-
-notificationSubscribe.subscribe(subscriber, subscribeCallback);
-```
-
## RemoveReason
**System capability**: SystemCapability.Notification.Notification
diff --git a/en/application-dev/reference/apis/js-apis-request.md b/en/application-dev/reference/apis/js-apis-request.md
index 0751c7aa94c518f40ac1c5ae3e0d1fca6ccac62f..e6a48d95be3adc18f14ba168ca207c5eceea9e07 100644
--- a/en/application-dev/reference/apis/js-apis-request.md
+++ b/en/application-dev/reference/apis/js-apis-request.md
@@ -14,13 +14,6 @@ The **request** module provides applications with basic upload, download, and ba
import request from '@ohos.request';
```
-
-## Constraints
-
-Only HTTP requests are supported. HTTPS requests are not supported.
-
-The download server must support the HTTP HEAD method so that the size of the data to download can be obtained through **Content-length**. Otherwise, the download task fails. If this is the case, you can check the failure cause through [on('fail')7+](#onfail7).
-
## Constants
**Required permissions**: ohos.permission.INTERNET
@@ -36,7 +29,7 @@ You can set **networkType** in [DownloadConfig](#downloadconfig) to specify the
| NETWORK_WIFI | number | 0x00010000 | Whether download is allowed on a WLAN.|
### Download Error Codes
-The table below lists the error codes that may be returned by [on('fail')7+](#onfail7)/[off('fail')7+](#offfail7)/[getTaskInfo9+](#gettaskinfo9).
+The table below lists the values of **err** in the callback of [on('fail')7+](#onfail7) and the values of **failedReason** returned by [getTaskInfo9+](#gettaskinfo9).
| Name| Type| Value| Description|
| -------- | -------- | -------- | -------- |
@@ -54,7 +47,7 @@ The table below lists the error codes that may be returned by [on('fail')7+
### Causes of Download Pause
-The table below lists the causes of download pause that may be returned by [getTaskInfo9+](#gettaskinfo9).
+The table below lists the values of **pausedReason** returned by [getTaskInfo9+](#gettaskinfo9).
| Name| Type| Value| Description|
| -------- | -------- | -------- | -------- |
@@ -65,7 +58,7 @@ The table below lists the causes of download pause that may be returned by [getT
| PAUSED_UNKNOWN7+ | number | 4 | Download paused due to unknown reasons.|
### Download Task Status Codes
-The table below lists the download task status codes that may be returned by [getTaskInfo9+](#gettaskinfo9).
+The table below lists the values of **status** returned by [getTaskInfo9+](#gettaskinfo9).
| Name| Type| Value| Description|
| -------- | -------- | -------- | -------- |
@@ -105,7 +98,7 @@ For details about the error codes, see [Upload and Download Error Codes](../erro
| ID| Error Message|
| -------- | -------- |
-| 13400002 | Bad file path. |
+| 13400002 | bad file path. |
**Example**
@@ -153,7 +146,7 @@ For details about the error codes, see [Upload and Download Error Codes](../erro
| ID| Error Message|
| -------- | -------- |
-| 13400002 | Bad file path. |
+| 13400002 | bad file path. |
**Example**
@@ -279,7 +272,7 @@ Implements file uploads. Before using any APIs of this class, you must obtain an
on(type: 'progress', callback:(uploadedSize: number, totalSize: number) => void): void
-Subscribes to an upload event. This API uses an asynchronous callback to return the result.
+Subscribes to upload progress events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -296,16 +289,16 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| uploadedSize | number | Yes| Size of the uploaded files, in bits. |
-| totalSize | number | Yes| Total size of the files to upload, in bits. |
+| uploadedSize | number | Yes| Size of the uploaded files, in bits.|
+| totalSize | number | Yes| Total size of the files to upload, in bits.|
**Example**
```js
- uploadTask.on('progress', function callback(uploadedSize, totalSize) {
+ let upProgressCallback = (uploadedSize, totalSize) => {
console.info("upload totalSize:" + totalSize + " uploadedSize:" + uploadedSize);
- }
- );
+ };
+ uploadTask.on('progress', upProgressCallback);
```
@@ -313,7 +306,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
on(type: 'headerReceive', callback: (header: object) => void): void
-Subscribes to an upload event. This API uses an asynchronous callback to return the result.
+Subscribes to HTTP header events for an upload task. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -335,10 +328,10 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
**Example**
```js
- uploadTask.on('headerReceive', function callback(headers){
+ let headerCallback = (headers) => {
console.info("upOnHeader headers:" + JSON.stringify(headers));
- }
- );
+ };
+ uploadTask.on('headerReceive', headerCallback);
```
@@ -346,7 +339,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
on(type:'complete' | 'fail', callback: Callback<Array<TaskState>>): void;
-Subscribes to an upload event. This API uses an asynchronous callback to return the result.
+Subscribes to upload completion or failure events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -368,19 +361,19 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
**Example**
```js
- uploadTask.on('complete', function callback(taskStates) {
+ let upCompleteCallback = (taskStates) => {
for (let i = 0; i < taskStates.length; i++ ) {
- console.info("upOnComplete taskState:" + JSON.stringify(taskStates[i]));
+ console.info("upOnComplete taskState:" + JSON.stringify(taskStates[i]));
}
- }
- );
+ };
+ uploadTask.on('complete', upCompleteCallback);
- uploadTask.on('fail', function callback(taskStates) {
+ let upFailCallback = (taskStates) => {
for (let i = 0; i < taskStates.length; i++ ) {
console.info("upOnFail taskState:" + JSON.stringify(taskStates[i]));
}
- }
- );
+ };
+ uploadTask.on('fail', upFailCallback);
```
@@ -388,7 +381,7 @@ Subscribes to an upload event. This API uses an asynchronous callback to return
off(type: 'progress', callback?: (uploadedSize: number, totalSize: number) => void): void
-Unsubscribes from an upload event. This API uses an asynchronous callback to return the result.
+Unsubscribes from upload progress events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -399,22 +392,15 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (upload progress).|
-| callback | function | No| Callback for the upload progress event.|
-
- Parameters of the callback function
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| uploadedSize | number | Yes| Size of the uploaded files, in bits. |
-| totalSize | number | Yes| Total size of the files to upload, in bits. |
+| callback | function | No| Callback used to return the result.
**uploadedSize**: size of the uploaded files, in bits.
**totalSize**: Total size of the files to upload, in bits. |
**Example**
```js
- uploadTask.off('progress', function callback(uploadedSize, totalSize) {
- console.info('uploadedSize: ' + uploadedSize, 'totalSize: ' + totalSize);
- }
- );
+ let upProgressCallback = (uploadedSize, totalSize) => {
+ console.info('Upload delete progress notification.' + 'totalSize:' + totalSize + 'uploadedSize:' + uploadedSize);
+ };
+ uploadTask.off('progress', upProgressCallback);
```
@@ -422,7 +408,7 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
off(type: 'headerReceive', callback?: (header: object) => void): void
-Unsubscribes from an upload event. This API uses an asynchronous callback to return the result.
+Unsubscribes from HTTP header events for an upload task. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -433,28 +419,22 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to unsubscribe from. The value is **'headerReceive'** (response header).|
-| callback | function | No| Callback for the HTTP Response Header event.|
-
- Parameters of the callback function
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| header | object | Yes| HTTP Response Header.|
+| callback | function | No| Callback used to return the result.
**header**: HTTP response header.|
**Example**
```js
- uploadTask.off('headerReceive', function callback(headers) {
- console.info("upOnHeader headers:" + JSON.stringify(headers));
- }
- );
+ let headerCallback = (header) => {
+ console.info(`Upload delete headerReceive notification. header: ${JSON.stringify(header)}`);
+ };
+ uploadTask.off('headerReceive', headerCallback);
```
### off('complete' | 'fail')9+
off(type:'complete' | 'fail', callback?: Callback<Array<TaskState>>): void;
-Unsubscribes from an upload event. This API uses an asynchronous callback to return the result.
+Unsubscribes from upload completion or failure events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -465,30 +445,26 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.|
-| callback | Callback<Array<TaskState>> | No| Callback used to return the result.|
-
- Parameters of the callback function
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| taskstates | Array<[TaskState](#taskstate9)> | Yes| Upload result.|
+| callback | Callback<Array<TaskState>> | No| Callback used to return the result.
**taskstates**: upload task result.|
**Example**
```js
- uploadTask.off('complete', function callback(taskStates) {
+ let upCompleteCallback = (taskStates) => {
+ console.info('Upload delete complete notification.');
for (let i = 0; i < taskStates.length; i++ ) {
- console.info("upOnComplete taskState:" + JSON.stringify(taskStates[i]));
+ console.info('taskState:' + JSON.stringify(taskStates[i]));
}
- }
- );
+ };
+ uploadTask.off('complete', upCompleteCallback);
- uploadTask.off('fail', function callback(taskStates) {
+ let upFailCallback = (taskStates) => {
+ console.info('Upload delete fail notification.');
for (let i = 0; i < taskStates.length; i++ ) {
- console.info("upOnFail taskState:" + JSON.stringify(taskStates[i]));
+ console.info('taskState:' + JSON.stringify(taskStates[i]));
}
- }
- );
+ };
+ uploadTask.off('fail', upFailCallback);
```
### delete9+
@@ -709,9 +685,9 @@ For details about the error codes, see [Upload and Download Error Codes](../erro
| ID| Error Message|
| -------- | -------- |
-| 13400001 | File operation error. |
-| 13400002 | Bad file path. |
-| 13400003 | Task manager service error. |
+| 13400001 | file operation error. |
+| 13400002 | bad file path. |
+| 13400003 | task manager service error. |
**Example**
@@ -753,9 +729,9 @@ For details about the error codes, see [Upload and Download Error Codes](../erro
| ID| Error Message|
| -------- | -------- |
-| 13400001 | File operation error. |
-| 13400002 | Bad file path. |
-| 13400003 | Task manager service error. |
+| 13400001 | file operation error. |
+| 13400002 | bad file path. |
+| 13400003 | task manager service error. |
**Example**
@@ -861,7 +837,7 @@ Implements file downloads.
on(type: 'progress', callback:(receivedSize: number, totalSize: number) => void): void
-Subscribes to a download event. This API uses an asynchronous callback to return the result.
+Subscribes to download progress events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -872,22 +848,22 @@ Subscribes to a download event. This API uses an asynchronous callback to return
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to subscribe to. The value is **'progress'** (download progress).|
-| callback | function | Yes| Callback for the download progress event.|
+| callback | function | Yes| Callback used to return the result.|
Parameters of the callback function
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| receivedSize | number | Yes| Size of the downloaded files, in bits.|
-| totalSize | number | Yes| Total size of the files to download, in bits.|
+| receivedSize | number | Yes| Size of the downloaded files, in bits. |
+| totalSize | number | Yes| Total size of the files to download, in bits. |
**Example**
```js
- downloadTask.on('progress', function download_callback(receivedSize, totalSize) {
+ let progresCallback = (receivedSize, totalSize) => {
console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
- }
- );
+ };
+ downloadTask.on('progress', progresCallback);
```
@@ -895,7 +871,7 @@ Subscribes to a download event. This API uses an asynchronous callback to return
off(type: 'progress', callback?: (receivedSize: number, totalSize: number) => void): void
-Unsubscribes from a download event. This API uses an asynchronous callback to return the result.
+Unsubscribes from download progress events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -906,22 +882,15 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to unsubscribe from. The value is **'progress'** (download progress).|
-| callback | function | No| Callback for the download progress event.|
-
- Parameters of the callback function
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| receivedSize | number | Yes| Size of the downloaded files, in bits.|
-| totalSize | number | Yes| Total size of the files to download, in bits.|
+| callback | function | No| Callback used to return the result.
**receivedSize**: size of the downloaded files.
**totalSize**: total size of the files to download.|
**Example**
```js
- downloadTask .off('progress', function download_callback(receivedSize, totalSize) {
- console.info("download receivedSize:" + receivedSize + " totalSize:" + totalSize);
- }
- );
+ let progresCallback = (receivedSize, totalSize) => {
+ console.info('Download delete progress notification.' + 'receivedSize:' + receivedSize + 'totalSize:' + totalSize);
+ };
+ downloadTask.off('progress', progresCallback);
```
@@ -929,7 +898,7 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
on(type: 'complete'|'pause'|'remove', callback:() => void): void
-Subscribes to a download event. This API uses an asynchronous callback to return the result.
+Subscribes to download events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -945,10 +914,20 @@ Subscribes to a download event. This API uses an asynchronous callback to return
**Example**
```js
- downloadTask.on('complete', function callback() {
+ let completeCallback = () => {
console.info('Download task completed.');
- }
- );
+ };
+ downloadTask.on('complete', completeCallback);
+
+ let pauseCallback = () => {
+ console.info('Download task pause.');
+ };
+ downloadTask.on('pause', pauseCallback);
+
+ let removeCallback = () => {
+ console.info('Download task remove.');
+ };
+ downloadTask.on('remove', removeCallback);
```
@@ -956,7 +935,7 @@ Subscribes to a download event. This API uses an asynchronous callback to return
off(type: 'complete'|'pause'|'remove', callback?:() => void): void
-Unsubscribes from a download event. This API uses an asynchronous callback to return the result.
+Unsubscribes from download events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -972,10 +951,20 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
**Example**
```js
- downloadTask.off('complete', function callback() {
- console.info('Download task completed.');
- }
- );
+ let completeCallback = () => {
+ console.info('Download delete complete notification.');
+ };
+ downloadTask.off('complete', completeCallback);
+
+ let pauseCallback = () => {
+ console.info('Download delete pause notification.');
+ };
+ downloadTask.off('pause', pauseCallback);
+
+ let removeCallback = () => {
+ console.info('Download delete remove notification.');
+ };
+ downloadTask.off('remove', removeCallback);
```
@@ -983,7 +972,7 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re
on(type: 'fail', callback: (err: number) => void): void
-Subscribes to the download task failure event. This API uses an asynchronous callback to return the result.
+Subscribes to download failure events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -1004,11 +993,11 @@ Subscribes to the download task failure event. This API uses an asynchronous cal
**Example**
- ```js
- downloadTask.on('fail', function callBack(err) {
+ ```js
+ let failCallback = (err) => {
console.info('Download task failed. Cause:' + err);
- }
- );
+ };
+ downloadTask.on('fail', failCallback);
```
@@ -1016,7 +1005,7 @@ Subscribes to the download task failure event. This API uses an asynchronous cal
off(type: 'fail', callback?: (err: number) => void): void
-Unsubscribes from the download task failure event. This API uses an asynchronous callback to return the result.
+Unsubscribes from download failure events. This API uses a callback to return the result synchronously.
**Required permissions**: ohos.permission.INTERNET
@@ -1027,21 +1016,15 @@ Unsubscribes from the download task failure event. This API uses an asynchronous
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Type of the event to unsubscribe from. The value is **'fail'** (download failure).|
-| callback | function | No| Callback for the download task failure event.|
-
- Parameters of the callback function
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| err | number | Yes| Error code of the download failure. For details about the error codes, see [Download Error Codes](#download-error-codes).|
+| callback | function | No| Callback used to return the result.
**err**: error code of the download failure. |
**Example**
```js
- downloadTask.off('fail', function callBack(err) {
- console.info('Download task failed. Cause:' + err);
- }
- );
+ let failCallback = (err) => {
+ console.info(`Download delete fail notification. err: ${err.message}`);
+ };
+ downloadTask.off('fail', failCallback);
```
### delete9+
@@ -1706,32 +1689,33 @@ Defines the download task configuration.
| -------- | -------- | -------- | -------- |
| url | string | Yes| Resource URL.|
| header | Object | No| HTTPS flag header to be included in the download request.
The **X-TLS-Version** parameter in **header** specifies the TLS version to be used. If this parameter is not set, the CURL_SSLVERSION_TLSv1_2 version is used. Available options are as follows:
CURL_SSLVERSION_TLSv1_0
CURL_SSLVERSION_TLSv1_1
CURL_SSLVERSION_TLSv1_2
CURL_SSLVERSION_TLSv1_3
The **X-Cipher-List** parameter in **header** specifies the cipher suite list to be used. If this parameter is not specified, the secure cipher suite list is used. Available options are as follows:
- The TLS 1.2 cipher suite list includes the following ciphers:
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256,TLS_DSS_RSA_WITH_AES_256_GCM_SHA384,
TLS_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_AES_128_GCM_SHA256,
TLS_DHE_PSK_WITH_AES_256_GCM_SHA384,TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256,
TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384,
TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_128_CCM,
TLS_DHE_RSA_WITH_AES_256_CCM,TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256,
TLS_PSK_WITH_AES_256_CCM,TLS_DHE_PSK_WITH_AES_128_CCM,
TLS_DHE_PSK_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_AES_128_CCM,
TLS_ECDHE_ECDSA_WITH_AES_256_CCM,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
- The TLS 1.3 cipher suite list includes the following ciphers:
TLS_AES_128_GCM_SHA256,TLS_AES_256_GCM_SHA384,TLS_CHACHA20_POLY1305_SHA256,TLS_AES_128_CCM_SHA256
- The TLS 1.3 cipher suite list adds the Chinese national cryptographic algorithm:
TLS_SM4_GCM_SM3,TLS_SM4_CCM_SM3 |
-| enableMetered | boolean | No| Whether download is allowed on a metered connection.
- **true**: allowed
- **false**: not allowed|
-| enableRoaming | boolean | No| Whether download is allowed on a roaming network.
- **true**: allowed
- **false**: not allowed|
+| enableMetered | boolean | No| Whether download is allowed on a metered connection. The default value is **false**. In general cases, a mobile data connection is metered, while a Wi-Fi connection is not.
- **true**: allowed
- **false**: not allowed|
+| enableRoaming | boolean | No| Whether download is allowed on a roaming network. The default value is **false**.
- **true**: allowed
- **false**: not allowed|
| description | string | No| Description of the download session.|
-| filePath7+ | string | No| Path where the downloaded file is stored.
- filePath:'/data/storage/el2/base/haps/entry/files/test.txt': Save the file to an absolute path.
- In the FA model, use [context](js-apis-inner-app-context.md#contextgetcachedir) to obtain the cache directory of the application, for example, **\${featureAbility.getContext().getFilesDir()}/test.txt\**, and store the file in this directory.
- In the stage model, use [AbilityContext](js-apis-inner-application-context.md) to obtain the file path, for example, **\${globalThis.abilityContext.tempDir}/test.txt\**, and store the file in this path.|
-| networkType | number | No| Network type allowed for download.
- NETWORK_MOBILE: 0x00000001
- NETWORK_WIFI: 0x00010000|
+| filePath7+ | string | No| Path where the downloaded file is stored.
- In the FA model, use [context](js-apis-inner-app-context.md#contextgetcachedir) to obtain the cache directory of the application, for example, **\${featureAbility.getContext().getFilesDir()}/test.txt\**, and store the file in this directory.
- In the stage model, use [AbilityContext](js-apis-inner-application-context.md) to obtain the file path, for example, **\${globalThis.abilityContext.tempDir}/test.txt\**, and store the file in this path.|
+| networkType | number | No| Network type allowed for download. The default value is **NETWORK_MOBILE and NETWORK_WIFI**.
- NETWORK_MOBILE: 0x00000001
- NETWORK_WIFI: 0x00010000|
| title | string | No| Download task name.|
-| background9+ | boolean | No| Whether to enable the background task notification. When this parameter is enabled, the download status is displayed in the notification panel.|
+| background9+ | boolean | No| Whether to enable background task notification so that the download status is displayed in the notification panel. The default value is false.|
## DownloadInfo7+
-Defines the download task information, which is the callback parameter of the [query(deprecated)](#querydeprecated-1) API.
+Defines the download task information, which is the callback parameter of the [getTaskInfo9+](#gettaskinfo9) API.
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.MiscServices.Download
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| downloadId | number | Yes| ID of the downloaded file.|
-| failedReason | number | No| Cause of the download failure. The value can be any constant in [Download Error Codes](#download-error-codes).|
-| fileName | string | Yes| Name of the downloaded file.|
-| filePath | string | Yes| URI of the saved file.|
-| pausedReason | number | No| Cause of download pause. The value can be any constant in [Causes of Download Pause](#causes-of-download-pause).|
-| status | number | Yes| Download task status code. The value can be any constant in [Download Task Status Codes](#download-task-status-codes).|
-| targetURI | string | Yes| URI of the downloaded file.|
-| downloadTitle | string | Yes| Download task name.|
-| downloadTotalBytes | number | Yes| Total size of the files to download, in bytes.|
-| description | string | Yes| Description of the file to download.|
-| downloadedBytes | number | Yes| Size of the files downloaded, in bytes.|
+| Name| Type|Mandatory| Description|
+| -------- | ------ |---------------- |
+| downloadId | number |Yes| ID of the download task.|
+| failedReason | number|Yes| Cause of the download failure. The value can be any constant in [Download Error Codes](#download-error-codes).|
+| fileName | string |Yes| Name of the downloaded file.|
+| filePath | string |Yes| URI of the saved file.|
+| pausedReason | number |Yes| Cause of download pause. The value can be any constant in [Causes of Download Pause](#causes-of-download-pause).|
+| status | number |Yes| Download task status code. The value can be any constant in [Download Task Status Codes](#download-task-status-codes).|
+| targetURI | string |Yes| URI of the downloaded file.|
+| downloadTitle | string |Yes| Name of the download task.|
+| downloadTotalBytes | number |Yes| Total size of the files to download, in bytes.|
+| description | string |Yes| Description of the download task.|
+| downloadedBytes | number |Yes| Size of the files downloaded, in bytes.|
+