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

Update docs (14289)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 459882dd
...@@ -44,6 +44,6 @@ For details about the APIs, see [@ohos.notificationManager](../reference/apis/js ...@@ -44,6 +44,6 @@ For details about the APIs, see [@ohos.notificationManager](../reference/apis/js
notificationManager.requestEnableNotification().then(() => { notificationManager.requestEnableNotification().then(() => {
console.info(`[ANS] requestEnableNotification success`); console.info(`[ANS] requestEnableNotification success`);
}).catch((err) => { }).catch((err) => {
console.error(`[ANS] requestEnableNotification failed, errCode[${err}]`); console.error(`[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -74,7 +74,7 @@ The major APIs for notification subscription are described as follows. For detai ...@@ -74,7 +74,7 @@ The major APIs for notification subscription are described as follows. For detai
```ts ```ts
notificationSubscribe.subscribe(subscriber, (err, data) => { // This API uses an asynchronous callback to return the result. notificationSubscribe.subscribe(subscriber, (err, data) => { // This API uses an asynchronous callback to return the result.
if (err) { if (err) {
console.error(`[ANS] failed to subscribe, error[${err}]`); console.error(`[ANS] subscribe failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] subscribeTest success : + ${data}`); console.info(`[ANS] subscribeTest success : + ${data}`);
......
...@@ -5,6 +5,7 @@ A [WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md) object encapsu ...@@ -5,6 +5,7 @@ A [WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md) object encapsu
Below you can see the process of adding a **WantAgent** object to a notification. The notification publisher requests a **WantAgent** object from the Ability Manager Service (AMS), and then sends a notification carrying the **WantAgent** object to the home screen. When the user touches the notification from the notification panel on the home screen, the **WantAgent** object is triggered. Below you can see the process of adding a **WantAgent** object to a notification. The notification publisher requests a **WantAgent** object from the Ability Manager Service (AMS), and then sends a notification carrying the **WantAgent** object to the home screen. When the user touches the notification from the notification panel on the home screen, the **WantAgent** object is triggered.
**Figure 1** Publishing a notification with a WantAgent object **Figure 1** Publishing a notification with a WantAgent object
![notification-with-wantagent](figures/notification-with-wantagent.png) ![notification-with-wantagent](figures/notification-with-wantagent.png)
...@@ -14,11 +15,11 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/ ...@@ -14,11 +15,11 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| getWantAgent(info: WantAgentInfo, callback: AsyncCallback&lt;WantAgent&gt;): void | Creates a **WantAgent** object.| |getWantAgent(info: WantAgentInfo, callback: AsyncCallback&lt;WantAgent&gt;): void | Creates a **WantAgent** object.|
| trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback&lt;CompleteData&gt;): void | Triggers a **WantAgent** object.| |trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback&lt;CompleteData&gt;): void | Triggers a **WantAgent** object.|
| cancel(agent: WantAgent, callback: AsyncCallback&lt;void&gt;): void | Cancels a **WantAgent** object.| |cancel(agent: WantAgent, callback: AsyncCallback&lt;void&gt;): void | Cancels a **WantAgent** object.|
| getWant(agent: WantAgent, callback: AsyncCallback&lt;Want&gt;): void | Obtains a **WantAgent** object.| |getWant(agent: WantAgent, callback: AsyncCallback&lt;Want&gt;): void | Obtains a **WantAgent** object.|
| equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether two **WantAgent** objects are equal. | |equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether two **WantAgent** objects are equal.|
## How to Develop ## How to Develop
...@@ -95,7 +96,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/ ...@@ -95,7 +96,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
```typescript ```typescript
// Create a NotificationRequest object. // Create a NotificationRequest object.
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: { normal: {
...@@ -111,7 +112,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/ ...@@ -111,7 +112,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success`); console.info(`[ANS] publish success`);
......
...@@ -5,12 +5,11 @@ The progress notification is a commonly used notification type, mainly used to d ...@@ -5,12 +5,11 @@ The progress notification is a commonly used notification type, mainly used to d
In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#notificationtemplate), which can only be of the progress type, **data** indicates custom template data. In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#notificationtemplate), which can only be of the progress type, **data** indicates custom template data.
## Available APIs ## Available APIs
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| isSupportTemplate(templateName: string, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether a specific template is supported. This API uses an asynchronous callback to return the result.<br>Only the progress-type template is supported.| | isSupportTemplate(templateName: string, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether a specific template is supported. This API uses an asynchronous callback to return the result. For details, see [isSupportTemplate()](../reference/apis/js-apis-notificationManager.md#notificationmanagerissupporttemplate).<br>Only the progress-type template is supported.|
## How to Develop ## How to Develop
...@@ -31,17 +30,18 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n ...@@ -31,17 +30,18 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n
let isSupportTpl: boolean = data; // The value **true** means that the template of the **downloadTemplate** type is supported; and false means the opposite. let isSupportTpl: boolean = data; // The value **true** means that the template of the **downloadTemplate** type is supported; and false means the opposite.
// ... // ...
}).catch((err) => { }).catch((err) => {
console.error(`[ANS] isSupportTemplate failed, error[${err}]`); console.error(`[ANS] isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
> **NOTE** > **NOTE**
> >
> Proceed with the step below only when the specified template is supported. > Proceed with the step below only when the specified template is supported.
4. Create a **NotificationRequest** object and publish a progress notification. 4. Create a **NotificationRequest** object and publish a progress notification.
```ts ```ts
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -61,7 +61,7 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n ...@@ -61,7 +61,7 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n
// Publish the notification. // Publish the notification.
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success `); console.info(`[ANS] publish success `);
......
...@@ -45,7 +45,7 @@ The following table describes the APIs for notification publishing. You specify ...@@ -45,7 +45,7 @@ The following table describes the APIs for notification publishing. You specify
- A normal text notification consists of the **title**, **text**, and **additionalText** parameters, of which **title** and **text** are mandatory. The value of these parameters contains less than 200 bytes. - A normal text notification consists of the **title**, **text**, and **additionalText** parameters, of which **title** and **text** are mandatory. The value of these parameters contains less than 200 bytes.
```ts ```ts
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // Basic notification contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // Basic notification
...@@ -59,10 +59,10 @@ The following table describes the APIs for notification publishing. You specify ...@@ -59,10 +59,10 @@ The following table describes the APIs for notification publishing. You specify
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success`); console.info(`[ANS] publish success.`);
}); });
``` ```
...@@ -71,7 +71,7 @@ The following table describes the APIs for notification publishing. You specify ...@@ -71,7 +71,7 @@ The following table describes the APIs for notification publishing. You specify
- In addition to the parameters in the normal text notification, the long text notification provides the **longText**, **briefText**, and **expandedTitle** parameters. The value of **longText** contains a maximum of 1024 bytes, while that of any other parameters contains less than 200 bytes. By default, a long-text notification looks in the same way as a normal text notification. When expanded, the notification displays the title and content specified in **expandedTitle** and **longText**, respectively. - In addition to the parameters in the normal text notification, the long text notification provides the **longText**, **briefText**, and **expandedTitle** parameters. The value of **longText** contains a maximum of 1024 bytes, while that of any other parameters contains less than 200 bytes. By default, a long-text notification looks in the same way as a normal text notification. When expanded, the notification displays the title and content specified in **expandedTitle** and **longText**, respectively.
```ts ```ts
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // Long-text notification contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, // Long-text notification
...@@ -89,10 +89,10 @@ The following table describes the APIs for notification publishing. You specify ...@@ -89,10 +89,10 @@ The following table describes the APIs for notification publishing. You specify
// Publish the notification. // Publish the notification.
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success`); console.info(`[ANS] publish success.`);
}); });
``` ```
...@@ -101,7 +101,7 @@ The following table describes the APIs for notification publishing. You specify ...@@ -101,7 +101,7 @@ The following table describes the APIs for notification publishing. You specify
- In addition to the parameters in the normal text notification, the multi-line text notification provides the **lines**, **briefText**, and **longTitle** parameters. The value of these parameters contains less than 200 bytes. By default, a multi-line notification looks in the same way as a normal text notification. When expanded, the notification displays the title and content specified in **longTitle** and **lines**, respectively. - In addition to the parameters in the normal text notification, the multi-line text notification provides the **lines**, **briefText**, and **longTitle** parameters. The value of these parameters contains less than 200 bytes. By default, a multi-line notification looks in the same way as a normal text notification. When expanded, the notification displays the title and content specified in **longTitle** and **lines**, respectively.
```ts ```ts
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // Multi-line text notification contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_MULTILINE, // Multi-line text notification
...@@ -118,7 +118,7 @@ The following table describes the APIs for notification publishing. You specify ...@@ -118,7 +118,7 @@ The following table describes the APIs for notification publishing. You specify
// Publish the notification. // Publish the notification.
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success`); console.info(`[ANS] publish success`);
...@@ -131,7 +131,7 @@ The following table describes the APIs for notification publishing. You specify ...@@ -131,7 +131,7 @@ The following table describes the APIs for notification publishing. You specify
```ts ```ts
let notificationPicture: PixelMap = undefined; // Obtain the pixel map information. let notificationPicture: PixelMap = undefined; // Obtain the pixel map information.
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
...@@ -149,10 +149,10 @@ The following table describes the APIs for notification publishing. You specify ...@@ -149,10 +149,10 @@ The following table describes the APIs for notification publishing. You specify
// Publish the notification. // Publish the notification.
notificationManager.publish(notificationRequest, (err) => { notificationManager.publish(notificationRequest, (err) => {
if (err) { if (err) {
console.error(`[ANS] failed to publish, error[${err}]`); console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return; return;
} }
console.info(`[ANS] publish success `); console.info(`[ANS] publish success.`);
}); });
``` ```
......
...@@ -13,12 +13,10 @@ This document gives an overview of the **app.json5** configuration file. To star ...@@ -13,12 +13,10 @@ This document gives an overview of the **app.json5** configuration file. To star
"icon": "$media:app_icon", "icon": "$media:app_icon",
"label": "$string:app_name", "label": "$string:app_name",
"description": "$string:description_application", "description": "$string:description_application",
"distributedNotificationEnabled": true,
"minAPIVersion": 9, "minAPIVersion": 9,
"targetAPIVersion": 9, "targetAPIVersion": 9,
"apiReleaseType": "Release", "apiReleaseType": "Release",
"debug": false, "debug": false,
"entityType": "media",
"car": { "car": {
"minAPIVersion": 8, "minAPIVersion": 8,
} }
...@@ -46,9 +44,8 @@ As shown above, the **app.json5** file contains several tags. ...@@ -46,9 +44,8 @@ As shown above, the **app.json5** file contains several tags.
| minAPIVersion | Minimum API version required for running the application.| Number| Yes (initial value: value of **compatibleSdkVersion** in **build-profile.json5**)| | minAPIVersion | Minimum API version required for running the application.| Number| Yes (initial value: value of **compatibleSdkVersion** in **build-profile.json5**)|
| targetAPIVersion | Target API version required for running the application.| Number| Yes (initial value: value of **compileSdkVersion** in **build-profile.json5**)| | targetAPIVersion | Target API version required for running the application.| Number| Yes (initial value: value of **compileSdkVersion** in **build-profile.json5**)|
| apiReleaseType | Type of the target API version required for running the application. The value can be **"CanaryN"**, **"BetaN"**, or **"Release"**, where **N** represents a positive integer.<br>- **Canary**: indicates a restricted release.<br>- **Beta**: indicates a publicly released beta version.<br>- **Release**: indicates a publicly released official version.<br>The value is set by DevEco Studio reading the stage of the SDK in use.| String| Yes (initial value: set by DevEco Studio)| | apiReleaseType | Type of the target API version required for running the application. The value can be **"CanaryN"**, **"BetaN"**, or **"Release"**, where **N** represents a positive integer.<br>- **Canary**: indicates a restricted release.<br>- **Beta**: indicates a publicly released beta version.<br>- **Release**: indicates a publicly released official version.<br>The value is set by DevEco Studio reading the stage of the SDK in use.| String| Yes (initial value: set by DevEco Studio)|
| distributedNotificationEnabled | Whether distributed notification is enabled for the application. When distributed notification is enabled and device A and device B where the application is installed are on the same distributed network, the devices behave in this way: If device A receives a message, device B will receive a distributed notification prompting the user to check the message received on device A.<br>- **true**: Distributed notification is enabled.<br>- **false**: Distributed notification is not enabled.| Boolean| Yes (initial value: **false**)| | multiProjects | Whether the application supports joint development of multiple projects.<br>- **true**: The application supports joint development of multiple projects.<br>- **false**: The application does not support joint development of multiple projects. For details about multi-project development, see [Multi-Project Build](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-building-overview-0000001263360495-V3#section71471033104216).| Boolean| Yes (initial value: **false**)|
| entityType | Type of the application. The options are as follows:<br>- game<br>- media<br>- communication<br>- news<br>- travel<br>- utility<br>- shopping<br>- education<br>- kids<br>- business<br>- photography<br>- unspecified| String| Yes (initial value: **"unspecified"**)| | assanEnabled | Whether to enable AddressSanitizer (ASan) to detect memory corruption issues such as buffer overflows.<br>- **true**: ASan is enabled.<br>- **false**: ASan is disabled. Note that ASan is not available in the Release version.| Boolean| Yes (initial value: **false**)|
| multiProjects | Whether the application supports joint development of multiple projects.<br>- **true**: The application supports joint development of multiple projects.<br>- **false**: The application does not support joint development of multiple projects.| Boolean| Yes (initial value: **false**)|
| tablet | Tablet-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on tablets, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| | tablet | Tablet-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on tablets, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)|
| tv | TV-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on TVs, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| | tv | TV-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on TVs, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)|
| wearable | Wearable-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on wearables, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| | wearable | Wearable-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.<br>When running on wearables, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)|
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data. The **CommonEvent** module provides common event capabilities, including the capabilities to publish, subscribe to, and unsubscribe from common events, as well obtaining and setting the common event result code and result data.
> **NOTE** > **NOTE**
>
> - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.commonEventManager](js-apis-commonEventManager.md). > - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.commonEventManager](js-apis-commonEventManager.md).
> >
> - 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. > - 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.
...@@ -43,7 +42,7 @@ Publishes a common event. This API uses an asynchronous callback to return the r ...@@ -43,7 +42,7 @@ Publishes a common event. This API uses an asynchronous callback to return the r
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}`);
} else { } else {
console.info("publish"); console.info("publish");
} }
...@@ -85,7 +84,7 @@ let options = { ...@@ -85,7 +84,7 @@ let options = {
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}`);
} else { } else {
console.info("publish"); console.info("publish");
} }
...@@ -121,7 +120,7 @@ Publishes a common event to a specific user. This API uses an asynchronous callb ...@@ -121,7 +120,7 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}`);
} else { } else {
console.info("publishAsUser"); console.info("publishAsUser");
} }
...@@ -161,14 +160,14 @@ Publishes a common event with given attributes to a specific user. This API uses ...@@ -161,14 +160,14 @@ Publishes a common event with given attributes to a specific user. This API uses
```ts ```ts
// Attributes of a common event. // Attributes of a common event.
let options = { let options = {
code: 0, // Initial code of the common event. code: 0, // Result code of the common event.
data: "initial data";// Initial data of the common event. data: "initial data",// Result data of the common event.
} }
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err.code) { if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}`);
} else { } else {
console.info("publishAsUser"); console.info("publishAsUser");
} }
...@@ -212,7 +211,7 @@ let subscribeInfo = { ...@@ -212,7 +211,7 @@ let subscribeInfo = {
// Callback for subscriber creation. // Callback for subscriber creation.
function createCB(err, commonEventSubscriber) { function createCB(err, commonEventSubscriber) {
if (err.code) { if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}`);
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
...@@ -259,7 +258,7 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => { ...@@ -259,7 +258,7 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
}).catch((err) => { }).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}`);
}); });
``` ```
...@@ -293,7 +292,7 @@ let subscribeInfo = { ...@@ -293,7 +292,7 @@ let subscribeInfo = {
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCB(err, data) { function subscribeCB(err, data) {
if (err.code) { if (err.code) {
console.error("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}`);
} else { } else {
console.info("subscribe " + JSON.stringify(data)); console.info("subscribe " + JSON.stringify(data));
} }
...@@ -302,7 +301,7 @@ function subscribeCB(err, data) { ...@@ -302,7 +301,7 @@ function subscribeCB(err, data) {
// Callback for subscriber creation. // Callback for subscriber creation.
function createCB(err, subscriber) { function createCB(err, subscriber) {
if (err.code) { if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}`);
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
// Subscribe to a common event. // Subscribe to a common event.
...@@ -344,7 +343,7 @@ let subscribeInfo = { ...@@ -344,7 +343,7 @@ let subscribeInfo = {
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCB(err, data) { function subscribeCB(err, data) {
if (err.code) { if (err.code) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}`);
} else { } else {
console.info("subscribe " + JSON.stringify(data)); console.info("subscribe " + JSON.stringify(data));
} }
...@@ -353,7 +352,7 @@ function subscribeCB(err, data) { ...@@ -353,7 +352,7 @@ function subscribeCB(err, data) {
// Callback for subscriber creation. // Callback for subscriber creation.
function createCB(err, commonEventSubscriber) { function createCB(err, commonEventSubscriber) {
if (err.code) { if (err.code) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}`);
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
...@@ -365,7 +364,7 @@ function createCB(err, commonEventSubscriber) { ...@@ -365,7 +364,7 @@ function createCB(err, commonEventSubscriber) {
// Callback for common event unsubscription. // Callback for common event unsubscription.
function unsubscribeCB(err) { function unsubscribeCB(err) {
if (err.code) { if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.error(`unsubscribe failed, code is ${err.code}`);
} else { } else {
console.info("unsubscribe"); console.info("unsubscribe");
} }
...@@ -404,7 +403,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -404,7 +403,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result code obtaining of an ordered common event. // Callback for result code obtaining of an ordered common event.
function getCodeCB(err, Code) { function getCodeCB(err, Code) {
if (err.code) { if (err.code) {
console.error("getCode failed " + JSON.stringify(err)); console.error(`getCode failed, code is ${err.code}`);
} else { } else {
console.info("getCode " + JSON.stringify(Code)); console.info("getCode " + JSON.stringify(Code));
} }
...@@ -436,7 +435,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -436,7 +435,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((code) => { subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code)); console.info("getCode " + JSON.stringify(code));
}).catch((err) => { }).catch((err) => {
console.error("getCode failed " + JSON.stringify(err)); console.error(`getCode failed, code is ${err.code}`);
}); });
``` ```
...@@ -465,7 +464,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -465,7 +464,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result code setting of an ordered common event. // Callback for result code setting of an ordered common event.
function setCodeCB(err) { function setCodeCB(err) {
if (err.code) { if (err.code) {
console.error("setCode failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}`);
} else { } else {
console.info("setCode"); console.info("setCode");
} }
...@@ -503,7 +502,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -503,7 +502,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => { subscriber.setCode(1).then(() => {
console.info("setCode"); console.info("setCode");
}).catch((err) => { }).catch((err) => {
console.error("setCode failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}`);
}); });
``` ```
...@@ -531,7 +530,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -531,7 +530,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result data obtaining of an ordered common event. // Callback for result data obtaining of an ordered common event.
function getDataCB(err, data) { function getDataCB(err, data) {
if (err.code) { if (err.code) {
console.error("getData failed " + JSON.stringify(err)); console.error(`getData failed, code is ${err.code}`);
} else { } else {
console.info("getData " + JSON.stringify(data)); console.info("getData " + JSON.stringify(data));
} }
...@@ -564,7 +563,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -564,7 +563,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getData().then((data) => { subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data)); console.info("getData " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error("getData failed " + JSON.stringify(err)); console.error(`getData failed, code is ${err.code}`);
}); });
``` ```
...@@ -593,7 +592,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -593,7 +592,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result data setting of an ordered common event // Callback for result data setting of an ordered common event
function setDataCB(err) { function setDataCB(err) {
if (err.code) { if (err.code) {
console.error("setData failed " + JSON.stringify(err)); console.error(`sendData failed, code is ${err.code}`);
} else { } else {
console.info("setData"); console.info("setData");
} }
...@@ -631,7 +630,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -631,7 +630,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => { subscriber.setData("publish_data_changed").then(() => {
console.info("setData"); console.info("setData");
}).catch((err) => { }).catch((err) => {
console.error("setData failed " + JSON.stringify(err)); console.error(`setData failed, code is ${err.code}`);
}); });
``` ```
...@@ -661,7 +660,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -661,7 +660,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result code and result data setting of an ordered common event. // Callback for result code and result data setting of an ordered common event.
function setCodeDataCB(err) { function setCodeDataCB(err) {
if (err.code) { if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err)); console.error(`setCodeAndData failed, code is ${err.code}`);
} else { } else {
console.info("setCodeDataCallback"); console.info("setCodeDataCallback");
} }
...@@ -701,7 +700,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -701,7 +700,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => { subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData"); console.info("setCodeAndData");
}).catch((err) => { }).catch((err) => {
console.info("setCodeAndData failed " + JSON.stringify(err)); console.error(`setCodeAndData failed, code is ${err.code}`);
}); });
``` ```
...@@ -729,7 +728,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -729,7 +728,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is an ordered one. // Callback for checking whether the current common event is an ordered one.
function isOrderedCB(err, isOrdered) { function isOrderedCB(err, isOrdered) {
if (err.code) { if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err)); console.error(`isOrderedCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
} }
...@@ -761,7 +760,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -761,7 +760,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => { subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => { }).catch((err) => {
console.error("isOrdered failed " + JSON.stringify(err)); console.error(`isOrderedCommonEvent failed, code is ${err.code}`);
}); });
``` ```
...@@ -789,7 +788,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -789,7 +788,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is a sticky one. // Callback for checking whether the current common event is a sticky one.
function isStickyCB(err, isSticky) { function isStickyCB(err, isSticky) {
if (err.code) { if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err)); console.error(`isStickyCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
} }
...@@ -821,7 +820,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -821,7 +820,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => { subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
}).catch((err) => { }).catch((err) => {
console.error("isSticky failed " + JSON.stringify(err)); console.error(`isSticky failed, code is ${err.code}`);
}); });
``` ```
...@@ -849,7 +848,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -849,7 +848,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for common event aborting. // Callback for common event aborting.
function abortCB(err) { function abortCB(err) {
if (err.code) { if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error(`abortCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
} }
...@@ -882,7 +881,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -882,7 +881,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => { subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error(`abortCommonEvent failed, code is ${err.code}`);
}); });
``` ```
...@@ -910,7 +909,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -910,7 +909,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for clearing the aborted state of the current common event. // Callback for clearing the aborted state of the current common event.
function clearAbortCB(err) { function clearAbortCB(err) {
if (err.code) { if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error(`clearAbortCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
} }
...@@ -943,7 +942,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -943,7 +942,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => { subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error(`clearAbortCommonEvent failed, code is ${err.code}`);
}); });
``` ```
...@@ -971,7 +970,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -971,7 +970,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is in the aborted state. // Callback for checking whether the current common event is in the aborted state.
function getAbortCB(err, abortEvent) { function getAbortCB(err, abortEvent) {
if (err.code) { if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error(`getAbortCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("abortEvent " + abortEvent) console.info("abortEvent " + abortEvent)
} }
...@@ -1004,7 +1003,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1004,7 +1003,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((abortCommonEvent) => { subscriber.getAbortCommonEvent().then((abortCommonEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent)); console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent));
}).catch((err) => { }).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error(`getAbortCommonEvent failed, code is ${err.code}`);
}); });
``` ```
...@@ -1032,7 +1031,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1032,7 +1031,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for subscriber information obtaining. // Callback for subscriber information obtaining.
function getCB(err, subscribeInfo) { function getCB(err, subscribeInfo) {
if (err.code) { if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error(`getSubscribeInfo failed, code is ${err.code}`);
} else { } else {
console.info("SubscribeInfo " + JSON.stringify(subscribeInfo)); console.info("SubscribeInfo " + JSON.stringify(subscribeInfo));
} }
...@@ -1065,7 +1064,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1065,7 +1064,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((subscribeInfo) => { subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => { }).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error(`getSubscribeInfo failed, code is ${err.code}`);
}); });
``` ```
...@@ -1093,7 +1092,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1093,7 +1092,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for ordered common event finishing. // Callback for ordered common event finishing.
function finishCB(err) { function finishCB(err) {
if (err.code) { if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error(`finishCommonEvent failed, code is ${err.code}`);
} else { } else {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
} }
...@@ -1126,7 +1125,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1126,7 +1125,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => { subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error(`finishCommonEvent failed, code is ${err.code}`);
}); });
``` ```
......
...@@ -45,7 +45,7 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco ...@@ -45,7 +45,7 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publish"); console.info("publish");
} }
...@@ -55,7 +55,7 @@ function publishCB(err) { ...@@ -55,7 +55,7 @@ function publishCB(err) {
try { try {
CommonEventManager.publish("event", publishCB); CommonEventManager.publish("event", publishCB);
} catch(err) { } catch(err) {
console.error('publish failed, catch error' + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -94,7 +94,7 @@ let options = { ...@@ -94,7 +94,7 @@ let options = {
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publish"); console.info("publish");
} }
...@@ -104,7 +104,7 @@ function publishCB(err) { ...@@ -104,7 +104,7 @@ function publishCB(err) {
try { try {
CommonEventManager.publish("event", options, publishCB); CommonEventManager.publish("event", options, publishCB);
} catch (err) { } catch (err) {
console.error('publish failed, catch error' + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -138,7 +138,7 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco ...@@ -138,7 +138,7 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco
// Callback for common event publication // Callback for common event publication
function publishCB(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publishAsUser"); console.info("publishAsUser");
} }
...@@ -151,7 +151,7 @@ let userId = 100; ...@@ -151,7 +151,7 @@ let userId = 100;
try { try {
CommonEventManager.publishAsUser("event", userId, publishCB); CommonEventManager.publishAsUser("event", userId, publishCB);
} catch (err) { } catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -193,7 +193,7 @@ let options = { ...@@ -193,7 +193,7 @@ let options = {
// Callback for common event publication. // Callback for common event publication.
function publishCB(err) { function publishCB(err) {
if (err) { if (err) {
console.error("publishAsUser failed " + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publishAsUser"); console.info("publishAsUser");
} }
...@@ -206,7 +206,7 @@ let userId = 100; ...@@ -206,7 +206,7 @@ let userId = 100;
try { try {
CommonEventManager.publishAsUser("event", userId, options, publishCB); CommonEventManager.publishAsUser("event", userId, options, publishCB);
} catch (err) { } catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err)); console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -244,7 +244,7 @@ function createCB(err, commonEventSubscriber) { ...@@ -244,7 +244,7 @@ function createCB(err, commonEventSubscriber) {
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
} else { } else {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} }
} }
...@@ -252,7 +252,7 @@ function createCB(err, commonEventSubscriber) { ...@@ -252,7 +252,7 @@ function createCB(err, commonEventSubscriber) {
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createCB); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -292,7 +292,7 @@ CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber) ...@@ -292,7 +292,7 @@ CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber)
console.info("createSubscriber"); console.info("createSubscriber");
subscriber = commonEventSubscriber; subscriber = commonEventSubscriber;
}).catch((err) => { }).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -328,7 +328,7 @@ let subscribeInfo = { ...@@ -328,7 +328,7 @@ let subscribeInfo = {
// Callback for common event subscription. // Callback for common event subscription.
function SubscribeCB(err, data) { function SubscribeCB(err, data) {
if (err.code) { if (err.code) {
console.error("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribe "); console.info("subscribe ");
} }
...@@ -342,10 +342,10 @@ function createCB(err, subscriber) { ...@@ -342,10 +342,10 @@ function createCB(err, subscriber) {
try { try {
CommonEventManager.subscribe(subscriber, SubscribeCB); CommonEventManager.subscribe(subscriber, SubscribeCB);
} catch (err) { } catch (err) {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} }
} else { } else {
console.error("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} }
} }
...@@ -353,7 +353,7 @@ function createCB(err, subscriber) { ...@@ -353,7 +353,7 @@ function createCB(err, subscriber) {
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createCB); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -385,7 +385,7 @@ let subscribeInfo = { ...@@ -385,7 +385,7 @@ let subscribeInfo = {
// Callback for common event subscription. // Callback for common event subscription.
function subscribeCB(err, data) { function subscribeCB(err, data) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribe"); console.info("subscribe");
} }
...@@ -393,21 +393,21 @@ function subscribeCB(err, data) { ...@@ -393,21 +393,21 @@ function subscribeCB(err, data) {
// Callback for subscriber creation. // Callback for subscriber creation.
function createCB(err, subscriber) { function createCB(err, subscriber) {
if (err) { if (err) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("createSubscriber"); console.info("createSubscriber");
// Subscribe to a common event. // Subscribe to a common event.
try { try {
CommonEventManager.subscribe(subscriber, subscribeCB); CommonEventManager.subscribe(subscriber, subscribeCB);
} catch(err) { } catch(err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} }
} }
} }
// Callback for common event unsubscription. // Callback for common event unsubscription.
function unsubscribeCB(err) { function unsubscribeCB(err) {
if (err) { if (err) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("unsubscribe"); console.info("unsubscribe");
} }
...@@ -416,14 +416,14 @@ function unsubscribeCB(err) { ...@@ -416,14 +416,14 @@ function unsubscribeCB(err) {
try { try {
CommonEventManager.createSubscriber(subscribeInfo, createCB); CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) { } catch (err) {
console.info("createSubscriber failed " + JSON.stringify(err)); console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} }
// Unsubscribe from the common event. // Unsubscribe from the common event.
try { try {
CommonEventManager.unsubscribe(subscriber, unsubscribeCB); CommonEventManager.unsubscribe(subscriber, unsubscribeCB);
} catch (err) { } catch (err) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -453,7 +453,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -453,7 +453,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for code obtaining of an ordered common event. // Callback for code obtaining of an ordered common event.
function getCodeCB(err, code) { function getCodeCB(err, code) {
if (err.code) { if (err.code) {
console.error("getCode failed " + JSON.stringify(err)); console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getCode " + JSON.stringify(code)); console.info("getCode " + JSON.stringify(code));
} }
...@@ -485,7 +485,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -485,7 +485,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((code) => { subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code)); console.info("getCode " + JSON.stringify(code));
}).catch((err) => { }).catch((err) => {
console.error("getCode failed " + JSON.stringify(err)); console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -514,7 +514,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -514,7 +514,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for code setting of an ordered common event. // Callback for code setting of an ordered common event.
function setCodeCB(err) { function setCodeCB(err) {
if (err.code) { if (err.code) {
console.error("setCode failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setCode"); console.info("setCode");
} }
...@@ -552,7 +552,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -552,7 +552,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => { subscriber.setCode(1).then(() => {
console.info("setCode"); console.info("setCode");
}).catch((err) => { }).catch((err) => {
console.error("setCode failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -580,7 +580,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -580,7 +580,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for data obtaining of an ordered common event. // Callback for data obtaining of an ordered common event.
function getDataCB(err, data) { function getDataCB(err, data) {
if (err.code) { if (err.code) {
console.error("getData failed " + JSON.stringify(err)); console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getData " + JSON.stringify(data)); console.info("getData " + JSON.stringify(data));
} }
...@@ -612,7 +612,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -612,7 +612,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getData().then((data) => { subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data)); console.info("getData " + JSON.stringify(data));
}).catch((err) => { }).catch((err) => {
console.error("getData failed " + JSON.stringify(err)); console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -639,7 +639,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -639,7 +639,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result data setting of an ordered common event // Callback for result data setting of an ordered common event
function setDataCB(err) { function setDataCB(err) {
if (err.code) { if (err.code) {
console.error("setData failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setData"); console.info("setData");
} }
...@@ -677,7 +677,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -677,7 +677,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => { subscriber.setData("publish_data_changed").then(() => {
console.info("setData"); console.info("setData");
}).catch((err) => { }).catch((err) => {
console.error("setData failed " + JSON.stringify(err)); console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -707,7 +707,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -707,7 +707,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for code and data setting of an ordered common event. // Callback for code and data setting of an ordered common event.
function setCodeDataCB(err) { function setCodeDataCB(err) {
if (err.code) { if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err)); console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setCodeDataCallback"); console.info("setCodeDataCallback");
} }
...@@ -746,7 +746,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -746,7 +746,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => { subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData"); console.info("setCodeAndData");
}).catch((err) => { }).catch((err) => {
console.info("setCodeAndData failed " + JSON.stringify(err)); console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -774,7 +774,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -774,7 +774,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is an ordered one. // Callback for checking whether the current common event is an ordered one.
function isOrderedCB(err, isOrdered) { function isOrderedCB(err, isOrdered) {
if (err.code) { if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err)); console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
} }
...@@ -790,7 +790,7 @@ isOrderedCommonEvent(): Promise<boolean> ...@@ -790,7 +790,7 @@ isOrderedCommonEvent(): Promise<boolean>
Checks whether this common event is an ordered one. This API uses a promise to return the result. Checks whether this common event is an ordered one. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.CommonEvent **System capability**: SystemCapability.Notification.CommonEvent
**Return value** **Return value**
...@@ -806,7 +806,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -806,7 +806,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => { subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered)); console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => { }).catch((err) => {
console.error("isOrdered failed " + JSON.stringify(err)); console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -834,7 +834,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -834,7 +834,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is a sticky one. // Callback for checking whether the current common event is a sticky one.
function isStickyCB(err, isSticky) { function isStickyCB(err, isSticky) {
if (err.code) { if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err)); console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
} }
...@@ -866,7 +866,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -866,7 +866,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => { subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky)); console.info("isSticky " + JSON.stringify(isSticky));
}).catch((err) => { }).catch((err) => {
console.error("isSticky failed " + JSON.stringify(err)); console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -894,7 +894,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -894,7 +894,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for common event aborting. // Callback for common event aborting.
function abortCB(err) { function abortCB(err) {
if (err.code) { if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
} }
...@@ -926,7 +926,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -926,7 +926,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => { subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent"); console.info("abortCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("abortCommonEvent failed " + JSON.stringify(err)); console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -954,7 +954,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -954,7 +954,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for clearing the aborted state of the current common event. // Callback for clearing the aborted state of the current common event.
function clearAbortCB(err) { function clearAbortCB(err) {
if (err.code) { if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
} }
...@@ -986,7 +986,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -986,7 +986,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => { subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent"); console.info("clearAbortCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err)); console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -1014,7 +1014,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1014,7 +1014,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is in the aborted state. // Callback for checking whether the current common event is in the aborted state.
function getAbortCB(err, abortEvent) { function getAbortCB(err, abortEvent) {
if (err.code) { if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("abortCommonEvent " + abortEvent) console.info("abortCommonEvent " + abortEvent)
} }
...@@ -1046,7 +1046,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1046,7 +1046,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((abortEvent) => { subscriber.getAbortCommonEvent().then((abortEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortEvent)); console.info("abortCommonEvent " + JSON.stringify(abortEvent));
}).catch((err) => { }).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err)); console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -1074,7 +1074,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1074,7 +1074,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for subscriber information obtaining. // Callback for subscriber information obtaining.
function getCB(err, subscribeInfo) { function getCB(err, subscribeInfo) {
if (err.code) { if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
} }
...@@ -1106,7 +1106,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1106,7 +1106,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((subscribeInfo) => { subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => { }).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err)); console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -1134,11 +1134,11 @@ let subscriber; // Subscriber object successfully created. ...@@ -1134,11 +1134,11 @@ let subscriber; // Subscriber object successfully created.
// Callback for ordered common event finishing. // Callback for ordered common event finishing.
function finishCB(err) { function finishCB(err) {
if (err.code) { if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
} }
}
subscriber.finishCommonEvent(finishCB); subscriber.finishCommonEvent(finishCB);
``` ```
...@@ -1166,7 +1166,7 @@ let subscriber; // Subscriber object successfully created. ...@@ -1166,7 +1166,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => { subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent"); console.info("FinishCommonEvent");
}).catch((err) => { }).catch((err) => {
console.error("finishCommonEvent failed " + JSON.stringify(err)); console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
......
...@@ -35,7 +35,7 @@ Publishes a notification. This API uses an asynchronous callback to return the r ...@@ -35,7 +35,7 @@ Publishes a notification. This API uses an asynchronous callback to return the r
// publish callback // publish callback
function publishCallback(err) { function publishCallback(err) {
if (err.code) { if (err.code) {
console.info("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}`);
} else { } else {
console.info("publish success"); console.info("publish success");
} }
...@@ -55,8 +55,6 @@ let notificationRequest = { ...@@ -55,8 +55,6 @@ let notificationRequest = {
Notification.publish(notificationRequest, publishCallback); Notification.publish(notificationRequest, publishCallback);
``` ```
## Notification.publish ## Notification.publish
publish(request: NotificationRequest): Promise\<void\> publish(request: NotificationRequest): Promise\<void\>
...@@ -118,7 +116,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call ...@@ -118,7 +116,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call
// publish callback // publish callback
function publishCallback(err) { function publishCallback(err) {
if (err.code) { if (err.code) {
console.info("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}`);
} else { } else {
console.info("publish success"); console.info("publish success");
} }
...@@ -298,8 +296,6 @@ function cancelAllCallback(err) { ...@@ -298,8 +296,6 @@ function cancelAllCallback(err) {
Notification.cancelAll(cancelAllCallback); Notification.cancelAll(cancelAllCallback);
``` ```
## Notification.cancelAll ## Notification.cancelAll
cancelAll(): Promise\<void\> cancelAll(): Promise\<void\>
...@@ -316,8 +312,6 @@ Notification.cancelAll().then(() => { ...@@ -316,8 +312,6 @@ Notification.cancelAll().then(() => {
}); });
``` ```
## Notification.addSlot ## Notification.addSlot
addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
...@@ -355,8 +349,6 @@ let notificationSlot = { ...@@ -355,8 +349,6 @@ let notificationSlot = {
Notification.addSlot(notificationSlot, addSlotCallBack); Notification.addSlot(notificationSlot, addSlotCallBack);
``` ```
## Notification.addSlot ## Notification.addSlot
addSlot(slot: NotificationSlot): Promise\<void\> addSlot(slot: NotificationSlot): Promise\<void\>
...@@ -387,8 +379,6 @@ Notification.addSlot(notificationSlot).then(() => { ...@@ -387,8 +379,6 @@ Notification.addSlot(notificationSlot).then(() => {
}); });
``` ```
## Notification.addSlot ## Notification.addSlot
addSlot(type: SlotType, callback: AsyncCallback\<void\>): void addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
...@@ -418,8 +408,6 @@ function addSlotCallBack(err) { ...@@ -418,8 +408,6 @@ function addSlotCallBack(err) {
Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack); Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);
``` ```
## Notification.addSlot ## Notification.addSlot
addSlot(type: SlotType): Promise\<void\> addSlot(type: SlotType): Promise\<void\>
...@@ -442,8 +430,6 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => { ...@@ -442,8 +430,6 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
}); });
``` ```
## Notification.addSlots ## Notification.addSlots
addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): void addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): void
...@@ -485,8 +471,6 @@ notificationSlotArray[0] = notificationSlot; ...@@ -485,8 +471,6 @@ notificationSlotArray[0] = notificationSlot;
Notification.addSlots(notificationSlotArray, addSlotsCallBack); Notification.addSlots(notificationSlotArray, addSlotsCallBack);
``` ```
## Notification.addSlots ## Notification.addSlots
addSlots(slots: Array\<NotificationSlot\>): Promise\<void\> addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
...@@ -521,8 +505,6 @@ Notification.addSlots(notificationSlotArray).then(() => { ...@@ -521,8 +505,6 @@ Notification.addSlots(notificationSlotArray).then(() => {
}); });
``` ```
## Notification.getSlot ## Notification.getSlot
getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
...@@ -553,8 +535,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; ...@@ -553,8 +535,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.getSlot(slotType, getSlotCallback); Notification.getSlot(slotType, getSlotCallback);
``` ```
## Notification.getSlot ## Notification.getSlot
getSlot(slotType: SlotType): Promise\<NotificationSlot\> getSlot(slotType: SlotType): Promise\<NotificationSlot\>
...@@ -584,8 +564,6 @@ Notification.getSlot(slotType).then((data) => { ...@@ -584,8 +564,6 @@ Notification.getSlot(slotType).then((data) => {
}); });
``` ```
## Notification.getSlots ## Notification.getSlots
getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
...@@ -614,8 +592,6 @@ function getSlotsCallback(err, data) { ...@@ -614,8 +592,6 @@ function getSlotsCallback(err, data) {
Notification.getSlots(getSlotsCallback); Notification.getSlots(getSlotsCallback);
``` ```
## Notification.getSlots ## Notification.getSlots
getSlots(): Promise\<Array\<NotificationSlot\>> getSlots(): Promise\<Array\<NotificationSlot\>>
...@@ -638,8 +614,6 @@ Notification.getSlots().then((data) => { ...@@ -638,8 +614,6 @@ Notification.getSlots().then((data) => {
}); });
``` ```
## Notification.removeSlot ## Notification.removeSlot
removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
...@@ -670,8 +644,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; ...@@ -670,8 +644,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.removeSlot(slotType,removeSlotCallback); Notification.removeSlot(slotType,removeSlotCallback);
``` ```
## Notification.removeSlot ## Notification.removeSlot
removeSlot(slotType: SlotType): Promise\<void\> removeSlot(slotType: SlotType): Promise\<void\>
...@@ -695,8 +667,6 @@ Notification.removeSlot(slotType).then(() => { ...@@ -695,8 +667,6 @@ Notification.removeSlot(slotType).then(() => {
}); });
``` ```
## Notification.removeAllSlots ## Notification.removeAllSlots
removeAllSlots(callback: AsyncCallback\<void\>): void removeAllSlots(callback: AsyncCallback\<void\>): void
...@@ -724,8 +694,6 @@ function removeAllCallBack(err) { ...@@ -724,8 +694,6 @@ function removeAllCallBack(err) {
Notification.removeAllSlots(removeAllCallBack); Notification.removeAllSlots(removeAllCallBack);
``` ```
## Notification.removeAllSlots ## Notification.removeAllSlots
removeAllSlots(): Promise\<void\> removeAllSlots(): Promise\<void\>
...@@ -742,8 +710,6 @@ Notification.removeAllSlots().then(() => { ...@@ -742,8 +710,6 @@ Notification.removeAllSlots().then(() => {
}); });
``` ```
## Notification.subscribe ## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void\>): void subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void\>): void
...@@ -787,8 +753,6 @@ let info = { ...@@ -787,8 +753,6 @@ let info = {
Notification.subscribe(subscriber, info, subscribeCallback); Notification.subscribe(subscriber, info, subscribeCallback);
``` ```
## Notification.subscribe ## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void
...@@ -827,8 +791,6 @@ let subscriber = { ...@@ -827,8 +791,6 @@ let subscriber = {
Notification.subscribe(subscriber, subscribeCallback); Notification.subscribe(subscriber, subscribeCallback);
``` ```
## Notification.subscribe ## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void\> subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void\>
...@@ -862,8 +824,6 @@ Notification.subscribe(subscriber).then(() => { ...@@ -862,8 +824,6 @@ Notification.subscribe(subscriber).then(() => {
}); });
``` ```
## Notification.unsubscribe ## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void
...@@ -902,8 +862,6 @@ let subscriber = { ...@@ -902,8 +862,6 @@ let subscriber = {
Notification.unsubscribe(subscriber, unsubscribeCallback); Notification.unsubscribe(subscriber, unsubscribeCallback);
``` ```
## Notification.unsubscribe ## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber): Promise\<void\> unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
...@@ -936,8 +894,6 @@ Notification.unsubscribe(subscriber).then(() => { ...@@ -936,8 +894,6 @@ Notification.unsubscribe(subscriber).then(() => {
}); });
``` ```
## Notification.enableNotification ## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
...@@ -974,8 +930,6 @@ let bundle = { ...@@ -974,8 +930,6 @@ let bundle = {
Notification.enableNotification(bundle, false, enableNotificationCallback); Notification.enableNotification(bundle, false, enableNotificationCallback);
``` ```
## Notification.enableNotification ## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\> enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\>
...@@ -1006,8 +960,6 @@ Notification.enableNotification(bundle, false).then(() => { ...@@ -1006,8 +960,6 @@ Notification.enableNotification(bundle, false).then(() => {
}); });
``` ```
## Notification.isNotificationEnabled ## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
...@@ -1043,8 +995,6 @@ let bundle = { ...@@ -1043,8 +995,6 @@ let bundle = {
Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback); Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
``` ```
## Notification.isNotificationEnabled ## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption): Promise\<boolean\> isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
...@@ -1080,8 +1030,6 @@ Notification.isNotificationEnabled(bundle).then((data) => { ...@@ -1080,8 +1030,6 @@ Notification.isNotificationEnabled(bundle).then((data) => {
}); });
``` ```
## Notification.isNotificationEnabled ## Notification.isNotificationEnabled
isNotificationEnabled(callback: AsyncCallback\<boolean\>): void isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
...@@ -1114,8 +1062,6 @@ function isNotificationEnabledCallback(err, data) { ...@@ -1114,8 +1062,6 @@ function isNotificationEnabledCallback(err, data) {
Notification.isNotificationEnabled(isNotificationEnabledCallback); Notification.isNotificationEnabled(isNotificationEnabledCallback);
``` ```
## Notification.isNotificationEnabled ## Notification.isNotificationEnabled
isNotificationEnabled(): Promise\<boolean\> isNotificationEnabled(): Promise\<boolean\>
...@@ -1148,8 +1094,6 @@ Notification.isNotificationEnabled().then((data) => { ...@@ -1148,8 +1094,6 @@ Notification.isNotificationEnabled().then((data) => {
}); });
``` ```
## Notification.displayBadge ## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
...@@ -1186,8 +1130,6 @@ let bundle = { ...@@ -1186,8 +1130,6 @@ let bundle = {
Notification.displayBadge(bundle, false, displayBadgeCallback); Notification.displayBadge(bundle, false, displayBadgeCallback);
``` ```
## Notification.displayBadge ## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\> displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
...@@ -1218,8 +1160,6 @@ Notification.displayBadge(bundle, false).then(() => { ...@@ -1218,8 +1160,6 @@ Notification.displayBadge(bundle, false).then(() => {
}); });
``` ```
## Notification.isBadgeDisplayed ## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
...@@ -1255,8 +1195,6 @@ let bundle = { ...@@ -1255,8 +1195,6 @@ let bundle = {
Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback); Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
``` ```
## Notification.isBadgeDisplayed ## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\> isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
...@@ -1292,8 +1230,6 @@ Notification.isBadgeDisplayed(bundle).then((data) => { ...@@ -1292,8 +1230,6 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
}); });
``` ```
## Notification.setSlotByBundle ## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void
...@@ -1333,8 +1269,6 @@ let notificationSlot = { ...@@ -1333,8 +1269,6 @@ let notificationSlot = {
Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback); Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
``` ```
## Notification.setSlotByBundle ## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\> setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
...@@ -1368,8 +1302,6 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => { ...@@ -1368,8 +1302,6 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
}); });
``` ```
## Notification.getSlotsByBundle ## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<NotificationSlot\>>): void getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<NotificationSlot\>>): void
...@@ -1405,8 +1337,6 @@ let bundle = { ...@@ -1405,8 +1337,6 @@ let bundle = {
Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback); Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
``` ```
## Notification.getSlotsByBundle ## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>> getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
...@@ -1442,8 +1372,6 @@ Notification.getSlotsByBundle(bundle).then((data) => { ...@@ -1442,8 +1372,6 @@ Notification.getSlotsByBundle(bundle).then((data) => {
}); });
``` ```
## Notification.getSlotNumByBundle ## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void
...@@ -1479,8 +1407,6 @@ let bundle = { ...@@ -1479,8 +1407,6 @@ let bundle = {
Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback); Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
``` ```
## Notification.getSlotNumByBundle ## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption): Promise\<number\> getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
...@@ -1516,8 +1442,6 @@ Notification.getSlotNumByBundle(bundle).then((data) => { ...@@ -1516,8 +1442,6 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
}); });
``` ```
## Notification.remove ## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void\>): void remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void\>): void
...@@ -1560,8 +1484,6 @@ let reason = Notification.RemoveReason.CLICK_REASON_REMOVE; ...@@ -1560,8 +1484,6 @@ let reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification.remove(bundle, notificationKey, reason, removeCallback); Notification.remove(bundle, notificationKey, reason, removeCallback);
``` ```
## Notification.remove ## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void\> remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void\>
...@@ -1598,8 +1520,6 @@ Notification.remove(bundle, notificationKey, reason).then(() => { ...@@ -1598,8 +1520,6 @@ Notification.remove(bundle, notificationKey, reason).then(() => {
}); });
``` ```
## Notification.remove ## Notification.remove
remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): void remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): void
...@@ -1636,8 +1556,6 @@ let reason = Notification.RemoveReason.CANCEL_REASON_REMOVE; ...@@ -1636,8 +1556,6 @@ let reason = Notification.RemoveReason.CANCEL_REASON_REMOVE;
Notification.remove(hashCode, reason, removeCallback); Notification.remove(hashCode, reason, removeCallback);
``` ```
## Notification.remove ## Notification.remove
remove(hashCode: string, reason: RemoveReason): Promise\<void\> remove(hashCode: string, reason: RemoveReason): Promise\<void\>
...@@ -1667,8 +1585,6 @@ Notification.remove(hashCode, reason).then(() => { ...@@ -1667,8 +1585,6 @@ Notification.remove(hashCode, reason).then(() => {
}); });
``` ```
## Notification.removeAll ## Notification.removeAll
removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
...@@ -1704,8 +1620,6 @@ let bundle = { ...@@ -1704,8 +1620,6 @@ let bundle = {
Notification.removeAll(bundle, removeAllCallback); Notification.removeAll(bundle, removeAllCallback);
``` ```
## Notification.removeAll ## Notification.removeAll
removeAll(callback: AsyncCallback\<void\>): void removeAll(callback: AsyncCallback\<void\>): void
...@@ -1738,8 +1652,6 @@ function removeAllCallback(err) { ...@@ -1738,8 +1652,6 @@ function removeAllCallback(err) {
Notification.removeAll(removeAllCallback); Notification.removeAll(removeAllCallback);
``` ```
## Notification.removeAll ## Notification.removeAll
removeAll(bundle?: BundleOption): Promise\<void\> removeAll(bundle?: BundleOption): Promise\<void\>
...@@ -1861,8 +1773,6 @@ function getAllActiveNotificationsCallback(err, data) { ...@@ -1861,8 +1773,6 @@ function getAllActiveNotificationsCallback(err, data) {
Notification.getAllActiveNotifications(getAllActiveNotificationsCallback); Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
``` ```
## Notification.getAllActiveNotifications ## Notification.getAllActiveNotifications
getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
...@@ -1889,8 +1799,6 @@ Notification.getAllActiveNotifications().then((data) => { ...@@ -1889,8 +1799,6 @@ Notification.getAllActiveNotifications().then((data) => {
}); });
``` ```
## Notification.getActiveNotificationCount ## Notification.getActiveNotificationCount
getActiveNotificationCount(callback: AsyncCallback\<number\>): void getActiveNotificationCount(callback: AsyncCallback\<number\>): void
...@@ -1919,8 +1827,6 @@ function getActiveNotificationCountCallback(err, data) { ...@@ -1919,8 +1827,6 @@ function getActiveNotificationCountCallback(err, data) {
Notification.getActiveNotificationCount(getActiveNotificationCountCallback); Notification.getActiveNotificationCount(getActiveNotificationCountCallback);
``` ```
## Notification.getActiveNotificationCount ## Notification.getActiveNotificationCount
getActiveNotificationCount(): Promise\<number\> getActiveNotificationCount(): Promise\<number\>
...@@ -1943,8 +1849,6 @@ Notification.getActiveNotificationCount().then((data) => { ...@@ -1943,8 +1849,6 @@ Notification.getActiveNotificationCount().then((data) => {
}); });
``` ```
## Notification.getActiveNotifications ## Notification.getActiveNotifications
getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void
...@@ -1973,8 +1877,6 @@ function getActiveNotificationsCallback(err, data) { ...@@ -1973,8 +1877,6 @@ function getActiveNotificationsCallback(err, data) {
Notification.getActiveNotifications(getActiveNotificationsCallback); Notification.getActiveNotifications(getActiveNotificationsCallback);
``` ```
## Notification.getActiveNotifications ## Notification.getActiveNotifications
getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
...@@ -1997,8 +1899,6 @@ Notification.getActiveNotifications().then((data) => { ...@@ -1997,8 +1899,6 @@ Notification.getActiveNotifications().then((data) => {
}); });
``` ```
## Notification.cancelGroup<sup>8+</sup> ## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
...@@ -2030,8 +1930,6 @@ let groupName = "GroupName"; ...@@ -2030,8 +1930,6 @@ let groupName = "GroupName";
Notification.cancelGroup(groupName, cancelGroupCallback); Notification.cancelGroup(groupName, cancelGroupCallback);
``` ```
## Notification.cancelGroup<sup>8+</sup> ## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string): Promise\<void\> cancelGroup(groupName: string): Promise\<void\>
...@@ -2055,8 +1953,6 @@ Notification.cancelGroup(groupName).then(() => { ...@@ -2055,8 +1953,6 @@ Notification.cancelGroup(groupName).then(() => {
}); });
``` ```
## Notification.removeGroupByBundle<sup>8+</sup> ## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void
...@@ -2094,8 +1990,6 @@ let groupName = "GroupName"; ...@@ -2094,8 +1990,6 @@ let groupName = "GroupName";
Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback); Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback);
``` ```
## Notification.removeGroupByBundle<sup>8+</sup> ## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
...@@ -2125,8 +2019,6 @@ Notification.removeGroupByBundle(bundleOption, groupName).then(() => { ...@@ -2125,8 +2019,6 @@ Notification.removeGroupByBundle(bundleOption, groupName).then(() => {
}); });
``` ```
## Notification.setDoNotDisturbDate<sup>8+</sup> ## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): void setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): void
...@@ -2166,8 +2058,6 @@ let doNotDisturbDate = { ...@@ -2166,8 +2058,6 @@ let doNotDisturbDate = {
Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback); Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
``` ```
## Notification.setDoNotDisturbDate<sup>8+</sup> ## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\> setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
...@@ -2241,8 +2131,6 @@ let userId = 1 ...@@ -2241,8 +2131,6 @@ let userId = 1
Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback); Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback);
``` ```
## Notification.setDoNotDisturbDate<sup>8+</sup> ## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\> setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
...@@ -2311,8 +2199,6 @@ function getDoNotDisturbDateCallback(err, data) { ...@@ -2311,8 +2199,6 @@ function getDoNotDisturbDateCallback(err, data) {
Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback); Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback);
``` ```
## Notification.getDoNotDisturbDate<sup>8+</sup> ## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(): Promise\<DoNotDisturbDate\> getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
...@@ -2375,8 +2261,6 @@ let userId = 1; ...@@ -2375,8 +2261,6 @@ let userId = 1;
Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback); Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
``` ```
## Notification.getDoNotDisturbDate<sup>8+</sup> ## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
...@@ -2444,8 +2328,6 @@ function supportDoNotDisturbModeCallback(err,data) { ...@@ -2444,8 +2328,6 @@ function supportDoNotDisturbModeCallback(err,data) {
Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback); Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback);
``` ```
## Notification.supportDoNotDisturbMode<sup>8+</sup> ## Notification.supportDoNotDisturbMode<sup>8+</sup>
supportDoNotDisturbMode(): Promise\<boolean\> supportDoNotDisturbMode(): Promise\<boolean\>
...@@ -2472,8 +2354,6 @@ Notification.supportDoNotDisturbMode().then((data) => { ...@@ -2472,8 +2354,6 @@ Notification.supportDoNotDisturbMode().then((data) => {
}); });
``` ```
## Notification.isSupportTemplate<sup>8+</sup> ## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): void isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): void
...@@ -2504,8 +2384,6 @@ function isSupportTemplateCallback(err, data) { ...@@ -2504,8 +2384,6 @@ function isSupportTemplateCallback(err, data) {
Notification.isSupportTemplate(templateName, isSupportTemplateCallback); Notification.isSupportTemplate(templateName, isSupportTemplateCallback);
``` ```
## Notification.isSupportTemplate<sup>8+</sup> ## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string): Promise\<boolean\> isSupportTemplate(templateName: string): Promise\<boolean\>
...@@ -2536,8 +2414,6 @@ Notification.isSupportTemplate(templateName).then((data) => { ...@@ -2536,8 +2414,6 @@ Notification.isSupportTemplate(templateName).then((data) => {
}); });
``` ```
## Notification.requestEnableNotification<sup>8+</sup> ## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(callback: AsyncCallback\<void\>): void requestEnableNotification(callback: AsyncCallback\<void\>): void
...@@ -2566,8 +2442,6 @@ function requestEnableNotificationCallback(err) { ...@@ -2566,8 +2442,6 @@ function requestEnableNotificationCallback(err) {
Notification.requestEnableNotification(requestEnableNotificationCallback); Notification.requestEnableNotification(requestEnableNotificationCallback);
``` ```
## Notification.requestEnableNotification<sup>8+</sup> ## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(): Promise\<void\> requestEnableNotification(): Promise\<void\>
...@@ -2620,8 +2494,6 @@ let enable = true; ...@@ -2620,8 +2494,6 @@ let enable = true;
Notification.enableDistributed(enable, enabledNotificationCallback); Notification.enableDistributed(enable, enabledNotificationCallback);
``` ```
## Notification.enableDistributed<sup>8+</sup> ## Notification.enableDistributed<sup>8+</sup>
enableDistributed(enable: boolean): Promise\<void> enableDistributed(enable: boolean): Promise\<void>
...@@ -2678,8 +2550,6 @@ function isDistributedEnabledCallback(err, data) { ...@@ -2678,8 +2550,6 @@ function isDistributedEnabledCallback(err, data) {
Notification.isDistributedEnabled(isDistributedEnabledCallback); Notification.isDistributedEnabled(isDistributedEnabledCallback);
``` ```
## Notification.isDistributedEnabled<sup>8+</sup> ## Notification.isDistributedEnabled<sup>8+</sup>
isDistributedEnabled(): Promise\<boolean> isDistributedEnabled(): Promise\<boolean>
...@@ -2743,8 +2613,6 @@ let enable = true; ...@@ -2743,8 +2613,6 @@ let enable = true;
Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundleCallback); Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundleCallback);
``` ```
## Notification.enableDistributedByBundle<sup>8+</sup> ## Notification.enableDistributedByBundle<sup>8+</sup>
enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void> enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void>
...@@ -2814,8 +2682,6 @@ let bundle = { ...@@ -2814,8 +2682,6 @@ let bundle = {
Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback); Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback);
``` ```
## Notification.isDistributedEnabledByBundle<sup>8+</sup> ## Notification.isDistributedEnabledByBundle<sup>8+</sup>
isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean> isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
...@@ -2885,8 +2751,6 @@ function getDeviceRemindTypeCallback(err,data) { ...@@ -2885,8 +2751,6 @@ function getDeviceRemindTypeCallback(err,data) {
Notification.getDeviceRemindType(getDeviceRemindTypeCallback); Notification.getDeviceRemindType(getDeviceRemindTypeCallback);
``` ```
## Notification.getDeviceRemindType<sup>8+</sup> ## Notification.getDeviceRemindType<sup>8+</sup>
getDeviceRemindType(): Promise\<DeviceRemindType\> getDeviceRemindType(): Promise\<DeviceRemindType\>
...@@ -3381,8 +3245,6 @@ Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => { ...@@ -3381,8 +3245,6 @@ Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => {
}); });
``` ```
## NotificationSubscriber ## NotificationSubscriber
Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribe). Provides callbacks for receiving or removing notifications and serves as the input parameter of [subscribe](#notificationsubscribe).
...@@ -3797,8 +3659,6 @@ Notification.enableNotification(bundle, false).then(() => { ...@@ -3797,8 +3659,6 @@ Notification.enableNotification(bundle, false).then(() => {
| bundle | string | Yes | Yes | Bundle information of the application.| | bundle | string | Yes | Yes | Bundle information of the application.|
| uid | number | Yes | Yes | User ID.| | uid | number | Yes | Yes | User ID.|
## NotificationKey ## NotificationKey
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
......
...@@ -29,6 +29,8 @@ Publishes a notification. This API uses an asynchronous callback to return the r ...@@ -29,6 +29,8 @@ Publishes a notification. This API uses an asynchronous callback to return the r
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -44,13 +46,13 @@ Publishes a notification. This API uses an asynchronous callback to return the r ...@@ -44,13 +46,13 @@ Publishes a notification. This API uses an asynchronous callback to return the r
// publish callback // publish callback
function publishCallback(err) { function publishCallback(err) {
if (err) { if (err) {
console.info("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publish success"); console.info("publish success");
} }
} }
// NotificationRequest object // NotificationRequest object
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -80,6 +82,8 @@ Publishes a notification. This API uses a promise to return the result. ...@@ -80,6 +82,8 @@ Publishes a notification. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -93,7 +97,7 @@ Publishes a notification. This API uses a promise to return the result. ...@@ -93,7 +97,7 @@ Publishes a notification. This API uses a promise to return the result.
```ts ```ts
// NotificationRequest object // NotificationRequest object
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
notificationId: 1, notificationId: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -132,6 +136,8 @@ Publishes a notification to a specified user. This API uses an asynchronous call ...@@ -132,6 +136,8 @@ Publishes a notification to a specified user. This API uses an asynchronous call
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -148,7 +154,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call ...@@ -148,7 +154,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call
// publish callback // publish callback
function publishCallback(err) { function publishCallback(err) {
if (err) { if (err) {
console.info("publish failed " + JSON.stringify(err)); console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publish success"); console.info("publish success");
} }
...@@ -156,7 +162,7 @@ function publishCallback(err) { ...@@ -156,7 +162,7 @@ function publishCallback(err) {
// User ID // User ID
let userId = 1; let userId = 1;
// NotificationRequest object // NotificationRequest object
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -191,6 +197,8 @@ Publishes a notification to a specified user. This API uses a promise to return ...@@ -191,6 +197,8 @@ Publishes a notification to a specified user. This API uses a promise to return
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -204,7 +212,7 @@ Publishes a notification to a specified user. This API uses a promise to return ...@@ -204,7 +212,7 @@ Publishes a notification to a specified user. This API uses a promise to return
**Example** **Example**
```ts ```ts
let notificationRequest = { let notificationRequest: notificationManager.NotificationRequest = {
notificationId: 1, notificationId: 1,
content: { content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -242,6 +250,8 @@ Cancels a notification with the specified ID and label. This API uses an asynchr ...@@ -242,6 +250,8 @@ Cancels a notification with the specified ID and label. This API uses an asynchr
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -255,7 +265,7 @@ Cancels a notification with the specified ID and label. This API uses an asynchr ...@@ -255,7 +265,7 @@ Cancels a notification with the specified ID and label. This API uses an asynchr
// cancel callback // cancel callback
function cancelCallback(err) { function cancelCallback(err) {
if (err) { if (err) {
console.info("cancel failed " + JSON.stringify(err)); console.error(`cancel failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancel success"); console.info("cancel success");
} }
...@@ -280,6 +290,8 @@ Cancels a notification with the specified ID and optional label. This API uses a ...@@ -280,6 +290,8 @@ Cancels a notification with the specified ID and optional label. This API uses a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -312,6 +324,8 @@ Cancels a notification with the specified ID. This API uses an asynchronous call ...@@ -312,6 +324,8 @@ Cancels a notification with the specified ID. This API uses an asynchronous call
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -325,7 +339,7 @@ Cancels a notification with the specified ID. This API uses an asynchronous call ...@@ -325,7 +339,7 @@ Cancels a notification with the specified ID. This API uses an asynchronous call
// cancel callback // cancel callback
function cancelCallback(err) { function cancelCallback(err) {
if (err) { if (err) {
console.info("cancel failed " + JSON.stringify(err)); console.error(`cancel failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancel success"); console.info("cancel success");
} }
...@@ -343,6 +357,8 @@ Cancels all notifications. This API uses an asynchronous callback to return the ...@@ -343,6 +357,8 @@ Cancels all notifications. This API uses an asynchronous callback to return the
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -361,7 +377,7 @@ Cancels all notifications. This API uses an asynchronous callback to return the ...@@ -361,7 +377,7 @@ Cancels all notifications. This API uses an asynchronous callback to return the
// cancel callback // cancel callback
function cancelAllCallback(err) { function cancelAllCallback(err) {
if (err) { if (err) {
console.info("cancelAll failed " + JSON.stringify(err)); console.error(`cancelAll failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancelAll success"); console.info("cancelAll success");
} }
...@@ -379,6 +395,8 @@ Cancels all notifications. This API uses a promise to return the result. ...@@ -379,6 +395,8 @@ Cancels all notifications. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -414,6 +432,8 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -414,6 +432,8 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -426,7 +446,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r ...@@ -426,7 +446,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
// addSlot callback // addSlot callback
function addSlotCallBack(err) { function addSlotCallBack(err) {
if (err) { if (err) {
console.info("addSlot failed " + JSON.stringify(err)); console.error(`addSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("addSlot success"); console.info("addSlot success");
} }
...@@ -458,6 +478,8 @@ Adds a notification slot. This API uses a promise to return the result. ...@@ -458,6 +478,8 @@ Adds a notification slot. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -493,6 +515,8 @@ Adds a notification slot of a specified type. This API uses an asynchronous call ...@@ -493,6 +515,8 @@ Adds a notification slot of a specified type. This API uses an asynchronous call
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -505,7 +529,7 @@ Adds a notification slot of a specified type. This API uses an asynchronous call ...@@ -505,7 +529,7 @@ Adds a notification slot of a specified type. This API uses an asynchronous call
// addSlot callback // addSlot callback
function addSlotCallBack(err) { function addSlotCallBack(err) {
if (err) { if (err) {
console.info("addSlot failed " + JSON.stringify(err)); console.error(`addSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("addSlot success"); console.info("addSlot success");
} }
...@@ -529,6 +553,8 @@ Adds a notification slot of a specified type. This API uses a promise to return ...@@ -529,6 +553,8 @@ Adds a notification slot of a specified type. This API uses a promise to return
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -564,6 +590,8 @@ Adds an array of notification slots. This API uses an asynchronous callback to r ...@@ -564,6 +590,8 @@ Adds an array of notification slots. This API uses an asynchronous callback to r
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -576,7 +604,7 @@ Adds an array of notification slots. This API uses an asynchronous callback to r ...@@ -576,7 +604,7 @@ Adds an array of notification slots. This API uses an asynchronous callback to r
// addSlots callback // addSlots callback
function addSlotsCallBack(err) { function addSlotsCallBack(err) {
if (err) { if (err) {
console.info("addSlots failed " + JSON.stringify(err)); console.error(`addSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("addSlots success"); console.info("addSlots success");
} }
...@@ -612,6 +640,8 @@ Adds an array of notification slots. This API uses a promise to return the resul ...@@ -612,6 +640,8 @@ Adds an array of notification slots. This API uses a promise to return the resul
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -651,6 +681,8 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c ...@@ -651,6 +681,8 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -663,7 +695,7 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c ...@@ -663,7 +695,7 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c
// getSlot callback // getSlot callback
function getSlotCallback(err,data) { function getSlotCallback(err,data) {
if (err) { if (err) {
console.info("getSlot failed " + JSON.stringify(err)); console.error(`getSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlot success"); console.info("getSlot success");
} }
...@@ -694,6 +726,8 @@ Obtains a notification slot of a specified type. This API uses a promise to retu ...@@ -694,6 +726,8 @@ Obtains a notification slot of a specified type. This API uses a promise to retu
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -719,6 +753,8 @@ Obtains all notification slots of this application. This API uses an asynchronou ...@@ -719,6 +753,8 @@ Obtains all notification slots of this application. This API uses an asynchronou
**Parameters** **Parameters**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------- | ---- | -------------------- | | -------- | --------------------------------- | ---- | -------------------- |
| callback | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | Yes | Callback used to return all notification slots of the current application.| | callback | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | Yes | Callback used to return all notification slots of the current application.|
...@@ -737,7 +773,7 @@ Obtains all notification slots of this application. This API uses an asynchronou ...@@ -737,7 +773,7 @@ Obtains all notification slots of this application. This API uses an asynchronou
// getSlots callback // getSlots callback
function getSlotsCallback(err,data) { function getSlotsCallback(err,data) {
if (err) { if (err) {
console.info("getSlots failed " + JSON.stringify(err)); console.error(`getSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlots success"); console.info("getSlots success");
} }
...@@ -761,6 +797,8 @@ Obtains all notification slots of this application. This API uses a promise to r ...@@ -761,6 +797,8 @@ Obtains all notification slots of this application. This API uses a promise to r
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -792,6 +830,8 @@ Removes a notification slot of a specified type. This API uses an asynchronous c ...@@ -792,6 +830,8 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -804,7 +844,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c ...@@ -804,7 +844,7 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
// removeSlot callback // removeSlot callback
function removeSlotCallback(err) { function removeSlotCallback(err) {
if (err) { if (err) {
console.info("removeSlot failed " + JSON.stringify(err)); console.error(`removeSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeSlot success"); console.info("removeSlot success");
} }
...@@ -829,6 +869,8 @@ Removes a notification slot of a specified type. This API uses a promise to retu ...@@ -829,6 +869,8 @@ Removes a notification slot of a specified type. This API uses a promise to retu
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -860,6 +902,8 @@ Removes all notification slots. This API uses an asynchronous callback to return ...@@ -860,6 +902,8 @@ Removes all notification slots. This API uses an asynchronous callback to return
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -871,7 +915,7 @@ Removes all notification slots. This API uses an asynchronous callback to return ...@@ -871,7 +915,7 @@ Removes all notification slots. This API uses an asynchronous callback to return
```ts ```ts
function removeAllCallBack(err) { function removeAllCallBack(err) {
if (err) { if (err) {
console.info("removeAllSlots failed " + JSON.stringify(err)); console.error(`removeAllSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAllSlots success"); console.info("removeAllSlots success");
} }
...@@ -889,6 +933,8 @@ Removes all notification slots. This API uses a promise to return the result. ...@@ -889,6 +933,8 @@ Removes all notification slots. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -925,6 +971,8 @@ Sets whether to enable notification for a specified application. This API uses a ...@@ -925,6 +971,8 @@ Sets whether to enable notification for a specified application. This API uses a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -937,7 +985,7 @@ Sets whether to enable notification for a specified application. This API uses a ...@@ -937,7 +985,7 @@ Sets whether to enable notification for a specified application. This API uses a
```ts ```ts
function setNotificationEnablenCallback(err) { function setNotificationEnablenCallback(err) {
if (err) { if (err) {
console.info("setNotificationEnablenCallback failed " + JSON.stringify(err)); console.error(`setNotificationEnablenCallback failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setNotificationEnablenCallback success"); console.info("setNotificationEnablenCallback success");
} }
...@@ -969,6 +1017,8 @@ Sets whether to enable notification for a specified application. This API uses a ...@@ -969,6 +1017,8 @@ Sets whether to enable notification for a specified application. This API uses a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1008,6 +1058,8 @@ Checks whether notification is enabled for a specified application. This API use ...@@ -1008,6 +1058,8 @@ Checks whether notification is enabled for a specified application. This API use
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1020,7 +1072,7 @@ Checks whether notification is enabled for a specified application. This API use ...@@ -1020,7 +1072,7 @@ Checks whether notification is enabled for a specified application. This API use
```ts ```ts
function isNotificationEnabledCallback(err, data) { function isNotificationEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err)); console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationEnabled success"); console.info("isNotificationEnabled success");
} }
...@@ -1057,6 +1109,8 @@ Checks whether notification is enabled for a specified application. This API use ...@@ -1057,6 +1109,8 @@ Checks whether notification is enabled for a specified application. This API use
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1095,6 +1149,8 @@ Checks whether notification is enabled for this application. This API uses an as ...@@ -1095,6 +1149,8 @@ Checks whether notification is enabled for this application. This API uses an as
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1106,7 +1162,7 @@ Checks whether notification is enabled for this application. This API uses an as ...@@ -1106,7 +1162,7 @@ Checks whether notification is enabled for this application. This API uses an as
```ts ```ts
function isNotificationEnabledCallback(err, data) { function isNotificationEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err)); console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationEnabled success"); console.info("isNotificationEnabled success");
} }
...@@ -1141,6 +1197,8 @@ Checks whether notification is enabled for the current application. This API use ...@@ -1141,6 +1197,8 @@ Checks whether notification is enabled for the current application. This API use
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1178,6 +1236,8 @@ Sets whether to enable the notification badge for a specified application. This ...@@ -1178,6 +1236,8 @@ Sets whether to enable the notification badge for a specified application. This
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1190,7 +1250,7 @@ Sets whether to enable the notification badge for a specified application. This ...@@ -1190,7 +1250,7 @@ Sets whether to enable the notification badge for a specified application. This
```ts ```ts
function displayBadgeCallback(err) { function displayBadgeCallback(err) {
if (err) { if (err) {
console.info("displayBadge failed " + JSON.stringify(err)); console.error(`displayBadge failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("displayBadge success"); console.info("displayBadge success");
} }
...@@ -1222,6 +1282,8 @@ Sets whether to enable the notification badge for a specified application. This ...@@ -1222,6 +1282,8 @@ Sets whether to enable the notification badge for a specified application. This
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1261,6 +1323,8 @@ Checks whether the notification badge is enabled for a specified application. Th ...@@ -1261,6 +1323,8 @@ Checks whether the notification badge is enabled for a specified application. Th
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1273,7 +1337,7 @@ Checks whether the notification badge is enabled for a specified application. Th ...@@ -1273,7 +1337,7 @@ Checks whether the notification badge is enabled for a specified application. Th
```ts ```ts
function isBadgeDisplayedCallback(err, data) { function isBadgeDisplayedCallback(err, data) {
if (err) { if (err) {
console.info("isBadgeDisplayed failed " + JSON.stringify(err)); console.error(`isBadgeDisplayed failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isBadgeDisplayed success"); console.info("isBadgeDisplayed success");
} }
...@@ -1310,6 +1374,8 @@ Checks whether the notification badge is enabled for a specified application. Th ...@@ -1310,6 +1374,8 @@ Checks whether the notification badge is enabled for a specified application. Th
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1328,6 +1394,79 @@ notificationManager.isBadgeDisplayed(bundle).then((data) => { ...@@ -1328,6 +1394,79 @@ notificationManager.isBadgeDisplayed(bundle).then((data) => {
}); });
``` ```
## notificationManager.setBadgeNumber<sup>10+</sup>
setBadgeNumber(badgeNumber: number): Promise\<void\>
Sets the notification badge number. This API uses a promise to return the result.
**System capability**: SystemCapability.Notification.Notification
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ---------- |
| badgeNumber | number | Yes | Notification badge number to set.|
**Error codes**
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
| 1600012 | No memory space. |
**Example**
```ts
let badgeNumber = 10
notificationManager.setBadgeNumber(badgeNumber).then(() => {
console.info("displayBadge success");
});
```
## notificationManager.setBadgeNumber<sup>10+</sup>
setBadgeNumber(badgeNumber: number, callback: AsyncCallback\<void\>): void
Sets the notification badge number. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.Notification
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | --------------------- | ---- | ------------------ |
| badgeNumber | number | Yes | Notification badge number to set. |
| callback | AsyncCallback\<void\> | 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. |
| 1600012 | No memory space. |
**Example**
```ts
function setBadgeNumberCallback(err) {
if (err) {
console.info(`displayBadge failed code is ${err.code}, message is ${err.message}`);
} else {
console.info("displayBadge success");
}
}
let badgeNumber = 10
notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback);
```
## notificationManager.setSlotByBundle ## notificationManager.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void
...@@ -1350,6 +1489,8 @@ Sets the notification slot for a specified application. This API uses an asynchr ...@@ -1350,6 +1489,8 @@ Sets the notification slot for a specified application. This API uses an asynchr
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1362,7 +1503,7 @@ Sets the notification slot for a specified application. This API uses an asynchr ...@@ -1362,7 +1503,7 @@ Sets the notification slot for a specified application. This API uses an asynchr
```ts ```ts
function setSlotByBundleCallback(err) { function setSlotByBundleCallback(err) {
if (err) { if (err) {
console.info("setSlotByBundle failed " + JSON.stringify(err)); console.error(`setSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setSlotByBundle success"); console.info("setSlotByBundle success");
} }
...@@ -1397,6 +1538,8 @@ Sets the notification slot for a specified application. This API uses a promise ...@@ -1397,6 +1538,8 @@ Sets the notification slot for a specified application. This API uses a promise
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1439,6 +1582,8 @@ Obtains the notification slots of a specified application. This API uses an asyn ...@@ -1439,6 +1582,8 @@ Obtains the notification slots of a specified application. This API uses an asyn
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1451,7 +1596,7 @@ Obtains the notification slots of a specified application. This API uses an asyn ...@@ -1451,7 +1596,7 @@ Obtains the notification slots of a specified application. This API uses an asyn
```ts ```ts
function getSlotsByBundleCallback(err, data) { function getSlotsByBundleCallback(err, data) {
if (err) { if (err) {
console.info("getSlotsByBundle failed " + JSON.stringify(err)); console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlotsByBundle success"); console.info("getSlotsByBundle success");
} }
...@@ -1488,6 +1633,8 @@ Obtains the notification slots of a specified application. This API uses a promi ...@@ -1488,6 +1633,8 @@ Obtains the notification slots of a specified application. This API uses a promi
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1527,6 +1674,8 @@ Obtains the number of notification slots of a specified application. This API us ...@@ -1527,6 +1674,8 @@ Obtains the number of notification slots of a specified application. This API us
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1539,7 +1688,7 @@ Obtains the number of notification slots of a specified application. This API us ...@@ -1539,7 +1688,7 @@ Obtains the number of notification slots of a specified application. This API us
```ts ```ts
function getSlotNumByBundleCallback(err, data) { function getSlotNumByBundleCallback(err, data) {
if (err) { if (err) {
console.info("getSlotNumByBundle failed " + JSON.stringify(err)); console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlotNumByBundle success"); console.info("getSlotNumByBundle success");
} }
...@@ -1576,6 +1725,8 @@ Obtains the number of notification slots of a specified application. This API us ...@@ -1576,6 +1725,8 @@ Obtains the number of notification slots of a specified application. This API us
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1626,7 +1777,7 @@ Obtains all active notifications. This API uses an asynchronous callback to retu ...@@ -1626,7 +1777,7 @@ Obtains all active notifications. This API uses an asynchronous callback to retu
```ts ```ts
function getAllActiveNotificationsCallback(err, data) { function getAllActiveNotificationsCallback(err, data) {
if (err) { if (err) {
console.info("getAllActiveNotifications failed " + JSON.stringify(err)); console.error(`getAllActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getAllActiveNotifications success"); console.info("getAllActiveNotifications success");
} }
...@@ -1655,6 +1806,8 @@ Obtains all active notifications. This API uses a promise to return the result. ...@@ -1655,6 +1806,8 @@ Obtains all active notifications. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1685,6 +1838,8 @@ Obtains the number of active notifications of this application. This API uses an ...@@ -1685,6 +1838,8 @@ Obtains the number of active notifications of this application. This API uses an
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1696,7 +1851,7 @@ Obtains the number of active notifications of this application. This API uses an ...@@ -1696,7 +1851,7 @@ Obtains the number of active notifications of this application. This API uses an
```ts ```ts
function getActiveNotificationCountCallback(err, data) { function getActiveNotificationCountCallback(err, data) {
if (err) { if (err) {
console.info("getActiveNotificationCount failed " + JSON.stringify(err)); console.error(`getActiveNotificationCount failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getActiveNotificationCount success"); console.info("getActiveNotificationCount success");
} }
...@@ -1721,6 +1876,8 @@ Obtains the number of active notifications of this application. This API uses a ...@@ -1721,6 +1876,8 @@ Obtains the number of active notifications of this application. This API uses a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1751,6 +1908,8 @@ Obtains active notifications of this application. This API uses an asynchronous ...@@ -1751,6 +1908,8 @@ Obtains active notifications of this application. This API uses an asynchronous
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1762,7 +1921,7 @@ Obtains active notifications of this application. This API uses an asynchronous ...@@ -1762,7 +1921,7 @@ Obtains active notifications of this application. This API uses an asynchronous
```ts ```ts
function getActiveNotificationsCallback(err, data) { function getActiveNotificationsCallback(err, data) {
if (err) { if (err) {
console.info("getActiveNotifications failed " + JSON.stringify(err)); console.error(`getActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getActiveNotifications success"); console.info("getActiveNotifications success");
} }
...@@ -1787,6 +1946,8 @@ Obtains active notifications of this application. This API uses a promise to ret ...@@ -1787,6 +1946,8 @@ Obtains active notifications of this application. This API uses a promise to ret
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1818,6 +1979,8 @@ Cancels notifications under a notification group of this application. This API u ...@@ -1818,6 +1979,8 @@ Cancels notifications under a notification group of this application. This API u
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1829,7 +1992,7 @@ Cancels notifications under a notification group of this application. This API u ...@@ -1829,7 +1992,7 @@ Cancels notifications under a notification group of this application. This API u
```ts ```ts
function cancelGroupCallback(err) { function cancelGroupCallback(err) {
if (err) { if (err) {
console.info("cancelGroup failed " + JSON.stringify(err)); console.error(`cancelGroup failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancelGroup success"); console.info("cancelGroup success");
} }
...@@ -1856,6 +2019,8 @@ Cancels notifications under a notification group of this application. This API u ...@@ -1856,6 +2019,8 @@ Cancels notifications under a notification group of this application. This API u
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1893,6 +2058,8 @@ Removes notifications under a notification group of a specified application. Thi ...@@ -1893,6 +2058,8 @@ Removes notifications under a notification group of a specified application. Thi
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1905,7 +2072,7 @@ Removes notifications under a notification group of a specified application. Thi ...@@ -1905,7 +2072,7 @@ Removes notifications under a notification group of a specified application. Thi
```ts ```ts
function removeGroupByBundleCallback(err) { function removeGroupByBundleCallback(err) {
if (err) { if (err) {
console.info("removeGroupByBundle failed " + JSON.stringify(err)); console.error(`removeGroupByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeGroupByBundle success"); console.info("removeGroupByBundle success");
} }
...@@ -1938,6 +2105,8 @@ Removes notifications under a notification group of a specified application. Thi ...@@ -1938,6 +2105,8 @@ Removes notifications under a notification group of a specified application. Thi
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1976,6 +2145,8 @@ Sets the DND time. This API uses an asynchronous callback to return the result. ...@@ -1976,6 +2145,8 @@ Sets the DND time. This API uses an asynchronous callback to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -1987,7 +2158,7 @@ Sets the DND time. This API uses an asynchronous callback to return the result. ...@@ -1987,7 +2158,7 @@ Sets the DND time. This API uses an asynchronous callback to return the result.
```ts ```ts
function setDoNotDisturbDateCallback(err) { function setDoNotDisturbDateCallback(err) {
if (err) { if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
} }
...@@ -2022,6 +2193,8 @@ Sets the DND time. This API uses a promise to return the result. ...@@ -2022,6 +2193,8 @@ Sets the DND time. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2064,6 +2237,8 @@ Sets the DND time for a specified user. This API uses an asynchronous callback t ...@@ -2064,6 +2237,8 @@ Sets the DND time for a specified user. This API uses an asynchronous callback t
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2076,7 +2251,7 @@ Sets the DND time for a specified user. This API uses an asynchronous callback t ...@@ -2076,7 +2251,7 @@ Sets the DND time for a specified user. This API uses an asynchronous callback t
```ts ```ts
function setDoNotDisturbDateCallback(err) { function setDoNotDisturbDateCallback(err) {
if (err) { if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
} }
...@@ -2114,6 +2289,8 @@ Sets the DND time for a specified user. This API uses a promise to return the re ...@@ -2114,6 +2289,8 @@ Sets the DND time for a specified user. This API uses a promise to return the re
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2158,6 +2335,8 @@ Obtains the DND time. This API uses an asynchronous callback to return the resul ...@@ -2158,6 +2335,8 @@ Obtains the DND time. This API uses an asynchronous callback to return the resul
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2169,7 +2348,7 @@ Obtains the DND time. This API uses an asynchronous callback to return the resul ...@@ -2169,7 +2348,7 @@ Obtains the DND time. This API uses an asynchronous callback to return the resul
```ts ```ts
function getDoNotDisturbDateCallback(err,data) { function getDoNotDisturbDateCallback(err,data) {
if (err) { if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDoNotDisturbDate success"); console.info("getDoNotDisturbDate success");
} }
...@@ -2198,6 +2377,8 @@ Obtains the DND time. This API uses a promise to return the result. ...@@ -2198,6 +2377,8 @@ Obtains the DND time. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2234,6 +2415,8 @@ Obtains the DND time of a specified user. This API uses an asynchronous callback ...@@ -2234,6 +2415,8 @@ Obtains the DND time of a specified user. This API uses an asynchronous callback
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2246,7 +2429,7 @@ Obtains the DND time of a specified user. This API uses an asynchronous callback ...@@ -2246,7 +2429,7 @@ Obtains the DND time of a specified user. This API uses an asynchronous callback
```ts ```ts
function getDoNotDisturbDateCallback(err,data) { function getDoNotDisturbDateCallback(err,data) {
if (err) { if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDoNotDisturbDate success"); console.info("getDoNotDisturbDate success");
} }
...@@ -2283,6 +2466,8 @@ Obtains the DND time of a specified user. This API uses a promise to return the ...@@ -2283,6 +2466,8 @@ Obtains the DND time of a specified user. This API uses a promise to return the
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2301,9 +2486,9 @@ notificationManager.getDoNotDisturbDate(userId).then((data) => { ...@@ -2301,9 +2486,9 @@ notificationManager.getDoNotDisturbDate(userId).then((data) => {
``` ```
## notificationManager.supportDoNotDisturbMode ## notificationManager.isSupportDoNotDisturbMode
supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void isSupportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
Checks whether DND mode is supported. This API uses an asynchronous callback to return the result. Checks whether DND mode is supported. This API uses an asynchronous callback to return the result.
...@@ -2330,20 +2515,20 @@ Checks whether DND mode is supported. This API uses an asynchronous callback to ...@@ -2330,20 +2515,20 @@ Checks whether DND mode is supported. This API uses an asynchronous callback to
**Example** **Example**
```ts ```ts
function supportDoNotDisturbModeCallback(err,data) { function isSupportDoNotDisturbModeCallback(err,data) {
if (err) { if (err) {
console.info("supportDoNotDisturbMode failed " + JSON.stringify(err)); console.error(`isSupportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("supportDoNotDisturbMode success"); console.info("isSupportDoNotDisturbMode success");
} }
} }
notificationManager.supportDoNotDisturbMode(supportDoNotDisturbModeCallback); notificationManager.isSupportDoNotDisturbMode(isSupportDoNotDisturbModeCallback);
``` ```
## notificationManager.supportDoNotDisturbMode ## notificationManager.isSupportDoNotDisturbMode
supportDoNotDisturbMode(): Promise\<boolean\> isSupportDoNotDisturbMode(): Promise\<boolean\>
Checks whether DND mode is supported. This API uses a promise to return the result. Checks whether DND mode is supported. This API uses a promise to return the result.
...@@ -2361,6 +2546,8 @@ Checks whether DND mode is supported. This API uses a promise to return the resu ...@@ -2361,6 +2546,8 @@ Checks whether DND mode is supported. This API uses a promise to return the resu
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2370,7 +2557,7 @@ Checks whether DND mode is supported. This API uses a promise to return the resu ...@@ -2370,7 +2557,7 @@ Checks whether DND mode is supported. This API uses a promise to return the resu
**Example** **Example**
```ts ```ts
notificationManager.supportDoNotDisturbMode().then((data) => { notificationManager.isSupportDoNotDisturbMode().then((data) => {
console.info("supportDoNotDisturbMode success, data: " + JSON.stringify(data)); console.info("supportDoNotDisturbMode success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -2392,6 +2579,8 @@ Checks whether a specified template is supported. This API uses an asynchronous ...@@ -2392,6 +2579,8 @@ Checks whether a specified template is supported. This API uses an asynchronous
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2405,7 +2594,7 @@ Checks whether a specified template is supported. This API uses an asynchronous ...@@ -2405,7 +2594,7 @@ Checks whether a specified template is supported. This API uses an asynchronous
let templateName = 'process'; let templateName = 'process';
function isSupportTemplateCallback(err, data) { function isSupportTemplateCallback(err, data) {
if (err) { if (err) {
console.info("isSupportTemplate failed " + JSON.stringify(err)); console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isSupportTemplate success"); console.info("isSupportTemplate success");
} }
...@@ -2436,6 +2625,8 @@ Checks whether a specified template is supported. This API uses a promise to ret ...@@ -2436,6 +2625,8 @@ Checks whether a specified template is supported. This API uses a promise to ret
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2469,6 +2660,8 @@ Requests notification to be enabled for this application. This API uses an async ...@@ -2469,6 +2660,8 @@ Requests notification to be enabled for this application. This API uses an async
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2480,7 +2673,7 @@ Requests notification to be enabled for this application. This API uses an async ...@@ -2480,7 +2673,7 @@ Requests notification to be enabled for this application. This API uses an async
```javascript ```javascript
function requestEnableNotificationCallback(err) { function requestEnableNotificationCallback(err) {
if (err) { if (err) {
console.info("requestEnableNotification failed " + JSON.stringify(err)); console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("requestEnableNotification success"); console.info("requestEnableNotification success");
} }
...@@ -2499,6 +2692,8 @@ Requests notification to be enabled for this application. This API uses a promis ...@@ -2499,6 +2692,8 @@ Requests notification to be enabled for this application. This API uses a promis
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2536,6 +2731,8 @@ Sets whether this device supports distributed notifications. This API uses an as ...@@ -2536,6 +2731,8 @@ Sets whether this device supports distributed notifications. This API uses an as
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2548,7 +2745,7 @@ Sets whether this device supports distributed notifications. This API uses an as ...@@ -2548,7 +2745,7 @@ Sets whether this device supports distributed notifications. This API uses an as
```javascript ```javascript
function setDistributedEnableCallback() { function setDistributedEnableCallback() {
if (err) { if (err) {
console.info("setDistributedEnable failed " + JSON.stringify(err)); console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDistributedEnable success"); console.info("setDistributedEnable success");
} }
...@@ -2579,6 +2776,8 @@ Sets whether this device supports distributed notifications. This API uses a pro ...@@ -2579,6 +2776,8 @@ Sets whether this device supports distributed notifications. This API uses a pro
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2613,6 +2812,8 @@ Checks whether this device supports distributed notifications. This API uses an ...@@ -2613,6 +2812,8 @@ Checks whether this device supports distributed notifications. This API uses an
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2625,7 +2826,7 @@ Checks whether this device supports distributed notifications. This API uses an ...@@ -2625,7 +2826,7 @@ Checks whether this device supports distributed notifications. This API uses an
```javascript ```javascript
function isDistributedEnabledCallback(err, data) { function isDistributedEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isDistributedEnabled failed " + JSON.stringify(err)); console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isDistributedEnabled success " + JSON.stringify(data)); console.info("isDistributedEnabled success " + JSON.stringify(data));
} }
...@@ -2652,6 +2853,8 @@ Checks whether this device supports distributed notifications. This API uses a p ...@@ -2652,6 +2853,8 @@ Checks whether this device supports distributed notifications. This API uses a p
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2691,6 +2894,8 @@ Sets whether a specified application supports distributed notifications. This AP ...@@ -2691,6 +2894,8 @@ Sets whether a specified application supports distributed notifications. This AP
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2704,7 +2909,7 @@ Sets whether a specified application supports distributed notifications. This AP ...@@ -2704,7 +2909,7 @@ Sets whether a specified application supports distributed notifications. This AP
```javascript ```javascript
function setDistributedEnableByBundleCallback(err) { function setDistributedEnableByBundleCallback(err) {
if (err) { if (err) {
console.info("enableDistributedByBundle failed " + JSON.stringify(err)); console.error(`setDistributedEnableByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("enableDistributedByBundle success"); console.info("enableDistributedByBundle success");
} }
...@@ -2742,6 +2947,8 @@ Sets whether a specified application supports distributed notifications. This AP ...@@ -2742,6 +2947,8 @@ Sets whether a specified application supports distributed notifications. This AP
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2785,6 +2992,8 @@ Checks whether a specified application supports distributed notifications. This ...@@ -2785,6 +2992,8 @@ Checks whether a specified application supports distributed notifications. This
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2798,7 +3007,7 @@ Checks whether a specified application supports distributed notifications. This ...@@ -2798,7 +3007,7 @@ Checks whether a specified application supports distributed notifications. This
```javascript ```javascript
function isDistributedEnabledByBundleCallback(data) { function isDistributedEnabledByBundleCallback(data) {
if (err) { if (err) {
console.info("isDistributedEnabledByBundle failed " + JSON.stringify(err)); console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isDistributedEnabledByBundle success" + JSON.stringify(data)); console.info("isDistributedEnabledByBundle success" + JSON.stringify(data));
} }
...@@ -2837,6 +3046,8 @@ Checks whether a specified application supports distributed notifications. This ...@@ -2837,6 +3046,8 @@ Checks whether a specified application supports distributed notifications. This
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2878,6 +3089,8 @@ Obtains the notification reminder type. This API uses an asynchronous callback t ...@@ -2878,6 +3089,8 @@ Obtains the notification reminder type. This API uses an asynchronous callback t
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2889,7 +3102,7 @@ Obtains the notification reminder type. This API uses an asynchronous callback t ...@@ -2889,7 +3102,7 @@ Obtains the notification reminder type. This API uses an asynchronous callback t
```javascript ```javascript
function getDeviceRemindTypeCallback(err, data) { function getDeviceRemindTypeCallback(err, data) {
if (err) { if (err) {
console.info("getDeviceRemindType failed " + JSON.stringify(err)); console.error(`getDeviceRemindType failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDeviceRemindType success"); console.info("getDeviceRemindType success");
} }
...@@ -2918,6 +3131,8 @@ Obtains the notification reminder type. This API uses a promise to return the re ...@@ -2918,6 +3131,8 @@ Obtains the notification reminder type. This API uses a promise to return the re
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2956,6 +3171,8 @@ Publishes a notification through the reminder agent. This API uses an asynchrono ...@@ -2956,6 +3171,8 @@ Publishes a notification through the reminder agent. This API uses an asynchrono
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -2972,7 +3189,7 @@ Publishes a notification through the reminder agent. This API uses an asynchrono ...@@ -2972,7 +3189,7 @@ Publishes a notification through the reminder agent. This API uses an asynchrono
// publishAsBundle callback // publishAsBundle callback
function callback(err) { function callback(err) {
if (err) { if (err) {
console.info("publishAsBundle failed " + JSON.stringify(err)); console.error(`publishAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publishAsBundle success"); console.info("publishAsBundle success");
} }
...@@ -3020,6 +3237,8 @@ Publishes a notification through the reminder agent. This API uses a promise to ...@@ -3020,6 +3237,8 @@ Publishes a notification through the reminder agent. This API uses a promise to
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------------- | | -------- | ----------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3080,6 +3299,8 @@ Cancels a notification published by the reminder agent. This API uses an asynchr ...@@ -3080,6 +3299,8 @@ Cancels a notification published by the reminder agent. This API uses an asynchr
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3094,7 +3315,7 @@ Cancels a notification published by the reminder agent. This API uses an asynchr ...@@ -3094,7 +3315,7 @@ Cancels a notification published by the reminder agent. This API uses an asynchr
// cancelAsBundle // cancelAsBundle
function cancelAsBundleCallback(err) { function cancelAsBundleCallback(err) {
if (err) { if (err) {
console.info("cancelAsBundle failed " + JSON.stringify(err)); console.error(`cancelAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancelAsBundle success"); console.info("cancelAsBundle success");
} }
...@@ -3131,6 +3352,8 @@ Cancels a notification published by the reminder agent. This API uses a promise ...@@ -3131,6 +3352,8 @@ Cancels a notification published by the reminder agent. This API uses a promise
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3175,6 +3398,8 @@ Sets whether to enable a specified notification slot type for a specified applic ...@@ -3175,6 +3398,8 @@ Sets whether to enable a specified notification slot type for a specified applic
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3188,7 +3413,7 @@ Sets whether to enable a specified notification slot type for a specified applic ...@@ -3188,7 +3413,7 @@ Sets whether to enable a specified notification slot type for a specified applic
// setNotificationEnableSlot // setNotificationEnableSlot
function setNotificationEnableSlotCallback(err) { function setNotificationEnableSlotCallback(err) {
if (err) { if (err) {
console.info("setNotificationEnableSlot failed " + JSON.stringify(err)); console.error(`setNotificationEnableSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setNotificationEnableSlot success"); console.info("setNotificationEnableSlot success");
} }
...@@ -3223,6 +3448,8 @@ Sets whether to enable a specified notification slot type for a specified applic ...@@ -3223,6 +3448,8 @@ Sets whether to enable a specified notification slot type for a specified applic
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3264,6 +3491,8 @@ Checks whether a specified notification slot type is enabled for a specified app ...@@ -3264,6 +3491,8 @@ Checks whether a specified notification slot type is enabled for a specified app
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3277,7 +3506,7 @@ Checks whether a specified notification slot type is enabled for a specified app ...@@ -3277,7 +3506,7 @@ Checks whether a specified notification slot type is enabled for a specified app
// isNotificationSlotEnabled // isNotificationSlotEnabled
function getEnableSlotCallback(err, data) { function getEnableSlotCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationSlotEnabled failed " + JSON.stringify(err)); console.error(`isNotificationSlotEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationSlotEnabled success"); console.info("isNotificationSlotEnabled success");
} }
...@@ -3316,6 +3545,8 @@ Checks whether a specified notification slot type is enabled for a specified app ...@@ -3316,6 +3545,8 @@ Checks whether a specified notification slot type is enabled for a specified app
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3356,6 +3587,8 @@ Sets whether to enable the notification sync feature for devices where the appli ...@@ -3356,6 +3587,8 @@ Sets whether to enable the notification sync feature for devices where the appli
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3371,7 +3604,7 @@ let enable = true; ...@@ -3371,7 +3604,7 @@ let enable = true;
function callback(err) { function callback(err) {
if (err) { if (err) {
console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err)); console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setSyncNotificationEnabledWithoutApp success"); console.info("setSyncNotificationEnabledWithoutApp success");
} }
...@@ -3408,6 +3641,8 @@ Sets whether to enable the notification sync feature for devices where the appli ...@@ -3408,6 +3641,8 @@ Sets whether to enable the notification sync feature for devices where the appli
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3424,7 +3659,7 @@ let enable = true; ...@@ -3424,7 +3659,7 @@ let enable = true;
notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => { notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
console.info('setSyncNotificationEnabledWithoutApp success'); console.info('setSyncNotificationEnabledWithoutApp success');
}).catch((err) => { }).catch((err) => {
console.info('setSyncNotificationEnabledWithoutApp, err:' + JSON.stringify(err)); console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
...@@ -3450,6 +3685,8 @@ Obtains whether the notification sync feature is enabled for devices where the a ...@@ -3450,6 +3685,8 @@ Obtains whether the notification sync feature is enabled for devices where the a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3500,6 +3737,8 @@ Obtains whether the notification sync feature is enabled for devices where the a ...@@ -3500,6 +3737,8 @@ Obtains whether the notification sync feature is enabled for devices where the a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -3737,7 +3976,7 @@ Describes the notification request. ...@@ -3737,7 +3976,7 @@ Describes the notification request.
| label | string | Yes | Yes | Notification label. | | label | string | Yes | Yes | Notification label. |
| badgeIconStyle | number | Yes | Yes | Notification badge type. | | badgeIconStyle | number | Yes | Yes | Notification badge type. |
| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. | | showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. |
| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | Yes | Yes | Buttons in the notification. Up to two buttons are allowed. | | actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 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.| | 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.| | 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.|
| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. | | creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. |
......
...@@ -36,6 +36,8 @@ Subscribes to a notification with the subscription information specified. This A ...@@ -36,6 +36,8 @@ Subscribes to a notification with the subscription information specified. This A
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -48,7 +50,7 @@ Subscribes to a notification with the subscription information specified. This A ...@@ -48,7 +50,7 @@ Subscribes to a notification with the subscription information specified. This A
// subscribe callback // subscribe callback
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribe success"); console.info("subscribe success");
} }
...@@ -86,6 +88,8 @@ Subscribes to notifications of all applications under this user. This API uses a ...@@ -86,6 +88,8 @@ Subscribes to notifications of all applications under this user. This API uses a
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -97,7 +101,7 @@ Subscribes to notifications of all applications under this user. This API uses a ...@@ -97,7 +101,7 @@ Subscribes to notifications of all applications under this user. This API uses a
```js ```js
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribe success"); console.info("subscribe success");
} }
...@@ -134,6 +138,8 @@ Subscribes to a notification with the subscription information specified. This A ...@@ -134,6 +138,8 @@ Subscribes to a notification with the subscription information specified. This A
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -177,6 +183,8 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu ...@@ -177,6 +183,8 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -188,7 +196,7 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu ...@@ -188,7 +196,7 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu
```js ```js
function unsubscribeCallback(err) { function unsubscribeCallback(err) {
if (err) { if (err) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("unsubscribe success"); console.info("unsubscribe success");
} }
...@@ -222,6 +230,8 @@ Unsubscribes from a notification. This API uses a promise to return the result. ...@@ -222,6 +230,8 @@ Unsubscribes from a notification. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -265,6 +275,8 @@ Removes a notification for a specified application. This API uses an asynchronou ...@@ -265,6 +275,8 @@ Removes a notification for a specified application. This API uses an asynchronou
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -278,7 +290,7 @@ Removes a notification for a specified application. This API uses an asynchronou ...@@ -278,7 +290,7 @@ Removes a notification for a specified application. This API uses an asynchronou
```js ```js
function removeCallback(err) { function removeCallback(err) {
if (err) { if (err) {
console.info("remove failed " + JSON.stringify(err)); console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("remove success"); console.info("remove success");
} }
...@@ -318,6 +330,8 @@ Removes a notification for a specified application. This API uses a promise to r ...@@ -318,6 +330,8 @@ Removes a notification for a specified application. This API uses a promise to r
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -364,6 +378,8 @@ Removes a specified notification. This API uses an asynchronous callback to retu ...@@ -364,6 +378,8 @@ Removes a specified notification. This API uses an asynchronous callback to retu
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -378,7 +394,7 @@ let hashCode = 'hashCode'; ...@@ -378,7 +394,7 @@ let hashCode = 'hashCode';
function removeCallback(err) { function removeCallback(err) {
if (err) { if (err) {
console.info("remove failed " + JSON.stringify(err)); console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("remove success"); console.info("remove success");
} }
...@@ -408,6 +424,8 @@ Removes a specified notification. This API uses a promise to return the result. ...@@ -408,6 +424,8 @@ Removes a specified notification. This API uses a promise to return the result.
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -446,6 +464,8 @@ Removes all notifications for a specified application. This API uses an asynchro ...@@ -446,6 +464,8 @@ Removes all notifications for a specified application. This API uses an asynchro
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -458,7 +478,7 @@ Removes all notifications for a specified application. This API uses an asynchro ...@@ -458,7 +478,7 @@ Removes all notifications for a specified application. This API uses an asynchro
```js ```js
function removeAllCallback(err) { function removeAllCallback(err) {
if (err) { if (err) {
console.info("removeAll failed " + JSON.stringify(err)); console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAll success"); console.info("removeAll success");
} }
...@@ -489,6 +509,8 @@ Removes all notifications. This API uses an asynchronous callback to return the ...@@ -489,6 +509,8 @@ Removes all notifications. This API uses an asynchronous callback to return the
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -500,7 +522,7 @@ Removes all notifications. This API uses an asynchronous callback to return the ...@@ -500,7 +522,7 @@ Removes all notifications. This API uses an asynchronous callback to return the
```js ```js
function removeAllCallback(err) { function removeAllCallback(err) {
if (err) { if (err) {
console.info("removeAll failed " + JSON.stringify(err)); console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAll success"); console.info("removeAll success");
} }
...@@ -529,6 +551,8 @@ Removes all notifications for a specified application. This API uses a promise t ...@@ -529,6 +551,8 @@ Removes all notifications for a specified application. This API uses a promise t
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -566,6 +590,8 @@ Removes all notifications for a specified user. This API uses an asynchronous ca ...@@ -566,6 +590,8 @@ Removes all notifications for a specified user. This API uses an asynchronous ca
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -578,7 +604,7 @@ Removes all notifications for a specified user. This API uses an asynchronous ca ...@@ -578,7 +604,7 @@ Removes all notifications for a specified user. This API uses an asynchronous ca
```js ```js
function removeAllCallback(err) { function removeAllCallback(err) {
if (err) { if (err) {
console.info("removeAll failed " + JSON.stringify(err)); console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAll success"); console.info("removeAll success");
} }
...@@ -609,6 +635,8 @@ Removes all notifications for a specified user. This API uses a promise to retur ...@@ -609,6 +635,8 @@ Removes all notifications for a specified user. This API uses a promise to retur
**Error codes** **Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message | | ID| Error Message |
| -------- | ----------------------------------- | | -------- | ----------------------------------- |
| 1600001 | Internal error. | | 1600001 | Internal error. |
...@@ -621,7 +649,7 @@ Removes all notifications for a specified user. This API uses a promise to retur ...@@ -621,7 +649,7 @@ Removes all notifications for a specified user. This API uses a promise to retur
```js ```js
function removeAllCallback(err) { function removeAllCallback(err) {
if (err) { if (err) {
console.info("removeAll failed " + JSON.stringify(err)); console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAll success"); console.info("removeAll success");
} }
...@@ -659,7 +687,7 @@ Callback for receiving notifications. ...@@ -659,7 +687,7 @@ Callback for receiving notifications.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -699,7 +727,7 @@ Callback for canceling notifications. ...@@ -699,7 +727,7 @@ Callback for canceling notifications.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -739,7 +767,7 @@ Callback for notification sorting updates. ...@@ -739,7 +767,7 @@ Callback for notification sorting updates.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -771,7 +799,7 @@ Callback for subscription. ...@@ -771,7 +799,7 @@ Callback for subscription.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -803,14 +831,14 @@ Callback for unsubscription. ...@@ -803,14 +831,14 @@ Callback for unsubscription.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
}; };
function unsubscribeCallback(err) { function unsubscribeCallback(err) {
if (err.code) { if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err)); console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("unsubscribeCallback"); console.info("unsubscribeCallback");
} }
...@@ -849,7 +877,7 @@ Callback for service disconnection. ...@@ -849,7 +877,7 @@ Callback for service disconnection.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -887,7 +915,7 @@ Callback for DND time setting updates. ...@@ -887,7 +915,7 @@ Callback for DND time setting updates.
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -926,7 +954,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono ...@@ -926,7 +954,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono
```javascript ```javascript
function subscribeCallback(err) { function subscribeCallback(err) {
if (err) { if (err) {
console.info("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
...@@ -945,6 +973,46 @@ let subscriber = { ...@@ -945,6 +973,46 @@ let subscriber = {
notificationSubscribe.subscribe(subscriber, subscribeCallback); notificationSubscribe.subscribe(subscriber, subscribeCallback);
``` ```
### onBadgeChanged<sup>10+</sup>
onBadgeChanged?:(data: [BadgeNumberCallbackData](#badgenumbercallbackdata)) => void
Listens for the change of the notification badge number.
**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\<[BadgeNumberCallbackData](#badgenumbercallbackdata)\> | 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 onBadgeChangedCallback(data) {
console.info("bundle: ", data.bundle);
console.info("uid: ", data.uid);
console.info("badgeNumber: ", data.badgeNumber);
};
let subscriber = {
onBadgeChanged: onBadgeChangedCallback
};
notificationSubscribe.subscribe(subscriber, subscribeCallback);
```
## BundleOption ## BundleOption
**System capability**: SystemCapability.Notification.Notification **System capability**: SystemCapability.Notification.Notification
...@@ -1054,3 +1122,15 @@ Provides the notification user input. ...@@ -1054,3 +1122,15 @@ Provides the notification user input.
| -------------------- | --- | -------------------- | | -------------------- | --- | -------------------- |
| CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. | | CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. |
| CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. | | CANCEL_REASON_REMOVE | 2 | The notification is removed by the user. |
## BadgeNumberCallbackData<sup>10+</sup>
**System capability**: SystemCapability.Notification.Notification
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Readable| Writable| Description |
| ----------- | ------ | ---- | ---- | ------------ |
| bundle | string | Yes | No | Bundle name of the application.|
| uid | number | Yes | No | UID of the application. |
| badgeNumber | number | Yes | No | Notification badge number. |
# Notification Error Codes
## 1600001 Internal Error
**Error Message**
Internal error.
**Description**
This error code is reported when an error occurs during internal processing, such as multi-thread processing or internal pointer checks.
**Cause**
Common kernel errors such as multi-thread processing and internal processing errors occur.
**Solution**
Make sure the system resources are sufficient.
## 1600002 Marshalling or Unmarshalling Error
**Error Message**
marshalling or unmarshalling error.
**Description**
This error code is reported when a marshalling or unmarshalling error occurs before data transmission.
**Cause**
A parameter mismatch is detected between the application and the notification service.
**Solution**
Make sure the application SDK version matches the system version.
## 1600003 Failed to Connect to the Notification Service
**Error Message**
Failed to connect service.
**Description**
This error code is reported when the application fails to connect to the notification service.
**Cause**
The notification service is busy or abnormal.
**Solution**
Restart the system.
## 1600004 Notification Disabled
**Error Message**
Notification is not enabled.
**Description**
This error code is reported when notification is disabled.
**Cause**
The notification feature is not enabled for the application.
**Solution**
Enable notification for the application in the notification settings.
## 1600005 Notification Slot Disabled
**Error Message**
Notification slot is not enabled.
**Description**
This error code is reported when the notification slot is not available.
**Cause**
The notification slot is disabled or has not been added.
**Solution**
1. Access the notification settings and check whether the application has the notification slot. If no, add it.
2. Make sure the notification slot is enabled.
## 1600006 Notification Deletion Failed
**Error Message**
Notification is not allowed to remove.
**Description**
This error code is reported when notification deletion is disabled.
**Cause**
The notification attribute **isUnremovable** is set to true.
**Solution**
Set **isUnremovable** as needed. For details, see [NotificationRequest](../apis/js-apis-notificationManager.md#notificationrequest).
## 1600007 Notification Not Found
**Error Message**
The notification is not exist.
**Description**
This error code is reported when the notification service could not find the notification.
**Cause**
The notification has been canceled or deleted.
**Solution**
N/A
## 1600008 User Not Found
**Error Message**
The user is not exist.
**Description**
This error code is reported when the specified user is not found in the information system.
**Cause**
The user information passed is incorrect.
**Solution**
Verify the user information.
## 1600009 Notification Sending Limit Reached
**Error Message**
Over max number notifications per second.
**Description**
This error code is reported when the notification sending frequency reaches the upper limit.
**Cause**
More than 10 notifications are sent per second.
**Solution**
Reduce the notification sending frequency to no more than 10 per second.
## 16000010 Distributed Operation Failed
**Error Message**
Distributed operation failed.
**Description**
This error code is reported when an error occurs with the distributed database operation or distributed API invoking.
**Cause**
The distributed database could not be operated or the distributed API could not be invoked.
**Solution**
Verify the distributed connection.
## 16000011 Failed to Read the Template Configuration
**Error Message**
Read template config failed.
**Description**
This error code is reported when the attempt to read the template configuration file fails.
**Cause**
The template configuration file is lost in the system.
**Solution**
Check for the template configuration file: /system/etc/notification_template/external.json.
## 16000012 Insufficient Memory Space
**Error Message**
No memory space.
**Description**
This error code is reported when a memory allocation error occurs.
**Cause**
A memory allocation error occurs.
**Solution**
Ensure sufficient system memory.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册