提交 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
notificationManager.requestEnableNotification().then(() => {
console.info(`[ANS] requestEnableNotification success`);
}).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
```ts
notificationSubscribe.subscribe(subscriber, (err, data) => { // This API uses an asynchronous callback to return the result.
if (err) {
console.error(`[ANS] failed to subscribe, error[${err}]`);
console.error(`[ANS] subscribe failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] subscribeTest success : + ${data}`);
......
......@@ -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.
**Figure 1** Publishing a notification with a WantAgent object
![notification-with-wantagent](figures/notification-with-wantagent.png)
......@@ -14,11 +15,11 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
| Name| Description|
| -------- | -------- |
| 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.|
| 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.|
| equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether two **WantAgent** objects are equal. |
|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.|
|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.|
|equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether two **WantAgent** objects are equal.|
## How to Develop
......@@ -95,7 +96,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
```typescript
// Create a NotificationRequest object.
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
......@@ -111,7 +112,7 @@ For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/
notificationManager.publish(notificationRequest, (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;
}
console.info(`[ANS] publish success`);
......
......@@ -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.
## Available APIs
| 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
......@@ -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.
// ...
}).catch((err) => {
console.error(`[ANS] isSupportTemplate failed, error[${err}]`);
console.error(`[ANS] isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
});
```
> **NOTE**
>
> Proceed with the step below only when the specified template is supported.
4. Create a **NotificationRequest** object and publish a progress notification.
```ts
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
......@@ -61,7 +61,7 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n
// Publish the notification.
notificationManager.publish(notificationRequest, (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;
}
console.info(`[ANS] publish success `);
......
......@@ -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.
```ts
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, // Basic notification
......@@ -59,10 +59,10 @@ The following table describes the APIs for notification publishing. You specify
notificationManager.publish(notificationRequest, (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;
}
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
- 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
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
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
// Publish the notification.
notificationManager.publish(notificationRequest, (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;
}
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
- 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
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
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
// Publish the notification.
notificationManager.publish(notificationRequest, (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;
}
console.info(`[ANS] publish success`);
......@@ -131,7 +131,7 @@ The following table describes the APIs for notification publishing. You specify
```ts
let notificationPicture: PixelMap = undefined; // Obtain the pixel map information.
let notificationRequest = {
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_PICTURE,
......@@ -149,10 +149,10 @@ The following table describes the APIs for notification publishing. You specify
// Publish the notification.
notificationManager.publish(notificationRequest, (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;
}
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
"icon": "$media:app_icon",
"label": "$string:app_name",
"description": "$string:description_application",
"distributedNotificationEnabled": true,
"minAPIVersion": 9,
"targetAPIVersion": 9,
"apiReleaseType": "Release",
"debug": false,
"entityType": "media",
"car": {
"minAPIVersion": 8,
}
......@@ -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**)|
| 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)|
| 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**)|
| 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"**)|
| 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**)|
| 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**)|
| 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**)|
| 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)|
| 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 @@
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**
>
> - 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.
......@@ -43,7 +42,7 @@ Publishes a common event. This API uses an asynchronous callback to return the r
// Callback for common event publication
function publishCB(err) {
if (err.code) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish");
}
......@@ -85,7 +84,7 @@ let options = {
// Callback for common event publication
function publishCB(err) {
if (err.code) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish");
}
......@@ -121,7 +120,7 @@ Publishes a common event to a specific user. This API uses an asynchronous callb
// Callback for common event publication
function publishCB(err) {
if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}`);
} else {
console.info("publishAsUser");
}
......@@ -161,14 +160,14 @@ Publishes a common event with given attributes to a specific user. This API uses
```ts
// Attributes of a common event.
let options = {
code: 0, // Initial code of the common event.
data: "initial data";// Initial data of the common event.
code: 0, // Result code of the common event.
data: "initial data",// Result data of the common event.
}
// Callback for common event publication
function publishCB(err) {
if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}`);
} else {
console.info("publishAsUser");
}
......@@ -212,7 +211,7 @@ let subscribeInfo = {
// Callback for subscriber creation.
function createCB(err, commonEventSubscriber) {
if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
......@@ -259,7 +258,7 @@ CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
}).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
});
```
......@@ -293,7 +292,7 @@ let subscribeInfo = {
// Callback for common event subscription.
function subscribeCB(err, data) {
if (err.code) {
console.error("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}`);
} else {
console.info("subscribe " + JSON.stringify(data));
}
......@@ -302,7 +301,7 @@ function subscribeCB(err, data) {
// Callback for subscriber creation.
function createCB(err, subscriber) {
if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
// Subscribe to a common event.
......@@ -344,7 +343,7 @@ let subscribeInfo = {
// Callback for common event subscription.
function subscribeCB(err, data) {
if (err.code) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}`);
} else {
console.info("subscribe " + JSON.stringify(data));
}
......@@ -353,7 +352,7 @@ function subscribeCB(err, data) {
// Callback for subscriber creation.
function createCB(err, commonEventSubscriber) {
if (err.code) {
console.info("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
......@@ -365,7 +364,7 @@ function createCB(err, commonEventSubscriber) {
// Callback for common event unsubscription.
function unsubscribeCB(err) {
if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
......@@ -404,7 +403,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for result code obtaining of an ordered common event.
function getCodeCB(err, Code) {
if (err.code) {
console.error("getCode failed " + JSON.stringify(err));
console.error(`getCode failed, code is ${err.code}`);
} else {
console.info("getCode " + JSON.stringify(Code));
}
......@@ -436,7 +435,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code));
}).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.
// Callback for result code setting of an ordered common event.
function setCodeCB(err) {
if (err.code) {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}`);
} else {
console.info("setCode");
}
......@@ -503,7 +502,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => {
console.info("setCode");
}).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.
// Callback for result data obtaining of an ordered common event.
function getDataCB(err, data) {
if (err.code) {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}`);
} else {
console.info("getData " + JSON.stringify(data));
}
......@@ -564,7 +563,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data));
}).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.
// Callback for result data setting of an ordered common event
function setDataCB(err) {
if (err.code) {
console.error("setData failed " + JSON.stringify(err));
console.error(`sendData failed, code is ${err.code}`);
} else {
console.info("setData");
}
......@@ -631,7 +630,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => {
console.info("setData");
}).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.
// Callback for result code and result data setting of an ordered common event.
function setCodeDataCB(err) {
if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}`);
} else {
console.info("setCodeDataCallback");
}
......@@ -701,7 +700,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData");
}).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.
// Callback for checking whether the current common event is an ordered one.
function isOrderedCB(err, isOrdered) {
if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
console.error(`isOrderedCommonEvent failed, code is ${err.code}`);
} else {
console.info("isOrdered " + JSON.stringify(isOrdered));
}
......@@ -761,7 +760,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered));
}).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.
// Callback for checking whether the current common event is a sticky one.
function isStickyCB(err, isSticky) {
if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err));
console.error(`isStickyCommonEvent failed, code is ${err.code}`);
} else {
console.info("isSticky " + JSON.stringify(isSticky));
}
......@@ -821,7 +820,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky));
}).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.
// Callback for common event aborting.
function abortCB(err) {
if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}`);
} else {
console.info("abortCommonEvent");
}
......@@ -882,7 +881,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent");
}).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.
// Callback for clearing the aborted state of the current common event.
function clearAbortCB(err) {
if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}`);
} else {
console.info("clearAbortCommonEvent");
}
......@@ -943,7 +942,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent");
}).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.
// Callback for checking whether the current common event is in the aborted state.
function getAbortCB(err, abortEvent) {
if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}`);
} else {
console.info("abortEvent " + abortEvent)
}
......@@ -1004,7 +1003,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((abortCommonEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent));
}).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.
// Callback for subscriber information obtaining.
function getCB(err, subscribeInfo) {
if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}`);
} else {
console.info("SubscribeInfo " + JSON.stringify(subscribeInfo));
}
......@@ -1065,7 +1064,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}`);
});
```
......@@ -1088,12 +1087,12 @@ Finishes this common event. This API takes effect only for ordered common events
**Example**
```ts
let subscriber; // Subscriber object successfully created.
let subscriber; // Subscriber object successfully created.
// Callback for ordered common event finishing.
function finishCB(err) {
if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}`);
} else {
console.info("FinishCommonEvent");
}
......@@ -1126,7 +1125,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent");
}).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
// Callback for common event publication
function publishCB(err) {
if (err) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish");
}
......@@ -55,7 +55,7 @@ function publishCB(err) {
try {
CommonEventManager.publish("event", publishCB);
} 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 = {
// Callback for common event publication
function publishCB(err) {
if (err) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish");
}
......@@ -104,7 +104,7 @@ function publishCB(err) {
try {
CommonEventManager.publish("event", options, publishCB);
} 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
// Callback for common event publication
function publishCB(err) {
if (err) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publishAsUser");
}
......@@ -151,7 +151,7 @@ let userId = 100;
try {
CommonEventManager.publishAsUser("event", userId, publishCB);
} 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 = {
// Callback for common event publication.
function publishCB(err) {
if (err) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publishAsUser");
}
......@@ -206,7 +206,7 @@ let userId = 100;
try {
CommonEventManager.publishAsUser("event", userId, options, publishCB);
} 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) {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
} 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) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} 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)
console.info("createSubscriber");
subscriber = commonEventSubscriber;
}).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 = {
// Callback for common event subscription.
function SubscribeCB(err, data) {
if (err.code) {
console.error("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe ");
}
......@@ -342,10 +342,10 @@ function createCB(err, subscriber) {
try {
CommonEventManager.subscribe(subscriber, SubscribeCB);
} catch (err) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
}
} 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) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} 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 = {
// Callback for common event subscription.
function subscribeCB(err, data) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe");
}
......@@ -393,21 +393,21 @@ function subscribeCB(err, data) {
// Callback for subscriber creation.
function createCB(err, subscriber) {
if (err) {
console.info("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("createSubscriber");
// Subscribe to a common event.
try {
CommonEventManager.subscribe(subscriber, subscribeCB);
} 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.
function unsubscribeCB(err) {
if (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribe");
}
......@@ -416,14 +416,14 @@ function unsubscribeCB(err) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} 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.
try {
CommonEventManager.unsubscribe(subscriber, unsubscribeCB);
} 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.
// Callback for code obtaining of an ordered common event.
function getCodeCB(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 {
console.info("getCode " + JSON.stringify(code));
}
......@@ -485,7 +485,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code));
}).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.
// Callback for code setting of an ordered common event.
function setCodeCB(err) {
if (err.code) {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setCode");
}
......@@ -552,7 +552,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCode(1).then(() => {
console.info("setCode");
}).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.
// Callback for data obtaining of an ordered common event.
function getDataCB(err, data) {
if (err.code) {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getData " + JSON.stringify(data));
}
......@@ -612,7 +612,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data));
}).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.
// Callback for result data setting of an ordered common event
function setDataCB(err) {
if (err.code) {
console.error("setData failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setData");
}
......@@ -677,7 +677,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setData("publish_data_changed").then(() => {
console.info("setData");
}).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.
// Callback for code and data setting of an ordered common event.
function setCodeDataCB(err) {
if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setCodeDataCallback");
}
......@@ -746,7 +746,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData");
}).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.
// Callback for checking whether the current common event is an ordered one.
function isOrderedCB(err, isOrdered) {
if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isOrdered " + JSON.stringify(isOrdered));
}
......@@ -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.
**System capability**: SystemCapability.Notification.CommonEvent
**System capability**: SystemCapability.Notification.CommonEvent
**Return value**
......@@ -806,7 +806,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => {
console.error("isOrdered failed " + JSON.stringify(err));
console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -816,7 +816,7 @@ subscriber.isOrderedCommonEvent().then((isOrdered) => {
isStickyCommonEvent(callback: AsyncCallback<boolean>): void
```
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Notification.CommonEvent
......@@ -834,7 +834,7 @@ let subscriber; // Subscriber object successfully created.
// Callback for checking whether the current common event is a sticky one.
function isStickyCB(err, isSticky) {
if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err));
console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isSticky " + JSON.stringify(isSticky));
}
......@@ -866,7 +866,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky));
}).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.
// Callback for common event aborting.
function abortCB(err) {
if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("abortCommonEvent");
}
......@@ -926,7 +926,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent");
}).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.
// Callback for clearing the aborted state of the current common event.
function clearAbortCB(err) {
if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("clearAbortCommonEvent");
}
......@@ -986,7 +986,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent");
}).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.
// Callback for checking whether the current common event is in the aborted state.
function getAbortCB(err, abortEvent) {
if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("abortCommonEvent " + abortEvent)
}
......@@ -1046,7 +1046,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getAbortCommonEvent().then((abortEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortEvent));
}).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.
// Callback for subscriber information obtaining.
function getCB(err, subscribeInfo) {
if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}
......@@ -1106,7 +1106,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).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.
// Callback for ordered common event finishing.
function finishCB(err) {
if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("FinishCommonEvent");
}
}
subscriber.finishCommonEvent(finishCB);
```
......@@ -1166,7 +1166,7 @@ let subscriber; // Subscriber object successfully created.
subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent");
}).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
// publish callback
function publishCallback(err) {
if (err.code) {
console.info("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish success");
}
......@@ -55,8 +55,6 @@ let notificationRequest = {
Notification.publish(notificationRequest, publishCallback);
```
## Notification.publish
publish(request: NotificationRequest): Promise\<void\>
......@@ -118,7 +116,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call
// publish callback
function publishCallback(err) {
if (err.code) {
console.info("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish success");
}
......@@ -298,8 +296,6 @@ function cancelAllCallback(err) {
Notification.cancelAll(cancelAllCallback);
```
## Notification.cancelAll
cancelAll(): Promise\<void\>
......@@ -316,8 +312,6 @@ Notification.cancelAll().then(() => {
});
```
## Notification.addSlot
addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
......@@ -355,8 +349,6 @@ let notificationSlot = {
Notification.addSlot(notificationSlot, addSlotCallBack);
```
## Notification.addSlot
addSlot(slot: NotificationSlot): Promise\<void\>
......@@ -387,8 +379,6 @@ Notification.addSlot(notificationSlot).then(() => {
});
```
## Notification.addSlot
addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
......@@ -418,8 +408,6 @@ function addSlotCallBack(err) {
Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);
```
## Notification.addSlot
addSlot(type: SlotType): Promise\<void\>
......@@ -442,8 +430,6 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
});
```
## Notification.addSlots
addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): void
......@@ -485,8 +471,6 @@ notificationSlotArray[0] = notificationSlot;
Notification.addSlots(notificationSlotArray, addSlotsCallBack);
```
## Notification.addSlots
addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
......@@ -521,8 +505,6 @@ Notification.addSlots(notificationSlotArray).then(() => {
});
```
## Notification.getSlot
getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
......@@ -553,8 +535,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.getSlot(slotType, getSlotCallback);
```
## Notification.getSlot
getSlot(slotType: SlotType): Promise\<NotificationSlot\>
......@@ -584,8 +564,6 @@ Notification.getSlot(slotType).then((data) => {
});
```
## Notification.getSlots
getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
......@@ -614,8 +592,6 @@ function getSlotsCallback(err, data) {
Notification.getSlots(getSlotsCallback);
```
## Notification.getSlots
getSlots(): Promise\<Array\<NotificationSlot\>>
......@@ -638,8 +614,6 @@ Notification.getSlots().then((data) => {
});
```
## Notification.removeSlot
removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
......@@ -670,8 +644,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.removeSlot(slotType,removeSlotCallback);
```
## Notification.removeSlot
removeSlot(slotType: SlotType): Promise\<void\>
......@@ -695,8 +667,6 @@ Notification.removeSlot(slotType).then(() => {
});
```
## Notification.removeAllSlots
removeAllSlots(callback: AsyncCallback\<void\>): void
......@@ -724,8 +694,6 @@ function removeAllCallBack(err) {
Notification.removeAllSlots(removeAllCallBack);
```
## Notification.removeAllSlots
removeAllSlots(): Promise\<void\>
......@@ -742,8 +710,6 @@ Notification.removeAllSlots().then(() => {
});
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void\>): void
......@@ -787,8 +753,6 @@ let info = {
Notification.subscribe(subscriber, info, subscribeCallback);
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void
......@@ -827,8 +791,6 @@ let subscriber = {
Notification.subscribe(subscriber, subscribeCallback);
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void\>
......@@ -862,8 +824,6 @@ Notification.subscribe(subscriber).then(() => {
});
```
## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void
......@@ -902,8 +862,6 @@ let subscriber = {
Notification.unsubscribe(subscriber, unsubscribeCallback);
```
## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
......@@ -936,8 +894,6 @@ Notification.unsubscribe(subscriber).then(() => {
});
```
## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
......@@ -974,8 +930,6 @@ let bundle = {
Notification.enableNotification(bundle, false, enableNotificationCallback);
```
## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\>
......@@ -1006,8 +960,6 @@ Notification.enableNotification(bundle, false).then(() => {
});
```
## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
......@@ -1043,8 +995,6 @@ let bundle = {
Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
```
## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
......@@ -1080,8 +1030,6 @@ Notification.isNotificationEnabled(bundle).then((data) => {
});
```
## Notification.isNotificationEnabled
isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
......@@ -1114,8 +1062,6 @@ function isNotificationEnabledCallback(err, data) {
Notification.isNotificationEnabled(isNotificationEnabledCallback);
```
## Notification.isNotificationEnabled
isNotificationEnabled(): Promise\<boolean\>
......@@ -1148,8 +1094,6 @@ Notification.isNotificationEnabled().then((data) => {
});
```
## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
......@@ -1186,8 +1130,6 @@ let bundle = {
Notification.displayBadge(bundle, false, displayBadgeCallback);
```
## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
......@@ -1218,8 +1160,6 @@ Notification.displayBadge(bundle, false).then(() => {
});
```
## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
......@@ -1255,8 +1195,6 @@ let bundle = {
Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
```
## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
......@@ -1292,8 +1230,6 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
});
```
## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void
......@@ -1333,8 +1269,6 @@ let notificationSlot = {
Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
```
## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
......@@ -1368,8 +1302,6 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
});
```
## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<NotificationSlot\>>): void
......@@ -1405,8 +1337,6 @@ let bundle = {
Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
```
## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
......@@ -1442,8 +1372,6 @@ Notification.getSlotsByBundle(bundle).then((data) => {
});
```
## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void
......@@ -1479,8 +1407,6 @@ let bundle = {
Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
```
## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
......@@ -1516,8 +1442,6 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
});
```
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void\>): void
......@@ -1560,8 +1484,6 @@ let reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification.remove(bundle, notificationKey, reason, removeCallback);
```
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void\>
......@@ -1598,8 +1520,6 @@ Notification.remove(bundle, notificationKey, reason).then(() => {
});
```
## Notification.remove
remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): void
......@@ -1636,8 +1556,6 @@ let reason = Notification.RemoveReason.CANCEL_REASON_REMOVE;
Notification.remove(hashCode, reason, removeCallback);
```
## Notification.remove
remove(hashCode: string, reason: RemoveReason): Promise\<void\>
......@@ -1667,8 +1585,6 @@ Notification.remove(hashCode, reason).then(() => {
});
```
## Notification.removeAll
removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
......@@ -1704,8 +1620,6 @@ let bundle = {
Notification.removeAll(bundle, removeAllCallback);
```
## Notification.removeAll
removeAll(callback: AsyncCallback\<void\>): void
......@@ -1738,8 +1652,6 @@ function removeAllCallback(err) {
Notification.removeAll(removeAllCallback);
```
## Notification.removeAll
removeAll(bundle?: BundleOption): Promise\<void\>
......@@ -1861,8 +1773,6 @@ function getAllActiveNotificationsCallback(err, data) {
Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
```
## Notification.getAllActiveNotifications
getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
......@@ -1889,8 +1799,6 @@ Notification.getAllActiveNotifications().then((data) => {
});
```
## Notification.getActiveNotificationCount
getActiveNotificationCount(callback: AsyncCallback\<number\>): void
......@@ -1919,8 +1827,6 @@ function getActiveNotificationCountCallback(err, data) {
Notification.getActiveNotificationCount(getActiveNotificationCountCallback);
```
## Notification.getActiveNotificationCount
getActiveNotificationCount(): Promise\<number\>
......@@ -1943,8 +1849,6 @@ Notification.getActiveNotificationCount().then((data) => {
});
```
## Notification.getActiveNotifications
getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void
......@@ -1973,8 +1877,6 @@ function getActiveNotificationsCallback(err, data) {
Notification.getActiveNotifications(getActiveNotificationsCallback);
```
## Notification.getActiveNotifications
getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
......@@ -1997,8 +1899,6 @@ Notification.getActiveNotifications().then((data) => {
});
```
## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
......@@ -2030,8 +1930,6 @@ let groupName = "GroupName";
Notification.cancelGroup(groupName, cancelGroupCallback);
```
## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string): Promise\<void\>
......@@ -2055,8 +1953,6 @@ Notification.cancelGroup(groupName).then(() => {
});
```
## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void
......@@ -2094,8 +1990,6 @@ let groupName = "GroupName";
Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback);
```
## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
......@@ -2125,8 +2019,6 @@ Notification.removeGroupByBundle(bundleOption, groupName).then(() => {
});
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): void
......@@ -2166,8 +2058,6 @@ let doNotDisturbDate = {
Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
......@@ -2241,8 +2131,6 @@ let userId = 1
Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback);
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
......@@ -2311,8 +2199,6 @@ function getDoNotDisturbDateCallback(err, data) {
Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback);
```
## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
......@@ -2375,8 +2261,6 @@ let userId = 1;
Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
```
## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
......@@ -2444,8 +2328,6 @@ function supportDoNotDisturbModeCallback(err,data) {
Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback);
```
## Notification.supportDoNotDisturbMode<sup>8+</sup>
supportDoNotDisturbMode(): Promise\<boolean\>
......@@ -2472,8 +2354,6 @@ Notification.supportDoNotDisturbMode().then((data) => {
});
```
## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): void
......@@ -2504,8 +2384,6 @@ function isSupportTemplateCallback(err, data) {
Notification.isSupportTemplate(templateName, isSupportTemplateCallback);
```
## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string): Promise\<boolean\>
......@@ -2536,8 +2414,6 @@ Notification.isSupportTemplate(templateName).then((data) => {
});
```
## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(callback: AsyncCallback\<void\>): void
......@@ -2566,8 +2442,6 @@ function requestEnableNotificationCallback(err) {
Notification.requestEnableNotification(requestEnableNotificationCallback);
```
## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(): Promise\<void\>
......@@ -2620,8 +2494,6 @@ let enable = true;
Notification.enableDistributed(enable, enabledNotificationCallback);
```
## Notification.enableDistributed<sup>8+</sup>
enableDistributed(enable: boolean): Promise\<void>
......@@ -2678,8 +2550,6 @@ function isDistributedEnabledCallback(err, data) {
Notification.isDistributedEnabled(isDistributedEnabledCallback);
```
## Notification.isDistributedEnabled<sup>8+</sup>
isDistributedEnabled(): Promise\<boolean>
......@@ -2743,8 +2613,6 @@ let enable = true;
Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundleCallback);
```
## Notification.enableDistributedByBundle<sup>8+</sup>
enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void>
......@@ -2814,8 +2682,6 @@ let bundle = {
Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback);
```
## Notification.isDistributedEnabledByBundle<sup>8+</sup>
isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
......@@ -2885,8 +2751,6 @@ function getDeviceRemindTypeCallback(err,data) {
Notification.getDeviceRemindType(getDeviceRemindTypeCallback);
```
## Notification.getDeviceRemindType<sup>8+</sup>
getDeviceRemindType(): Promise\<DeviceRemindType\>
......@@ -3381,8 +3245,6 @@ Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => {
});
```
## NotificationSubscriber
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(() => {
| bundle | string | Yes | Yes | Bundle information of the application.|
| uid | number | Yes | Yes | User ID.|
## NotificationKey
**System capability**: SystemCapability.Notification.Notification
......
......@@ -36,6 +36,8 @@ Subscribes to a notification with the subscription information specified. This A
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -48,7 +50,7 @@ Subscribes to a notification with the subscription information specified. This A
// subscribe callback
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe success");
}
......@@ -86,6 +88,8 @@ Subscribes to notifications of all applications under this user. This API uses a
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -97,7 +101,7 @@ Subscribes to notifications of all applications under this user. This API uses a
```js
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe success");
}
......@@ -134,6 +138,8 @@ Subscribes to a notification with the subscription information specified. This A
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -177,6 +183,8 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -188,7 +196,7 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu
```js
function unsubscribeCallback(err) {
if (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribe success");
}
......@@ -222,6 +230,8 @@ Unsubscribes from a notification. This API uses a promise 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. |
......@@ -265,6 +275,8 @@ Removes a notification for a specified application. This API uses an asynchronou
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ---------------------------------------- |
| 1600001 | Internal error. |
......@@ -278,7 +290,7 @@ Removes a notification for a specified application. This API uses an asynchronou
```js
function removeCallback(err) {
if (err) {
console.info("remove failed " + JSON.stringify(err));
console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("remove success");
}
......@@ -318,6 +330,8 @@ Removes a notification for a specified application. This API uses a promise to r
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ---------------------------------------- |
| 1600001 | Internal error. |
......@@ -364,6 +378,8 @@ Removes a specified notification. This API uses an asynchronous callback to retu
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -378,7 +394,7 @@ let hashCode = 'hashCode';
function removeCallback(err) {
if (err) {
console.info("remove failed " + JSON.stringify(err));
console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("remove success");
}
......@@ -408,6 +424,8 @@ Removes a specified notification. This API uses a promise 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. |
......@@ -446,6 +464,8 @@ Removes all notifications for a specified application. This API uses an asynchro
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ---------------------------------------- |
| 1600001 | Internal error. |
......@@ -458,7 +478,7 @@ Removes all notifications for a specified application. This API uses an asynchro
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -489,6 +509,8 @@ Removes all notifications. This API uses an asynchronous callback to return the
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -500,7 +522,7 @@ Removes all notifications. This API uses an asynchronous callback to return the
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -529,6 +551,8 @@ Removes all notifications for a specified application. This API uses a promise t
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ---------------------------------------- |
| 1600001 | Internal error. |
......@@ -566,6 +590,8 @@ Removes all notifications for a specified user. This API uses an asynchronous ca
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -578,7 +604,7 @@ Removes all notifications for a specified user. This API uses an asynchronous ca
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -609,6 +635,8 @@ Removes all notifications for a specified user. This API uses a promise to retur
**Error codes**
For details about the error codes, see [Notification Error Codes](../errorcodes/errorcode-notification.md).
| ID| Error Message |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
......@@ -621,7 +649,7 @@ Removes all notifications for a specified user. This API uses a promise to retur
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -659,7 +687,7 @@ Callback for receiving notifications.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -699,7 +727,7 @@ Callback for canceling notifications.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -739,7 +767,7 @@ Callback for notification sorting updates.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -771,7 +799,7 @@ Callback for subscription.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -803,14 +831,14 @@ Callback for unsubscription.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
};
function unsubscribeCallback(err) {
if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribeCallback");
}
......@@ -849,7 +877,7 @@ Callback for service disconnection.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -887,7 +915,7 @@ Callback for DND time setting updates.
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -926,7 +954,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -945,6 +973,46 @@ let subscriber = {
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
**System capability**: SystemCapability.Notification.Notification
......@@ -1054,3 +1122,15 @@ Provides the notification user input.
| -------------------- | --- | -------------------- |
| CLICK_REASON_REMOVE | 1 | The notification is removed after a click on it. |
| 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.
先完成此消息的编辑!
想要评论请 注册