You need to sign in or sign up before continuing.
提交 eb1d2761 编写于 作者: F fangJinliang1

fix notification doc

Signed-off-by: NfangJinliang1 <fangjinliang1@huawei.com>
Change-Id: I6b32d743b08c5528c195387bd454c4e5d47db44d
Signed-off-by: NfangJinliang1 <fangjinliang1@huawei.com>
上级 05e22c92
...@@ -3058,7 +3058,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb ...@@ -3058,7 +3058,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb
cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void\> cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void\>
代理通知(Promise形式)。 取消代理通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
......
...@@ -22,10 +22,10 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void ...@@ -22,10 +22,10 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- | | -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| callback | AsyncCallback\<void\> | 是 | 被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 发布通知的回调方法。 |
**错误码:** **错误码:**
...@@ -76,9 +76,9 @@ publish(request: NotificationRequest): Promise\<void\> ...@@ -76,9 +76,9 @@ publish(request: NotificationRequest): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- | | -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
**错误码:** **错误码:**
...@@ -94,7 +94,7 @@ publish(request: NotificationRequest): Promise\<void\> ...@@ -94,7 +94,7 @@ publish(request: NotificationRequest): Promise\<void\>
**示例:** **示例:**
```js ```js
//通知Request对象 // 通知Request对象
var notificationRequest = { var notificationRequest = {
notificationId: 1, notificationId: 1,
content: { content: {
...@@ -107,7 +107,7 @@ var notificationRequest = { ...@@ -107,7 +107,7 @@ var notificationRequest = {
} }
} }
Notification.publish(notificationRequest).then(() => { Notification.publish(notificationRequest).then(() => {
console.info("publish sucess"); console.info("publish success");
}); });
``` ```
...@@ -116,7 +116,7 @@ Notification.publish(notificationRequest).then(() => { ...@@ -116,7 +116,7 @@ Notification.publish(notificationRequest).then(() => {
publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void\>): void publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void\>): void
发布通知(callback形式)。 发布通知给指定的用户(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -126,10 +126,10 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v ...@@ -126,10 +126,10 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- | | -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
| callback | AsyncCallback\<void\> | 是 | 被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 被指定的回调方法。 |
**错误码:** **错误码:**
...@@ -147,7 +147,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v ...@@ -147,7 +147,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
**示例:** **示例:**
```js ```js
//publish回调 // publish回调
function publishCallback(err) { function publishCallback(err) {
if (err) { if (err) {
console.info("publish failed " + JSON.stringify(err)); console.info("publish failed " + JSON.stringify(err));
...@@ -155,9 +155,9 @@ function publishCallback(err) { ...@@ -155,9 +155,9 @@ function publishCallback(err) {
console.info("publish success"); console.info("publish success");
} }
} }
// 接收通知的用户ID // 用户ID
var userId = 1 var userId = 1
//通知Request对象 // 通知Request对象
var notificationRequest = { var notificationRequest = {
id: 1, id: 1,
content: { content: {
...@@ -176,7 +176,7 @@ Notification.publish(notificationRequest, userId, publishCallback); ...@@ -176,7 +176,7 @@ Notification.publish(notificationRequest, userId, publishCallback);
publish(request: NotificationRequest, userId: number): Promise\<void\> publish(request: NotificationRequest, userId: number): Promise\<void\>
发布通知(Promise形式)。 发布通知给指定的用户(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -186,10 +186,10 @@ publish(request: NotificationRequest, userId: number): Promise\<void\> ...@@ -186,10 +186,10 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- | | -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
**错误码:** **错误码:**
...@@ -221,7 +221,7 @@ var notificationRequest = { ...@@ -221,7 +221,7 @@ var notificationRequest = {
var userId = 1 var userId = 1
Notification.publish(notificationRequest, userId).then(() => { Notification.publish(notificationRequest, userId).then(() => {
console.info("publish sucess"); console.info("publish success");
}); });
``` ```
...@@ -230,13 +230,13 @@ Notification.publish(notificationRequest, userId).then(() => { ...@@ -230,13 +230,13 @@ Notification.publish(notificationRequest, userId).then(() => {
cancel(id: number, label: string, callback: AsyncCallback\<void\>): void cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
取消与指定id和label相匹配的已发布通知(callback形式)。 通过通知ID和通知标签取消已发布的通知(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| id | number | 是 | 通知ID。 | | id | number | 是 | 通知ID。 |
| label | string | 是 | 通知标签。 | | label | string | 是 | 通知标签。 |
...@@ -254,7 +254,7 @@ cancel(id: number, label: string, callback: AsyncCallback\<void\>): void ...@@ -254,7 +254,7 @@ cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
**示例:** **示例:**
```js ```js
//cancel回调 // cancel回调
function cancelCallback(err) { function cancelCallback(err) {
if (err) { if (err) {
console.info("cancel failed " + JSON.stringify(err)); console.info("cancel failed " + JSON.stringify(err));
...@@ -271,13 +271,13 @@ Notification.cancel(0, "label", cancelCallback) ...@@ -271,13 +271,13 @@ Notification.cancel(0, "label", cancelCallback)
cancel(id: number, label?: string): Promise\<void\> cancel(id: number, label?: string): Promise\<void\>
取消与指定id相匹配的已发布通知,label可以指定也可以不指定(Promise形式)。 取消与指定通知ID相匹配的已发布通知,label可以指定也可以不指定(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | -------- | | ----- | ------ | ---- | -------- |
| id | number | 是 | 通知ID。 | | id | number | 是 | 通知ID。 |
| label | string | 否 | 通知标签。 | | label | string | 否 | 通知标签。 |
...@@ -295,7 +295,7 @@ cancel(id: number, label?: string): Promise\<void\> ...@@ -295,7 +295,7 @@ cancel(id: number, label?: string): Promise\<void\>
```js ```js
Notification.cancel(0).then(() => { Notification.cancel(0).then(() => {
console.info("cancel sucess"); console.info("cancel success");
}); });
``` ```
...@@ -305,13 +305,13 @@ Notification.cancel(0).then(() => { ...@@ -305,13 +305,13 @@ Notification.cancel(0).then(() => {
cancel(id: number, callback: AsyncCallback\<void\>): void cancel(id: number, callback: AsyncCallback\<void\>): void
取消与指定id相匹配的已发布通知(callback形式)。 取消与指定通知ID相匹配的已发布通知(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| id | number | 是 | 通知ID。 | | id | number | 是 | 通知ID。 |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -328,7 +328,7 @@ cancel(id: number, callback: AsyncCallback\<void\>): void ...@@ -328,7 +328,7 @@ cancel(id: number, callback: AsyncCallback\<void\>): void
**示例:** **示例:**
```js ```js
//cancel回调 // cancel回调
function cancelCallback(err) { function cancelCallback(err) {
if (err) { if (err) {
console.info("cancel failed " + JSON.stringify(err)); console.info("cancel failed " + JSON.stringify(err));
...@@ -359,14 +359,14 @@ cancelAll(callback: AsyncCallback\<void\>): void ...@@ -359,14 +359,14 @@ cancelAll(callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
**示例:** **示例:**
```js ```js
//cancel回调 // cancel回调
function cancelAllCallback(err) { function cancelAllCallback(err) {
if (err) { if (err) {
console.info("cancelAll failed " + JSON.stringify(err)); console.info("cancelAll failed " + JSON.stringify(err));
...@@ -399,7 +399,7 @@ cancelAll(): Promise\<void\> ...@@ -399,7 +399,7 @@ cancelAll(): Promise\<void\>
```js ```js
Notification.cancelAll().then(() => { Notification.cancelAll().then(() => {
console.info("cancelAll sucess"); console.info("cancelAll success");
}); });
``` ```
...@@ -419,7 +419,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void ...@@ -419,7 +419,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | | slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -435,7 +435,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void ...@@ -435,7 +435,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
**示例:** **示例:**
```js ```js
//addslot回调 // addslot回调
function addSlotCallBack(err) { function addSlotCallBack(err) {
if (err) { if (err) {
console.info("addSlot failed " + JSON.stringify(err)); console.info("addSlot failed " + JSON.stringify(err));
...@@ -443,7 +443,7 @@ function addSlotCallBack(err) { ...@@ -443,7 +443,7 @@ function addSlotCallBack(err) {
console.info("addSlot success"); console.info("addSlot success");
} }
} }
//通知slot对象 // 通知slot对象
var notificationSlot = { var notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} }
...@@ -466,7 +466,7 @@ addSlot(slot: NotificationSlot): Promise\<void\> ...@@ -466,7 +466,7 @@ addSlot(slot: NotificationSlot): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ---------------- | ---- | -------------------- | | ---- | ---------------- | ---- | -------------------- |
| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | | slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 |
...@@ -481,12 +481,12 @@ addSlot(slot: NotificationSlot): Promise\<void\> ...@@ -481,12 +481,12 @@ addSlot(slot: NotificationSlot): Promise\<void\>
**示例:** **示例:**
```js ```js
//通知slot对象 // 通知slot对象
var notificationSlot = { var notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} }
Notification.addSlot(notificationSlot).then(() => { Notification.addSlot(notificationSlot).then(() => {
console.info("addSlot sucess"); console.info("addSlot success");
}); });
``` ```
...@@ -496,13 +496,13 @@ Notification.addSlot(notificationSlot).then(() => { ...@@ -496,13 +496,13 @@ Notification.addSlot(notificationSlot).then(() => {
addSlot(type: SlotType, callback: AsyncCallback\<void\>): void addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
创建通知通道(callback形式)。 创建指定类型的通知通道(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------- | | -------- | --------------------- | ---- | ---------------------- |
| type | [SlotType](#slottype) | 是 | 要创建的通知通道的类型。 | | type | [SlotType](#slottype) | 是 | 要创建的通知通道的类型。 |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -518,7 +518,7 @@ addSlot(type: SlotType, callback: AsyncCallback\<void\>): void ...@@ -518,7 +518,7 @@ addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
**示例:** **示例:**
```js ```js
//addslot回调 // addslot回调
function addSlotCallBack(err) { function addSlotCallBack(err) {
if (err) { if (err) {
console.info("addSlot failed " + JSON.stringify(err)); console.info("addSlot failed " + JSON.stringify(err));
...@@ -535,13 +535,13 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack ...@@ -535,13 +535,13 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack
addSlot(type: SlotType): Promise\<void\> addSlot(type: SlotType): Promise\<void\>
创建通知通道(Promise形式)。 创建指定类型的通知通道(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | -------- | ---- | ---------------------- | | ---- | -------- | ---- | ---------------------- |
| type | [SlotType](#slottype) | 是 | 要创建的通知通道的类型。 | | type | [SlotType](#slottype) | 是 | 要创建的通知通道的类型。 |
...@@ -557,7 +557,7 @@ addSlot(type: SlotType): Promise\<void\> ...@@ -557,7 +557,7 @@ addSlot(type: SlotType): Promise\<void\>
```js ```js
Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => { Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
console.info("addSlot sucess"); console.info("addSlot success");
}); });
``` ```
...@@ -577,7 +577,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi ...@@ -577,7 +577,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------ | | -------- | ------------------------- | ---- | ------------------------ |
| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | | slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -593,7 +593,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi ...@@ -593,7 +593,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
**示例:** **示例:**
```js ```js
//addSlots回调 // addSlots回调
function addSlotsCallBack(err) { function addSlotsCallBack(err) {
if (err) { if (err) {
console.info("addSlots failed " + JSON.stringify(err)); console.info("addSlots failed " + JSON.stringify(err));
...@@ -601,11 +601,11 @@ function addSlotsCallBack(err) { ...@@ -601,11 +601,11 @@ function addSlotsCallBack(err) {
console.info("addSlots success"); console.info("addSlots success");
} }
} }
//通知slot对象 // 通知slot对象
var notificationSlot = { var notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} }
//通知slot array 对象 // 通知slot array 对象
var notificationSlotArray = new Array(); var notificationSlotArray = new Array();
notificationSlotArray[0] = notificationSlot; notificationSlotArray[0] = notificationSlot;
...@@ -628,7 +628,7 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\> ...@@ -628,7 +628,7 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ----- | ------------------------- | ---- | ------------------------ | | ----- | ------------------------- | ---- | ------------------------ |
| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | | slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 |
...@@ -643,16 +643,16 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\> ...@@ -643,16 +643,16 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
**示例:** **示例:**
```js ```js
//通知slot对象 // 通知slot对象
var notificationSlot = { var notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} }
//通知slot array 对象 // 通知slot array 对象
var notificationSlotArray = new Array(); var notificationSlotArray = new Array();
notificationSlotArray[0] = notificationSlot; notificationSlotArray[0] = notificationSlot;
Notification.addSlots(notificationSlotArray).then(() => { Notification.addSlots(notificationSlotArray).then(() => {
console.info("addSlots sucess"); console.info("addSlots success");
}); });
``` ```
...@@ -662,15 +662,15 @@ Notification.addSlots(notificationSlotArray).then(() => { ...@@ -662,15 +662,15 @@ Notification.addSlots(notificationSlotArray).then(() => {
getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
获取一个通知通道(callback形式)。 获取一个指定类型的通知通道(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ----------------------------------------------------------- | | -------- | --------------------------------- | ---- | ----------------------------------------------------------- |
| slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | 是 | 表示被指定的回调方法。 |
**错误码:** **错误码:**
...@@ -684,7 +684,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void ...@@ -684,7 +684,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
**示例:** **示例:**
```js ```js
//getSlot回调 // getSlot回调
function getSlotCallback(err,data) { function getSlotCallback(err,data) {
if (err) { if (err) {
console.info("getSlot failed " + JSON.stringify(err)); console.info("getSlot failed " + JSON.stringify(err));
...@@ -702,15 +702,15 @@ Notification.getSlot(slotType, getSlotCallback) ...@@ -702,15 +702,15 @@ Notification.getSlot(slotType, getSlotCallback)
getSlot(slotType: SlotType): Promise\<NotificationSlot\> getSlot(slotType: SlotType): Promise\<NotificationSlot\>
获取一个通知通道(Promise形式)。 获取一个指定类型的通知通道(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ----------------------------------------------------------- | | -------- | -------- | ---- | ----------------------------------------------------------- |
| slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型目前分为社交通信、服务提醒、内容咨询和其他类型。 |
**返回值:** **返回值:**
...@@ -731,7 +731,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\> ...@@ -731,7 +731,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
```js ```js
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; var slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.getSlot(slotType).then((data) => { Notification.getSlot(slotType).then((data) => {
console.info("getSlot sucess, data: " + JSON.stringify(data)); console.info("getSlot success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -747,9 +747,9 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void ...@@ -747,9 +747,9 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------- | | -------- | --------------------------------- | ---- | -------------------- |
| callback | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 |
**错误码:** **错误码:**
...@@ -762,7 +762,7 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void ...@@ -762,7 +762,7 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
**示例:** **示例:**
```js ```js
//getSlots回调 // getSlots回调
function getSlotsCallback(err,data) { function getSlotsCallback(err,data) {
if (err) { if (err) {
console.info("getSlots failed " + JSON.stringify(err)); console.info("getSlots failed " + JSON.stringify(err));
...@@ -801,7 +801,7 @@ getSlots(): Promise\<Array\<NotificationSlot\>> ...@@ -801,7 +801,7 @@ getSlots(): Promise\<Array\<NotificationSlot\>>
```js ```js
Notification.getSlots().then((data) => { Notification.getSlots().then((data) => {
console.info("getSlots sucess, data: " + JSON.stringify(data)); console.info("getSlots success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -811,13 +811,13 @@ Notification.getSlots().then((data) => { ...@@ -811,13 +811,13 @@ Notification.getSlots().then((data) => {
removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
根据通知通道类型删除创建的通知通道(callback形式)。 删除指定类型的通知通道(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ----------------------------------------------------------- | | -------- | --------------------- | ---- | ----------------------------------------------------------- |
| slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -833,7 +833,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void ...@@ -833,7 +833,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
**示例:** **示例:**
```js ```js
//removeSlot回调 // removeSlot回调
function removeSlotCallback(err) { function removeSlotCallback(err) {
if (err) { if (err) {
console.info("removeSlot failed " + JSON.stringify(err)); console.info("removeSlot failed " + JSON.stringify(err));
...@@ -851,13 +851,13 @@ Notification.removeSlot(slotType,removeSlotCallback) ...@@ -851,13 +851,13 @@ Notification.removeSlot(slotType,removeSlotCallback)
removeSlot(slotType: SlotType): Promise\<void\> removeSlot(slotType: SlotType): Promise\<void\>
根据通知通道类型删除创建的通知通道(Promise形式)。 删除指定类型的通知通道(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ----------------------------------------------------------- | | -------- | -------- | ---- | ----------------------------------------------------------- |
| slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
...@@ -874,7 +874,7 @@ removeSlot(slotType: SlotType): Promise\<void\> ...@@ -874,7 +874,7 @@ removeSlot(slotType: SlotType): Promise\<void\>
```js ```js
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; var slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.removeSlot(slotType).then(() => { Notification.removeSlot(slotType).then(() => {
console.info("removeSlot sucess"); console.info("removeSlot success");
}); });
``` ```
...@@ -890,7 +890,7 @@ removeAllSlots(callback: AsyncCallback\<void\>): void ...@@ -890,7 +890,7 @@ removeAllSlots(callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 | | callback | AsyncCallback\<void\> | 是 | 表示被指定的回调方法。 |
...@@ -937,7 +937,7 @@ removeAllSlots(): Promise\<void\> ...@@ -937,7 +937,7 @@ removeAllSlots(): Promise\<void\>
```js ```js
Notification.removeAllSlots().then(() => { Notification.removeAllSlots().then(() => {
console.info("removeAllSlots sucess"); console.info("removeAllSlots success");
}); });
``` ```
...@@ -947,7 +947,7 @@ Notification.removeAllSlots().then(() => { ...@@ -947,7 +947,7 @@ Notification.removeAllSlots().then(() => {
setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
设定指定的通知使能状态(Callback形式)。 设定指定应用的通知使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -957,9 +957,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall ...@@ -957,9 +957,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback\<void\> | 是 | 设定通知使能回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设定通知使能回调函数。 |
...@@ -994,7 +994,7 @@ Notification.setNotificationEnable(bundle, false, setNotificationEnablenCallback ...@@ -994,7 +994,7 @@ Notification.setNotificationEnable(bundle, false, setNotificationEnablenCallback
setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\> setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
设定指定的通知使能状态(Promise形式)。 设定指定应用的通知使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1004,9 +1004,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -1004,9 +1004,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
**错误码:** **错误码:**
...@@ -1025,7 +1025,7 @@ var bundle = { ...@@ -1025,7 +1025,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.setNotificationEnable(bundle, false).then(() => { Notification.setNotificationEnable(bundle, false).then(() => {
console.info("setNotificationEnable sucess"); console.info("setNotificationEnable success");
}); });
``` ```
...@@ -1035,7 +1035,7 @@ Notification.setNotificationEnable(bundle, false).then(() => { ...@@ -1035,7 +1035,7 @@ Notification.setNotificationEnable(bundle, false).then(() => {
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
获取指定的通知使能状态(Callback形式)。 获取指定应用的通知使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1045,9 +1045,9 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): ...@@ -1045,9 +1045,9 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ | | -------- | --------------------- | ---- | ------------------------ |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\<void\> | 是 | 获取通知使能状态回调函数。 | | callback | AsyncCallback\<void\> | 是 | 获取通知使能状态回调函数。 |
**错误码:** **错误码:**
...@@ -1081,7 +1081,7 @@ Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback); ...@@ -1081,7 +1081,7 @@ Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
isNotificationEnabled(bundle: BundleOption): Promise\<boolean\> isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
获取指定的通知使能状态(Promise形式)。 获取指定应用的通知使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1091,15 +1091,15 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\> ...@@ -1091,15 +1091,15 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ------------------ | --------------------------------------------------- |
| Promise\<boolean\> | 以Promise形式返回获取指定的通知使能状态的结果。 | | Promise\<boolean\> | 以Promise形式返回获取指定应用的通知使能状态的结果。 |
**错误码:** **错误码:**
...@@ -1117,7 +1117,7 @@ var bundle = { ...@@ -1117,7 +1117,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.isNotificationEnabled(bundle).then((data) => { Notification.isNotificationEnabled(bundle).then((data) => {
console.info("isNotificationEnabled sucess, data: " + JSON.stringify(data)); console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1137,7 +1137,7 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void ...@@ -1137,7 +1137,7 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ | | -------- | --------------------- | ---- | ------------------------ |
| callback | AsyncCallback\<void\> | 是 | 获取通知使能状态回调函数。 | | callback | AsyncCallback\<void\> | 是 | 获取通知使能状态回调函数。 |
...@@ -1179,9 +1179,9 @@ isNotificationEnabled(): Promise\<boolean\> ...@@ -1179,9 +1179,9 @@ isNotificationEnabled(): Promise\<boolean\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
**返回值:** **返回值:**
...@@ -1202,7 +1202,7 @@ isNotificationEnabled(): Promise\<boolean\> ...@@ -1202,7 +1202,7 @@ isNotificationEnabled(): Promise\<boolean\>
```js ```js
Notification.isNotificationEnabled().then((data) => { Notification.isNotificationEnabled().then((data) => {
console.info("isNotificationEnabled sucess, data: " + JSON.stringify(data)); console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1212,7 +1212,7 @@ Notification.isNotificationEnabled().then((data) => { ...@@ -1212,7 +1212,7 @@ Notification.isNotificationEnabled().then((data) => {
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
设定指定的角标使能状态(Callback形式)。 设定指定应用的角标使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1222,9 +1222,9 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi ...@@ -1222,9 +1222,9 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback\<void\> | 是 | 设定角标使能回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设定角标使能回调函数。 |
...@@ -1259,7 +1259,7 @@ Notification.displayBadge(bundle, false, displayBadgeCallback); ...@@ -1259,7 +1259,7 @@ Notification.displayBadge(bundle, false, displayBadgeCallback);
displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\> displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
设定指定的角标使能状态(Promise形式)。 设定指定应用的角标使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1269,9 +1269,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -1269,9 +1269,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
**错误码:** **错误码:**
...@@ -1290,7 +1290,7 @@ var bundle = { ...@@ -1290,7 +1290,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.displayBadge(bundle, false).then(() => { Notification.displayBadge(bundle, false).then(() => {
console.info("displayBadge sucess"); console.info("displayBadge success");
}); });
``` ```
...@@ -1300,7 +1300,7 @@ Notification.displayBadge(bundle, false).then(() => { ...@@ -1300,7 +1300,7 @@ Notification.displayBadge(bundle, false).then(() => {
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
获取指定的角标使能状态(Callback形式)。 获取指定应用的角标使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1310,9 +1310,9 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void ...@@ -1310,9 +1310,9 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ | | -------- | --------------------- | ---- | ------------------------ |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\<void\> | 是 | 获取角标使能状态回调函数。 | | callback | AsyncCallback\<void\> | 是 | 获取角标使能状态回调函数。 |
**错误码:** **错误码:**
...@@ -1346,7 +1346,7 @@ Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback); ...@@ -1346,7 +1346,7 @@ Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\> isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
获取指定的角标使能状态(Promise形式)。 获取指定应用的角标使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1356,15 +1356,15 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\> ...@@ -1356,15 +1356,15 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<boolean\> | 以Promise形式返回获取指定的角标使能状态。 | | Promise\<boolean\> | 以Promise形式返回获取指定应用的角标使能状态。 |
**错误码:** **错误码:**
...@@ -1382,7 +1382,7 @@ var bundle = { ...@@ -1382,7 +1382,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.isBadgeDisplayed(bundle).then((data) => { Notification.isBadgeDisplayed(bundle).then((data) => {
console.info("isBadgeDisplayed sucess, data: " + JSON.stringify(data)); console.info("isBadgeDisplayed success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1392,7 +1392,7 @@ Notification.isBadgeDisplayed(bundle).then((data) => { ...@@ -1392,7 +1392,7 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void
设定指定包的通知通道状态(Callback形式)。 设定指定应用的通知通道(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1402,9 +1402,9 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal ...@@ -1402,9 +1402,9 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 | | slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 |
| callback | AsyncCallback\<void\> | 是 | 设定通知通道回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设定通知通道回调函数。 |
...@@ -1444,7 +1444,7 @@ Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback); ...@@ -1444,7 +1444,7 @@ Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\> setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
设定指定包的通知通道状态(Promise形式)。 设定指定应用的通知通道(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1454,10 +1454,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\> ...@@ -1454,10 +1454,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| slot | [NotificationSlot](#notificationslot) | 是 | 使能状态。 | | slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 |
**错误码:** **错误码:**
...@@ -1478,7 +1478,7 @@ var notificationSlot = { ...@@ -1478,7 +1478,7 @@ var notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} }
Notification.setSlotByBundle(bundle, notificationSlot).then(() => { Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
console.info("setSlotByBundle sucess"); console.info("setSlotByBundle success");
}); });
``` ```
...@@ -1488,7 +1488,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => { ...@@ -1488,7 +1488,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<NotificationSlot\>>): void getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<NotificationSlot\>>): void
获取指定包的通知通道(Callback形式)。 获取指定应用的所有通知通道(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1498,9 +1498,9 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati ...@@ -1498,9 +1498,9 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------- | | -------- | ---------------------------------------- | ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback<Array\<[NotificationSlot](#notificationslot)\>> | 是 | 获取通知通道回调函数。 | | callback | AsyncCallback<Array\<[NotificationSlot](#notificationslot)\>> | 是 | 获取通知通道回调函数。 |
**错误码:** **错误码:**
...@@ -1534,7 +1534,7 @@ Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback); ...@@ -1534,7 +1534,7 @@ Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>> getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
获取指定包的通知通道(Promise形式)。 获取指定应用的所有通知通道(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1544,15 +1544,15 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>> ...@@ -1544,15 +1544,15 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise<Array\<[NotificationSlot](#notificationslot)\>> | 以Promise形式返回获取指定的通知通道。 | | Promise<Array\<[NotificationSlot](#notificationslot)\>> | 以Promise形式返回获取指定应用的通知通道。 |
**错误码:** **错误码:**
...@@ -1570,7 +1570,7 @@ var bundle = { ...@@ -1570,7 +1570,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.getSlotsByBundle(bundle).then((data) => { Notification.getSlotsByBundle(bundle).then((data) => {
console.info("getSlotsByBundle sucess, data: " + JSON.stringify(data)); console.info("getSlotsByBundle success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1580,7 +1580,7 @@ Notification.getSlotsByBundle(bundle).then((data) => { ...@@ -1580,7 +1580,7 @@ Notification.getSlotsByBundle(bundle).then((data) => {
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void
获取指定包的通知通道数(Callback形式)。 获取指定应用的通知通道数量(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1590,10 +1590,10 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi ...@@ -1590,10 +1590,10 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- | | -------- | ------------------------- | ---- | ---------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\<number\> | 是 | 获取通知通道数回调函数。 | | callback | AsyncCallback\<number\> | 是 | 获取通知通道数回调函数。 |
**错误码:** **错误码:**
...@@ -1626,7 +1626,7 @@ Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback); ...@@ -1626,7 +1626,7 @@ Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
getSlotNumByBundle(bundle: BundleOption): Promise\<number\> getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
获取指定包的通知通道数(Promise形式)。 获取指定应用的通知通道数量(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1636,15 +1636,15 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\> ...@@ -1636,15 +1636,15 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<number\> | 以Promise形式返回获取指定包的通知通道数。 | | Promise\<number\> | 以Promise形式返回获取指定应用的通知通道数量。 |
**错误码:** **错误码:**
...@@ -1662,7 +1662,7 @@ var bundle = { ...@@ -1662,7 +1662,7 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.getSlotNumByBundle(bundle).then((data) => { Notification.getSlotNumByBundle(bundle).then((data) => {
console.info("getSlotNumByBundle sucess, data: " + JSON.stringify(data)); console.info("getSlotNumByBundle success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1673,7 +1673,7 @@ Notification.getSlotNumByBundle(bundle).then((data) => { ...@@ -1673,7 +1673,7 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void
获取活动通知(Callback形式)。 获取当前未删除的所有通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1683,7 +1683,7 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>) ...@@ -1683,7 +1683,7 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>)
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------- |
| callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | 是 | 获取活动通知回调函数。 | | callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | 是 | 获取活动通知回调函数。 |
...@@ -1715,7 +1715,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback); ...@@ -1715,7 +1715,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
获取活动通知(Promise形式)。 获取当前未删除的所有通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1741,7 +1741,7 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification ...@@ -1741,7 +1741,7 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification
```js ```js
Notification.getAllActiveNotifications().then((data) => { Notification.getAllActiveNotifications().then((data) => {
console.info("getAllActiveNotifications sucess, data: " + JSON.stringify(data)); console.info("getAllActiveNotifications success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1751,15 +1751,15 @@ Notification.getAllActiveNotifications().then((data) => { ...@@ -1751,15 +1751,15 @@ Notification.getAllActiveNotifications().then((data) => {
getActiveNotificationCount(callback: AsyncCallback\<number\>): void getActiveNotificationCount(callback: AsyncCallback\<number\>): void
获取当前应用的活动通知数(Callback形式)。 获取当前应用未删除的通知数(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---------------------- | | -------- | ---------------------- | ---- | ---------------------- |
| callback | AsyncCallback\<number\> | 是 | 获取活动通知数回调函数。 | | callback | AsyncCallback\<number\> | 是 | 获取未删除通知数回调函数。 |
**错误码:** **错误码:**
...@@ -1789,15 +1789,15 @@ Notification.getActiveNotificationCount(getActiveNotificationCountCallback); ...@@ -1789,15 +1789,15 @@ Notification.getActiveNotificationCount(getActiveNotificationCountCallback);
getActiveNotificationCount(): Promise\<number\> getActiveNotificationCount(): Promise\<number\>
获取当前应用的活动通知数(Promise形式)。 获取当前应用未删除的通知数(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------- |
| Promise\<number\> | 以Promise形式返回获取当前应用的活动通知数。 | | Promise\<number\> | 以Promise形式返回获取当前应用未删除通知数。 |
**错误码:** **错误码:**
...@@ -1811,7 +1811,7 @@ getActiveNotificationCount(): Promise\<number\> ...@@ -1811,7 +1811,7 @@ getActiveNotificationCount(): Promise\<number\>
```js ```js
Notification.getActiveNotificationCount().then((data) => { Notification.getActiveNotificationCount().then((data) => {
console.info("getActiveNotificationCount sucess, data: " + JSON.stringify(data)); console.info("getActiveNotificationCount success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1821,15 +1821,15 @@ Notification.getActiveNotificationCount().then((data) => { ...@@ -1821,15 +1821,15 @@ Notification.getActiveNotificationCount().then((data) => {
getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): void
获取当前应用的活动通知(Callback形式)。 获取当前应用未删除的通知列表(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
| callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | 是 | 获取当前应用的活动通知回调函数。 | | callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | 是 | 获取当前应用通知列表回调函数。 |
**错误码:** **错误码:**
...@@ -1859,15 +1859,15 @@ Notification.getActiveNotifications(getActiveNotificationsCallback); ...@@ -1859,15 +1859,15 @@ Notification.getActiveNotifications(getActiveNotificationsCallback);
getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationrequest)\>\>
获取当前应用的活动通知(Promise形式)。 获取当前应用未删除的通知列表(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ------------------------------------------------------------ | --------------------------------------- |
| Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> | 以Promise形式返回获取当前应用的活动通知。 | | Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> | 以Promise形式返回获取当前应用通知列表。 |
**错误码:** **错误码:**
...@@ -1881,7 +1881,7 @@ getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationreq ...@@ -1881,7 +1881,7 @@ getActiveNotifications(): Promise\<Array\<[NotificationRequest](#notificationreq
```js ```js
Notification.getActiveNotifications().then((data) => { Notification.getActiveNotifications().then((data) => {
console.info("removeGroupByBundle sucess, data: " + JSON.stringify(data)); console.info("removeGroupByBundle success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -1891,16 +1891,16 @@ Notification.getActiveNotifications().then((data) => { ...@@ -1891,16 +1891,16 @@ Notification.getActiveNotifications().then((data) => {
cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
取消本应用指定组通知(Callback形式)。 取消本应用指定组下的通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- | | --------- | --------------------- | ---- | ---------------------------- |
| groupName | string | 是 | 指定通知组名称。 | | groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](#notificationrequest)对象指定。 |
| callback | AsyncCallback\<void\> | 是 | 取消本应用指定组通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 取消本应用指定组下通知的回调函数。 |
**错误码:** **错误码:**
...@@ -1932,15 +1932,15 @@ Notification.cancelGroup(groupName, cancelGroupCallback); ...@@ -1932,15 +1932,15 @@ Notification.cancelGroup(groupName, cancelGroupCallback);
cancelGroup(groupName: string): Promise\<void\> cancelGroup(groupName: string): Promise\<void\>
取消本应用指定组通知(Promise形式)。 取消本应用指定组下的通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | -------------- | | --------- | ------ | ---- | -------------- |
| groupName | string | 是 | 指定通知组名称。 | | groupName | string | 是 | 通知组名称。 |
**错误码:** **错误码:**
...@@ -1955,7 +1955,7 @@ cancelGroup(groupName: string): Promise\<void\> ...@@ -1955,7 +1955,7 @@ cancelGroup(groupName: string): Promise\<void\>
```js ```js
var groupName = "GroupName"; var groupName = "GroupName";
Notification.cancelGroup(groupName).then(() => { Notification.cancelGroup(groupName).then(() => {
console.info("cancelGroup sucess"); console.info("cancelGroup success");
}); });
``` ```
...@@ -1965,7 +1965,7 @@ Notification.cancelGroup(groupName).then(() => { ...@@ -1965,7 +1965,7 @@ Notification.cancelGroup(groupName).then(() => {
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void
删除指定应用指定组通知(Callback形式)。 删除指定应用的指定组下的通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -1975,11 +1975,11 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall ...@@ -1975,11 +1975,11 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- | | --------- | --------------------- | ---- | ---------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| groupName | string | 是 | 指定通知组名称。 | | groupName | string | 是 | 通知组名称。 |
| callback | AsyncCallback\<void\> | 是 | 删除本应用指定组通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定应用指定组下通知的回调函数。 |
**错误码:** **错误码:**
...@@ -2013,7 +2013,7 @@ Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCal ...@@ -2013,7 +2013,7 @@ Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCal
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
删除指定应用指定组通知(Promise形式)。 删除指定应用的指定组下的通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2023,10 +2023,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> ...@@ -2023,10 +2023,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------ | ---- | -------------- | | --------- | ------------ | ---- | -------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| groupName | string | 是 | 指定通知组名称。 | | groupName | string | 是 | 通知组名称。 |
**错误码:** **错误码:**
...@@ -2043,7 +2043,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> ...@@ -2043,7 +2043,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
var bundleOption = {bundle: "Bundle"}; var bundleOption = {bundle: "Bundle"};
var groupName = "GroupName"; var groupName = "GroupName";
Notification.removeGroupByBundle(bundleOption, groupName).then(() => { Notification.removeGroupByBundle(bundleOption, groupName).then(() => {
console.info("removeGroupByBundle sucess"); console.info("removeGroupByBundle success");
}); });
``` ```
...@@ -2063,7 +2063,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo ...@@ -2063,7 +2063,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------- | | -------- | --------------------- | ---- | ---------------------- |
| date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 | | date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 |
| callback | AsyncCallback\<void\> | 是 | 设置免打扰时间回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设置免打扰时间回调函数。 |
...@@ -2102,7 +2102,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback); ...@@ -2102,7 +2102,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\> setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
设置免打扰时间接口(Promise形式)。 设置免打扰时间(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2112,7 +2112,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\> ...@@ -2112,7 +2112,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---- | ---------------- | ---- | -------------- | | ---- | ---------------- | ---- | -------------- |
| date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 | | date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 |
...@@ -2133,7 +2133,7 @@ var doNotDisturbDate = { ...@@ -2133,7 +2133,7 @@ var doNotDisturbDate = {
end: new Date(2021, 11, 15, 18, 0) end: new Date(2021, 11, 15, 18, 0)
} }
Notification.setDoNotDisturbDate(doNotDisturbDate).then(() => { Notification.setDoNotDisturbDate(doNotDisturbDate).then(() => {
console.info("setDoNotDisturbDate sucess"); console.info("setDoNotDisturbDate success");
}); });
``` ```
...@@ -2152,10 +2152,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb ...@@ -2152,10 +2152,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------- | | -------- | --------------------- | ---- | ---------------------- |
| date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 | | date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 |
| userId | number | 是 | 设置免打扰事件的用户ID。 | | userId | number | 是 | 设置免打扰时间的用户ID。 |
| callback | AsyncCallback\<void\> | 是 | 设置免打扰时间回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设置免打扰时间回调函数。 |
**错误码:** **错误码:**
...@@ -2195,7 +2195,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCa ...@@ -2195,7 +2195,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCa
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\> setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
指定用户设置免打扰时间接口(Promise形式)。 指定用户设置免打扰时间(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2205,10 +2205,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\> ...@@ -2205,10 +2205,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------- | ---- | -------------- | | ------ | ---------------- | ---- | -------------- |
| date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 | | date | [DoNotDisturbDate](#donotdisturbdate) | 是 | 免打扰时间选项。 |
| userId | number | 是 | 设置免打扰事件的用户ID。 | | userId | number | 是 | 设置免打扰时间的用户ID。 |
**错误码:** **错误码:**
...@@ -2231,7 +2231,7 @@ var doNotDisturbDate = { ...@@ -2231,7 +2231,7 @@ var doNotDisturbDate = {
var userId = 1 var userId = 1
Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => { Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
console.info("setDoNotDisturbDate sucess"); console.info("setDoNotDisturbDate success");
}); });
``` ```
...@@ -2240,7 +2240,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => { ...@@ -2240,7 +2240,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
查询免打扰时间接口(Callback形式)。 查询免打扰时间(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2250,7 +2250,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void ...@@ -2250,7 +2250,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ---------------------- | | -------- | --------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | 是 | 查询免打扰时间回调函数。 | | callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | 是 | 查询免打扰时间回调函数。 |
...@@ -2282,7 +2282,7 @@ Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback); ...@@ -2282,7 +2282,7 @@ Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback);
getDoNotDisturbDate(): Promise\<DoNotDisturbDate\> getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
查询免打扰时间接口(Promise形式)。 查询免打扰时间(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2294,7 +2294,7 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\> ...@@ -2294,7 +2294,7 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------------ | ----------------------------------------- | | ------------------------------------------------ | ----------------------------------------- |
| Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | 以Promise形式返回获取查询免打扰时间接口。 | | Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | 以Promise形式返回获取查询到的免打扰时间。 |
**错误码:** **错误码:**
...@@ -2308,7 +2308,7 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\> ...@@ -2308,7 +2308,7 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
```js ```js
Notification.getDoNotDisturbDate().then((data) => { Notification.getDoNotDisturbDate().then((data) => {
console.info("getDoNotDisturbDate sucess, data: " + JSON.stringify(data)); console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -2317,7 +2317,7 @@ Notification.getDoNotDisturbDate().then((data) => { ...@@ -2317,7 +2317,7 @@ Notification.getDoNotDisturbDate().then((data) => {
getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>): void getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>): void
指定用户查询免打扰时间接口(Callback形式)。 查询指定用户的免打扰时间(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2327,10 +2327,10 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>) ...@@ -2327,10 +2327,10 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ---------------------- | | -------- | --------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | 是 | 查询免打扰时间回调函数。 | | callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | 是 | 查询免打扰时间回调函数。 |
| userId | number | 是 | 设置免打扰事件的用户ID。 | | userId | number | 是 | 用户ID。 |
**错误码:** **错误码:**
...@@ -2363,7 +2363,7 @@ Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback); ...@@ -2363,7 +2363,7 @@ Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
指定用户查询免打扰时间接口(Promise形式)。 查询指定用户的免打扰时间(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2373,15 +2373,15 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> ...@@ -2373,15 +2373,15 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ---------------------- | | -------- | --------------------------------- | ---- | ---------------------- |
| userId | number | 是 | 设置免打扰事件的用户ID。 | | userId | number | 是 | 用户ID。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------------------ | ----------------------------------------- | | ------------------------------------------------ | ----------------------------------------- |
| Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | 以Promise形式返回获取查询免打扰时间接口。 | | Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | 以Promise形式返回获取查询到的免打扰时间。 |
**错误码:** **错误码:**
...@@ -2398,7 +2398,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> ...@@ -2398,7 +2398,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
var userId = 1 var userId = 1
Notification.getDoNotDisturbDate(userId).then((data) => { Notification.getDoNotDisturbDate(userId).then((data) => {
console.info("getDoNotDisturbDate sucess, data: " + JSON.stringify(data)); console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -2407,7 +2407,7 @@ Notification.getDoNotDisturbDate(userId).then((data) => { ...@@ -2407,7 +2407,7 @@ Notification.getDoNotDisturbDate(userId).then((data) => {
supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
查询是否支持勿扰模式功能(Callback形式)。 查询是否支持免打扰功能(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2417,9 +2417,9 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void ...@@ -2417,9 +2417,9 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------------- | | -------- | ------------------------ | ---- | -------------------------------- |
| callback | AsyncCallback\<boolean\> | 是 | 查询是否支持勿扰模式功能回调函数。 | | callback | AsyncCallback\<boolean\> | 是 | 查询是否支持免打扰功能回调函数。 |
**错误码:** **错误码:**
...@@ -2461,7 +2461,7 @@ supportDoNotDisturbMode(): Promise\<boolean\> ...@@ -2461,7 +2461,7 @@ supportDoNotDisturbMode(): Promise\<boolean\>
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<boolean\> | 以Promise形式返回获取是否支持勿扰模式功能的结果。 | | Promise\<boolean\> | 以Promise形式返回获取是否支持免打扰功能的结果。 |
**错误码:** **错误码:**
...@@ -2475,7 +2475,7 @@ supportDoNotDisturbMode(): Promise\<boolean\> ...@@ -2475,7 +2475,7 @@ supportDoNotDisturbMode(): Promise\<boolean\>
```js ```js
Notification.supportDoNotDisturbMode().then((data) => { Notification.supportDoNotDisturbMode().then((data) => {
console.info("supportDoNotDisturbMode sucess, data: " + JSON.stringify(data)); console.info("supportDoNotDisturbMode success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -2620,10 +2620,9 @@ requestEnableNotification(): Promise\<void\> ...@@ -2620,10 +2620,9 @@ requestEnableNotification(): Promise\<void\>
**示例:** **示例:**
```javascript ```javascript
Notification.requestEnableNotification() Notification.requestEnableNotification().then(() => {
.then(() => { console.info("requestEnableNotification success");
console.info("requestEnableNotification sucess"); });
});
``` ```
...@@ -2644,7 +2643,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void ...@@ -2644,7 +2643,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- | | -------- | ------------------------ | ---- | -------------------------- |
| enable | boolean | 是 | 是否支持。<br/>true 支持。<br/>false 不支持。| | enable | boolean | 是 | 是否支持。 |
| callback | AsyncCallback\<void\> | 是 | 设置设备是否支持分布式通知的回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设置设备是否支持分布式通知的回调函数。 |
**错误码:** **错误码:**
...@@ -2690,7 +2689,7 @@ setDistributedEnable(enable: boolean): Promise\<void> ...@@ -2690,7 +2689,7 @@ setDistributedEnable(enable: boolean): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- | | -------- | ------------------------ | ---- | -------------------------- |
| enable | boolean | 是 | 是否支持。<br/>true 支持。<br/>false 不支持。| | enable | boolean | 是 | 是否支持。 |
**错误码:** **错误码:**
...@@ -2706,9 +2705,8 @@ setDistributedEnable(enable: boolean): Promise\<void> ...@@ -2706,9 +2705,8 @@ setDistributedEnable(enable: boolean): Promise\<void>
```javascript ```javascript
var enable = true var enable = true
Notification.setDistributedEnable(enable) Notification.setDistributedEnable(enable).then(() => {
.then(() => { console.info("setDistributedEnable success");
console.info("setDistributedEnable sucess");
}); });
``` ```
...@@ -2717,7 +2715,7 @@ Notification.setDistributedEnable(enable) ...@@ -2717,7 +2715,7 @@ Notification.setDistributedEnable(enable)
isDistributedEnabled(callback: AsyncCallback\<boolean>): void isDistributedEnabled(callback: AsyncCallback\<boolean>): void
获取设备是否支持分布式通知(Callback形式)。 查询设备是否支持分布式通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2739,11 +2737,11 @@ isDistributedEnabled(callback: AsyncCallback\<boolean>): void ...@@ -2739,11 +2737,11 @@ isDistributedEnabled(callback: AsyncCallback\<boolean>): void
**示例:** **示例:**
```javascript ```javascript
function isDistributedEnabledCallback(err) { function isDistributedEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isDistributedEnabled failed " + JSON.stringify(err)); console.info("isDistributedEnabled failed " + JSON.stringify(err));
} else { } else {
console.info("isDistributedEnabled success"); console.info("isDistributedEnabled success " + JSON.stringify(data));
} }
}; };
...@@ -2756,15 +2754,15 @@ Notification.isDistributedEnabled(isDistributedEnabledCallback); ...@@ -2756,15 +2754,15 @@ Notification.isDistributedEnabled(isDistributedEnabledCallback);
isDistributedEnabled(): Promise\<boolean> isDistributedEnabled(): Promise\<boolean>
获取设备是否支持分布式通知(Promise形式)。 查询设备是否支持分布式通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------ | --------------- | | ------------------ | --------------------------------------------- |
| Promise\<boolean\> | Promise方式返回设备是否支持分布式通知的结果。<br/>true 支持。<br/>false 不支持。 | | Promise\<boolean\> | Promise方式返回设备是否支持分布式通知的结果。 |
**错误码:** **错误码:**
...@@ -2780,7 +2778,7 @@ isDistributedEnabled(): Promise\<boolean> ...@@ -2780,7 +2778,7 @@ isDistributedEnabled(): Promise\<boolean>
```javascript ```javascript
Notification.isDistributedEnabled() Notification.isDistributedEnabled()
.then((data) => { .then((data) => {
console.info("isDistributedEnabled sucess, data: " + JSON.stringify(data)); console.info("isDistributedEnabled success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -2789,7 +2787,7 @@ Notification.isDistributedEnabled() ...@@ -2789,7 +2787,7 @@ Notification.isDistributedEnabled()
setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void
根据应用的包设置应用程序是否支持分布式通知(Callback形式)。 设置指定应用是否支持分布式通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2801,7 +2799,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As ...@@ -2801,7 +2799,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- | | -------- | ------------------------ | ---- | -------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 应用的包 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| enable | boolean | 是 | 是否支持。 | | enable | boolean | 是 | 是否支持。 |
| callback | AsyncCallback\<void\> | 是 | 应用程序是否支持分布式通知的回调函数。 | | callback | AsyncCallback\<void\> | 是 | 应用程序是否支持分布式通知的回调函数。 |
...@@ -2841,7 +2839,7 @@ Notification.setDistributedEnableByBundle(bundle, enable, setDistributedEnableBy ...@@ -2841,7 +2839,7 @@ Notification.setDistributedEnableByBundle(bundle, enable, setDistributedEnableBy
setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<void> setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<void>
根据应用的包设置应用程序是否支持分布式通知(Promise形式)。 设置指定应用是否支持分布式通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2875,9 +2873,8 @@ var bundle = { ...@@ -2875,9 +2873,8 @@ var bundle = {
var enable = true var enable = true
Notification.setDistributedEnableByBundle(bundle, enable) Notification.setDistributedEnableByBundle(bundle, enable).then(() => {
.then(() => { console.info("setDistributedEnableByBundle success");
console.info("setDistributedEnableByBundle sucess");
}); });
``` ```
...@@ -2898,7 +2895,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool ...@@ -2898,7 +2895,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- | | -------- | ------------------------ | ---- | -------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 应用的包。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包。 |
| callback | AsyncCallback\<boolean\> | 是 | 应用程序是否支持分布式通知的回调函数。 | | callback | AsyncCallback\<boolean\> | 是 | 查询指定应用是否支持分布式通知的回调函数。 |
**错误码:** **错误码:**
...@@ -2917,7 +2914,7 @@ function isDistributedEnabledByBundleCallback(data) { ...@@ -2917,7 +2914,7 @@ function isDistributedEnabledByBundleCallback(data) {
if (err) { if (err) {
console.info("isDistributedEnabledByBundle failed " + JSON.stringify(err)); console.info("isDistributedEnabledByBundle failed " + JSON.stringify(err));
} else { } else {
console.info("isDistributedEnabledByBundle success"); console.info("isDistributedEnabledByBundle success" + JSON.stringify(data));
} }
}; };
...@@ -2934,7 +2931,7 @@ Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCa ...@@ -2934,7 +2931,7 @@ Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCa
isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean> isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
根据应用的包获取应用程序是否支持分布式通知(Promise形式)。 查询指定应用是否支持分布式通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -2951,8 +2948,8 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean> ...@@ -2951,8 +2948,8 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------ | --------------- | | ------------------ | ------------------------------------------------- |
| Promise\<boolean\> | Promise方式返回应用程序是否支持分布式通知的结果。<br/>true 支持。<br/>false 不支持。 | | Promise\<boolean\> | Promise方式返回指定应用是否支持分布式通知的结果。 |
**错误码:** **错误码:**
...@@ -2971,10 +2968,9 @@ var bundle = { ...@@ -2971,10 +2968,9 @@ var bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} }
Notification.isDistributedEnabledByBundle(bundle) Notification.isDistributedEnabledByBundle(bundle).then((data) => {
.then((data) => { console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data));
console.info("isDistributedEnabledByBundle sucess, data: " + JSON.stringify(data)); });
});
``` ```
...@@ -2994,7 +2990,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void ...@@ -2994,7 +2990,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------- | | -------- | --------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback\<[DeviceRemindType](#deviceremindtype)\> | 是 | 获取通知提醒方式的回调函数。 | | callback | AsyncCallback\<[DeviceRemindType](#deviceremindtype)\> | 是 | 获取通知提醒方式的回调函数。 |
**错误码:** **错误码:**
...@@ -3036,7 +3032,7 @@ getDeviceRemindType(): Promise\<DeviceRemindType\> ...@@ -3036,7 +3032,7 @@ getDeviceRemindType(): Promise\<DeviceRemindType\>
| 类型 | 说明 | | 类型 | 说明 |
| ------------------ | --------------- | | ------------------ | --------------- |
| Promise\<[DeviceRemindType](#deviceremindtype)\> | Promise方式返回通知的提醒方式的结果。 | | Promise\<[DeviceRemindType](#deviceremindtype)\> | Promise方式返回获取通知提醒方式的结果。 |
**错误码:** **错误码:**
...@@ -3049,10 +3045,9 @@ getDeviceRemindType(): Promise\<DeviceRemindType\> ...@@ -3049,10 +3045,9 @@ getDeviceRemindType(): Promise\<DeviceRemindType\>
**示例:** **示例:**
```javascript ```javascript
Notification.getDeviceRemindType() Notification.getDeviceRemindType().then((data) => {
.then((data) => { console.info("getDeviceRemindType success, data: " + JSON.stringify(data));
console.info("getDeviceRemindType sucess, data: " + JSON.stringify(data)); });
});
``` ```
...@@ -3071,10 +3066,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -3071,10 +3066,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | | -------------------- | ------------------------------------------- | ---- | ---------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| representativeBundle | string | 是 | 被代理应用的包名。 | | representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
| callback | AsyncCallback | 是 | 发布代理通知的回调方法。 | | callback | AsyncCallback | 是 | 发布代理通知的回调方法。 |
**错误码:** **错误码:**
...@@ -3093,7 +3088,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -3093,7 +3088,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
```js ```js
//publishAsBundle回调 //publishAsBundle回调
function publishAsBundleCallback(err) { function callback(err) {
if (err) { if (err) {
console.info("publishAsBundle failed " + JSON.stringify(err)); console.info("publishAsBundle failed " + JSON.stringify(err));
} else { } else {
...@@ -3102,10 +3097,10 @@ function publishAsBundleCallback(err) { ...@@ -3102,10 +3097,10 @@ function publishAsBundleCallback(err) {
} }
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo"
// 接收通知的用户ID // 用户ID
let userId = 100 let userId = 100
//通知Request对象 // NotificationRequest对象
let notificationRequest = { let request = {
id: 1, id: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -3117,7 +3112,7 @@ let notificationRequest = { ...@@ -3117,7 +3112,7 @@ let notificationRequest = {
} }
} }
Notification.publishAsBundle(notificationRequest, representativeBundle, userId, publishAsBundleCallback); Notification.publishAsBundle(request, representativeBundle, userId, callback);
``` ```
## Notification.publishAsBundle ## Notification.publishAsBundle
...@@ -3137,9 +3132,9 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -3137,9 +3132,9 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
| request | [NotificationRequest](#notificationrequest) | 是 | 设置要发布通知内容的NotificationRequest对象。 | | request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| representativeBundle | string | 是 | 被代理应用的包名。 | | representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
**错误码:** **错误码:**
...@@ -3158,10 +3153,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -3158,10 +3153,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
```js ```js
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo"
// 接收通知的用户ID // 用户ID
let userId = 100 let userId = 100
//通知Request对象 // NotificationRequest对象
var notificationRequest = { var request = {
id: 1, id: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -3173,8 +3168,8 @@ var notificationRequest = { ...@@ -3173,8 +3168,8 @@ var notificationRequest = {
} }
} }
Notification.publishAsBundle(notificationRequest, representativeBundle, userId).then(() => { Notification.publishAsBundle(request, representativeBundle, userId).then(() => {
console.info("publishAsBundle sucess"); console.info("publishAsBundle success");
}); });
``` ```
...@@ -3198,7 +3193,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac ...@@ -3198,7 +3193,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
| -------------------- | ------------- | ---- | ------------------------ | | -------------------- | ------------- | ---- | ------------------------ |
| id | number | 是 | 通知ID。 | | id | number | 是 | 通知ID。 |
| representativeBundle | string | 是 | 被代理应用的包名。 | | representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
| callback | AsyncCallback | 是 | 取消代理通知的回调方法。 | | callback | AsyncCallback | 是 | 取消代理通知的回调方法。 |
**错误码:** **错误码:**
...@@ -3214,7 +3209,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac ...@@ -3214,7 +3209,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
**示例:** **示例:**
```js ```js
//cancelAsBundle // cancelAsBundle
function cancelAsBundleCallback(err) { function cancelAsBundleCallback(err) {
if (err) { if (err) {
console.info("cancelAsBundle failed " + JSON.stringify(err)); console.info("cancelAsBundle failed " + JSON.stringify(err));
...@@ -3224,7 +3219,7 @@ function cancelAsBundleCallback(err) { ...@@ -3224,7 +3219,7 @@ function cancelAsBundleCallback(err) {
} }
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo"
// 接收通知的用户ID // 用户ID
let userId = 100 let userId = 100
Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback); Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback);
...@@ -3234,7 +3229,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb ...@@ -3234,7 +3229,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb
cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void\> cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void\>
发布代理通知(Promise形式)。 取消代理通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3250,7 +3245,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis ...@@ -3250,7 +3245,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
| -------------------- | ------ | ---- | ------------------ | | -------------------- | ------ | ---- | ------------------ |
| id | number | 是 | 通知ID。 | | id | number | 是 | 通知ID。 |
| representativeBundle | string | 是 | 被代理应用的包名。 | | representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
**错误码:** **错误码:**
...@@ -3267,7 +3262,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis ...@@ -3267,7 +3262,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
```js ```js
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo"
// 接收通知的用户ID // 用户ID
let userId = 100 let userId = 100
Notification.cancelAsBundle(0, representativeBundle, userId).then(() => { Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
...@@ -3279,7 +3274,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId).then(() => { ...@@ -3279,7 +3274,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\<void>): void setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\<void>): void
定指定类型的渠道使能状态(Callback形式)。 置指定应用的指定渠道类型的使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3291,10 +3286,10 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, ...@@ -3291,10 +3286,10 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean,
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- | | -------- | ----------------------------- | ---- | ---------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | type | [SlotType](#slottype) | 是 | 指定渠道类型。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback\<void\> | 是 | 设渠道使能回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设渠道使能回调函数。 |
**错误码:** **错误码:**
...@@ -3308,7 +3303,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, ...@@ -3308,7 +3303,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean,
**示例:** **示例:**
```js ```js
//setNotificationEnableSlot // setNotificationEnableSlot
function setNotificationEnableSlotCallback(err) { function setNotificationEnableSlotCallback(err) {
if (err) { if (err) {
console.info("setNotificationEnableSlot failed " + JSON.stringify(err)); console.info("setNotificationEnableSlot failed " + JSON.stringify(err));
...@@ -3328,7 +3323,7 @@ Notification.setNotificationEnableSlot( ...@@ -3328,7 +3323,7 @@ Notification.setNotificationEnableSlot(
setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\<void> setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\<void>
定指定类型的渠道使能状态(Promise形式)。 置指定应用的指定渠道类型的使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3340,8 +3335,8 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) ...@@ -3340,8 +3335,8 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean)
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 |
| enable | boolean | 是 | 使能状态。 | | enable | boolean | 是 | 使能状态。 |
**错误码:** **错误码:**
...@@ -3356,12 +3351,12 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) ...@@ -3356,12 +3351,12 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean)
**示例:** **示例:**
```js ```js
//setNotificationEnableSlot // setNotificationEnableSlot
Notification.setNotificationEnableSlot( Notification.setNotificationEnableSlot(
{ bundle: "ohos.samples.notification", }, { bundle: "ohos.samples.notification", },
Notification.SlotType.SOCIAL_COMMUNICATION, Notification.SlotType.SOCIAL_COMMUNICATION,
true).then(() => { true).then(() => {
console.info("setNotificationEnableSlot sucess"); console.info("setNotificationEnableSlot success");
}); });
``` ```
...@@ -3369,7 +3364,7 @@ Notification.setNotificationEnableSlot( ...@@ -3369,7 +3364,7 @@ Notification.setNotificationEnableSlot(
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\<boolean\>): void isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\<boolean\>): void
获取指定类型的渠道使能状态(Callback形式)。 获取指定应用的指定渠道类型的使能状态(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3381,9 +3376,9 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC ...@@ -3381,9 +3376,9 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- | | -------- | ----------------------------- | ---- | ---------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 |
| callback | AsyncCallback\<boolean\> | 是 | 设定渠道使能回调函数。 | | callback | AsyncCallback\<boolean\> | 是 | 获取渠道使能状态回调函数。 |
**错误码:** **错误码:**
...@@ -3397,7 +3392,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC ...@@ -3397,7 +3392,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
**示例:** **示例:**
```js ```js
//isNotificationSlotEnabled // isNotificationSlotEnabled
function getEnableSlotCallback(err, data) { function getEnableSlotCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationSlotEnabled failed " + JSON.stringify(err)); console.info("isNotificationSlotEnabled failed " + JSON.stringify(err));
...@@ -3416,7 +3411,7 @@ Notification.isNotificationSlotEnabled( ...@@ -3416,7 +3411,7 @@ Notification.isNotificationSlotEnabled(
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolean\> isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolean\>
获取指定类型的渠道使能状态(Promise形式)。 获取指定应用的指定渠道类型的使能状态(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3428,8 +3423,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea ...@@ -3428,8 +3423,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
| type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 |
**返回值:** **返回值:**
...@@ -3449,13 +3444,11 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea ...@@ -3449,13 +3444,11 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea
**示例:** **示例:**
```js ```js
//isNotificationSlotEnabled // isNotificationSlotEnabled
Notification.isNotificationSlotEnabled( Notification.isNotificationSlotEnabled({ bundle: "ohos.samples.notification", },
{ bundle: "ohos.samples.notification", }, Notification.SlotType.SOCIAL_COMMUNICATION).then((data) => {
Notification.SlotType.SOCIAL_COMMUNICATION
).then((data) => {
console.info("isNotificationSlotEnabled success, data: " + JSON.stringify(data)); console.info("isNotificationSlotEnabled success, data: " + JSON.stringify(data));
}); });
``` ```
...@@ -3475,8 +3468,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: ...@@ -3475,8 +3468,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户Id。 | | userId | number | 是 | 用户ID。 |
| enable | boolean | 是 | 是否启用。<br>true:启用。<br>false:禁用。 | | enable | boolean | 是 | 是否启用。 |
| callback | AsyncCallback\<void\> | 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。 | | callback | AsyncCallback\<void\> | 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。 |
**错误码:** **错误码:**
...@@ -3494,7 +3487,7 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: ...@@ -3494,7 +3487,7 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
let userId = 100; let userId = 100;
let enable = true; let enable = true;
function setSyncNotificationEnabledWithoutAppCallback(err) { function callback(err) {
if (err) { if (err) {
console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err)); console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err));
} else { } else {
...@@ -3502,7 +3495,7 @@ function setSyncNotificationEnabledWithoutAppCallback(err) { ...@@ -3502,7 +3495,7 @@ function setSyncNotificationEnabledWithoutAppCallback(err) {
} }
} }
Notification.setSyncNotificationEnabledWithoutApp(userId, enable, setSyncNotificationEnabledWithoutAppCallback); Notification.setSyncNotificationEnabledWithoutApp(userId, enable, callback);
``` ```
...@@ -3522,8 +3515,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\< ...@@ -3522,8 +3515,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户Id。 | | userId | number | 是 | 用户ID。 |
| enable | boolean | 是 | 是否启用。<br>true:启用。<br>false:禁用。 | | enable | boolean | 是 | 是否启用。 |
**返回值:** **返回值:**
...@@ -3546,13 +3539,11 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\< ...@@ -3546,13 +3539,11 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
let userId = 100; let userId = 100;
let enable = true; let enable = true;
Notification.setSyncNotificationEnabledWithoutApp(userId, enable) Notification.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
.then(() => { console.info('setSyncNotificationEnabledWithoutApp success');
console.info('setSyncNotificationEnabledWithoutApp'); }).catch((err) => {
}) console.info('setSyncNotificationEnabledWithoutApp, err:' + JSON.stringify(err));
.catch((err) => { });
console.info('setSyncNotificationEnabledWithoutApp, err:', err);
});
``` ```
...@@ -3560,7 +3551,7 @@ Notification.setSyncNotificationEnabledWithoutApp(userId, enable) ...@@ -3560,7 +3551,7 @@ Notification.setSyncNotificationEnabledWithoutApp(userId, enable)
getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<boolean>): void getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<boolean>): void
获取是否同步通知到未安装应用程序的设备(callback形式)。 获取同步通知到未安装应用程序设备的开关是否开启(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3572,8 +3563,8 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo ...@@ -3572,8 +3563,8 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户Id。 | | userId | number | 是 | 用户ID。 |
| callback | AsyncCallback\<boolean\> | 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。<br>true: 是。<br>false: 否。 | | callback | AsyncCallback\<boolean\> | 是 | 获取同步通知到未安装应用程序设备的开关是否开启的回调函数。 |
**错误码:** **错误码:**
...@@ -3591,9 +3582,9 @@ let userId = 100; ...@@ -3591,9 +3582,9 @@ let userId = 100;
function getSyncNotificationEnabledWithoutAppCallback(err, data) { function getSyncNotificationEnabledWithoutAppCallback(err, data) {
if (err) { if (err) {
console.info('getSyncNotificationEnabledWithoutAppCallback, err' + err); console.info('getSyncNotificationEnabledWithoutAppCallback, err:' + err);
} else { } else {
console.info('getSyncNotificationEnabledWithoutAppCallback, data' + data); console.info('getSyncNotificationEnabledWithoutAppCallback, data:' + data);
} }
} }
...@@ -3605,7 +3596,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEna ...@@ -3605,7 +3596,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEna
getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean> getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
获取是否同步通知到未安装应用程序的设备(Promise形式)。 获取同步通知到未安装应用程序设备的开关是否开启(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -3617,13 +3608,13 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean> ...@@ -3617,13 +3608,13 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- | | ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户Id。 | | userId | number | 是 | 用户ID。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | 以Promise形式返回获取是否同步通知到未安装应用程序的设备的结果。<br>true: 是。<br>false: 否。 | | Promise\<boolean\> | 以Promise形式返回获取同步通知到未安装应用程序设备的开关是否开启的结果。 |
**错误码:** **错误码:**
...@@ -3638,11 +3629,11 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean> ...@@ -3638,11 +3629,11 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
```js ```js
let userId = 100; let userId = 100;
Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => {
Notification.getSyncNotificationEnabledWithoutApp(userId) console.info('getSyncNotificationEnabledWithoutApp, data:' + data);
.then((data) => { }).catch((err) => {
console.info('getSyncNotificationEnabledWithoutApp, data:', data); console.info('getSyncNotificationEnabledWithoutApp, err:' + err);
}) });
.catch((err) => { .catch((err) => {
console.info('getSyncNotificationEnabledWithoutApp, err:', err); console.info('getSyncNotificationEnabledWithoutApp, err:', err);
}); });
...@@ -3657,11 +3648,11 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3657,11 +3648,11 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统API**:此接口为系统接口,三方应用不支持调用。 **系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ---- | --- | ------------------------------------- | ------------------------ | | ----- | ------------------------------------- | ---- | ---- | ---------------------- |
| type | 是 | 否 | [DoNotDisturbType](#donotdisturbtype) | 指定免打扰设置的时间类型。 | | type | [DoNotDisturbType](#donotdisturbtype) | 是 | 是 | 免打扰设置的时间类型。 |
| begin | 是 | 否 | Date | 指定免打扰设置的起点时间。 | | begin | Date | 是 | 是 | 免打扰设置的起点时间。 |
| end | 是 | 否 | Date | 指定免打扰设置的终点时间。 | | end | Date | 是 | 是 | 免打扰设置的终点时间。 |
...@@ -3708,10 +3699,10 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3708,10 +3699,10 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ---- | --- | ------ | ------ | | ------ | ------ |---- | --- | ------ |
| bundle | 是 | 是 | string | 包名。 | | bundle | string | 是 | 是 | 应用的包信息。 |
| uid | 是 | 是 | number | 用户id。 | | uid | number | 是 | 是 | 用户ID。 |
## SlotType ## SlotType
...@@ -3733,12 +3724,12 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3733,12 +3724,12 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| --------- | --- | ---- | ----------------------------------------------- | ------------------------- | | --------- | ----------------------------------------------- | --- | ---- | ------------------------- |
| title | 是 | 是 | string | 按钮标题。 | | title | string | 是 | 是 | 按钮标题。 |
| wantAgent | 是 | 是 | WantAgent | 点击按钮时触发的WantAgent。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 |
| extras | 是 | 是 | { [key: string]: any } | 按钮扩展信息。 | | extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 |
| userInput | 是 | 是 | [NotificationUserInput](#notificationuserinput) | 用户输入对象实例。 | | userInput | [NotificationUserInput](#notificationuserinput) | 是 | 是 | 用户输入对象实例。 |
## NotificationBasicContent ## NotificationBasicContent
...@@ -3747,11 +3738,11 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3747,11 +3738,11 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ---- | ---- | ------ | ---------------------------------- | | -------------- | ------ | ---- | ---- | ---------------------------------- |
| title | 是 | 是 | string | 通知标题。 | | title | string | 是 | 是 | 通知标题。 |
| text | 是 | 是 | string | 通知内容。 | | text | string | 是 | 是 | 通知内容。 |
| additionalText | 是 | 是 | string | 通知次要内容,是对通知内容的补充。 | | additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
## NotificationLongTextContent ## NotificationLongTextContent
...@@ -3760,14 +3751,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3760,14 +3751,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ---- | --- | ------ | -------------------------------- | | -------------- | ------ | ---- | --- | -------------------------------- |
| title | 是 | 是 | string | 通知标题。 | | title | string | 是 | 是 | 通知标题。 |
| text | 是 | 是 | string | 通知内容。 | | text | string | 是 | 是 | 通知内容。 |
| additionalText | 是 | 是 | string | 通知次要内容,是对通知内容的补充。 | | additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
| longText | 是 | 是 | string | 通知的长文本。 | | longText | string | 是 | 是 | 通知的长文本。 |
| briefText | 是 | 是 | string | 通知概要内容,是对通知内容的总结。 | | briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| expandedTitle | 是 | 是 | string | 通知展开时的标题。 | | expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
## NotificationMultiLineContent ## NotificationMultiLineContent
...@@ -3776,14 +3767,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3776,14 +3767,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | --- | --- | --------------- | -------------------------------- | | -------------- | --------------- | --- | --- | -------------------------------- |
| title | 是 | 是 | string | 通知标题。 | | title | string | 是 | 是 | 通知标题。 |
| text | 是 | 是 | string | 通知内容。 | | text | string | 是 | 是 | 通知内容。 |
| additionalText | 是 | 是 | string | 通知次要内容,是对通知内容的补充。 | | additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
| briefText | 是 | 是 | string | 通知概要内容,是对通知内容的总结。 | | briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| longTitle | 是 | 是 | string | 通知展开时的标题。 | | longTitle | string | 是 | 是 | 通知展开时的标题。 |
| lines | 是 | 是 | Array\<string\> | 通知的多行文本。 | | lines | Array\<string\> | 是 | 是 | 通知的多行文本。 |
## NotificationPictureContent ## NotificationPictureContent
...@@ -3792,14 +3783,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3792,14 +3783,14 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ---- | --- | -------------- | -------------------------------- | | -------------- | -------------- | ---- | --- | -------------------------------- |
| title | 是 | 是 | string | 通知标题。 | | title | string | 是 | 是 | 通知标题。 |
| text | 是 | 是 | string | 通知内容。 | | text | string | 是 | 是 | 通知内容。 |
| additionalText | 是 | 是 | string | 通知次要内容,是对通知内容的补充。 | | additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
| briefText | 是 | 是 | string | 通知概要内容,是对通知内容的总结。 | | briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| expandedTitle | 是 | 是 | string | 通知展开时的标题。 | | expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
| picture | 是 | 是 | image.PixelMap | 通知的图片内容。 | | picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 |
## NotificationContent ## NotificationContent
...@@ -3808,13 +3799,13 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3808,13 +3799,13 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | ---- | --- | ------------------------------------------------------------ | ------------------ | | ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ |
| contentType | 是 | 是 | [ContentType](#contenttype) | 通知内容类型。 | | contentType | [ContentType](#contenttype) | 是 | 是 | 通知内容类型。 |
| normal | 是 | 是 | [NotificationBasicContent](#notificationbasiccontent) | 基本类型通知内容。 | | normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 |
| longText | 是 | 是 | [NotificationLongTextContent](#notificationlongtextcontent) | 长文本类型通知内容。 | | longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 |
| multiLine | 是 | 是 | [NotificationMultiLineContent](#notificationmultilinecontent) | 多行类型通知内容。 | | multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 |
| picture | 是 | 是 | [NotificationPictureContent](#notificationpicturecontent) | 图片类型通知内容。 | | picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 |
## NotificationFlagStatus ## NotificationFlagStatus
...@@ -3825,7 +3816,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3825,7 +3816,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统接口**:此接口为系统接口,三方应用不支持调用。 **系统接口**:此接口为系统接口,三方应用不支持调用。
| 名称 | 值 | 描述 | | 名称 | 值 | 说明 |
| -------------- | --- | --------------------------------- | | -------------- | --- | --------------------------------- |
| TYPE_NONE | 0 | 默认标志。 | | TYPE_NONE | 0 | 默认标志。 |
| TYPE_OPEN | 1 | 通知标志打开。 | | TYPE_OPEN | 1 | 通知标志打开。 |
...@@ -3838,10 +3829,10 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3838,10 +3829,10 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | ---- | ---- | ---------------------- | --------------------------------- | | ---------------- | ---------------------- | ---- | ---- | --------------------------------- |
| soundEnabled | 是 | 否 | NotificationFlagStatus | 是否启用声音提示。 | | soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 |
| vibrationEnabled | 是 | 否 | NotificationFlagStatus | 是否启用振动提醒功能。 | | vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 |
## NotificationRequest ## NotificationRequest
...@@ -3850,45 +3841,45 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3850,45 +3841,45 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------------- | ---- | --- | --------------------------------------------- | -------------------------- | | --------------------- | --------------------------------------------- | ---- | --- | -------------------------- |
| content | 是 | 是 | [NotificationContent](#notificationcontent) | 通知内容。 | | content | [NotificationContent](#notificationcontent) | 是 | 是 | 通知内容。 |
| id | 是 | 是 | number | 通知ID。 | | id | number | 是 | 是 | 通知ID。 |
| slotType | 是 | 是 | [SlotType](#slottype) | 通道类型。 | | slotType | [SlotType](#slottype) | 是 | 是 | 通道类型。 |
| isOngoing | 是 | 是 | boolean | 是否进行时通知。 | | isOngoing | boolean | 是 | 是 | 是否进行时通知。 |
| isUnremovable | 是 | 是 | boolean | 是否可移除。 | | isUnremovable | boolean | 是 | 是 | 是否可移除。 |
| deliveryTime | 是 | 是 | number | 通知发送时间。 | | deliveryTime | number | 是 | 是 | 通知发送时间。 |
| tapDismissed | 是 | 是 | boolean | 通知是否自动清除。 | | tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 |
| autoDeletedTime | 是 | 是 | number | 自动清除的时间。 | | autoDeletedTime | number | 是 | 是 | 自动清除的时间。 |
| wantAgent | 是 | 是 | WantAgent | WantAgent封装了应用的行为意图,点击通知时触发该行为。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 |
| extraInfo | 是 | 是 | {[key: string]: any} | 扩展参数。 | | extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 |
| color | 是 | 是 | number | 通知背景颜色。暂不支持。 | | color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 |
| colorEnabled | 是 | 是 | boolean | 通知背景颜色是否使能。暂不支持。 | | colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 |
| isAlertOnce | 是 | 是 | boolean | 设置是否仅有一次此通知警报。 | | isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 |
| isStopwatch | 是 | 是 | boolean | 是否显示已用时间。 | | isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 |
| isCountDown | 是 | 是 | boolean | 是否显示倒计时时间。 | | isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 |
| isFloatingIcon | 是 | 是 | boolean | 是否显示状态栏图标。 | | isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 |
| label | 是 | 是 | string | 通知标签。 | | label | string | 是 | 是 | 通知标签。 |
| badgeIconStyle | 是 | 是 | number | 通知角标类型。 | | badgeIconStyle | number | 是 | 是 | 通知角标类型。 |
| showDeliveryTime | 是 | 是 | boolean | 是否显示分发时间。 | | showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 |
| actionButtons | 是 | 是 | Array\<[NotificationActionButton](#notificationactionbutton)\> | 通知按钮,最多两个按钮。 | | actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 是 | 是 | 通知按钮,最多两个按钮。 |
| smallIcon | 是 | 是 | PixelMap | 通知小图标。(可选字段,大小不超过30KB) | | smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 |
| largeIcon | 是 | 是 | PixelMap | 通知大图标。(可选字段,大小不超过30KB) | | largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 |
| creatorBundleName | 是 | 否 | string | 创建通知的包名。 | | creatorBundleName | string | 是 | 否 | 创建通知的包名。 |
| creatorUid | 是 | 否 | number | 创建通知的UID。 | | creatorUid | number | 是 | 否 | 创建通知的UID。 |
| creatorPid | 是 | 否 | number | 创建通知的PID。 | | creatorPid | number | 是 | 否 | 创建通知的PID。 |
| creatorUserId | 是 | 否 | number | 创建通知的UserId。 | | creatorUserId| number | 是 | 否 | 创建通知的UserId。 |
| hashCode | 是 | 否 | string | 通知唯一标识。 | | hashCode | string | 是 | 否 | 通知唯一标识。 |
| classification | 是 | 是 | string | 通知分类。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | classification | string | 是 | 是 | 通知分类。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| groupName | 是 | 是 | string | 组通知名称。 | | groupName| string | 是 | 是 | 组通知名称。 |
| template | 是 | 是 | [NotificationTemplate](#notificationtemplate) | 通知模板。 | | template | [NotificationTemplate](#notificationtemplate) | 是 | 是 | 通知模板。 |
| isRemoveAllowed | 是 | 否 | boolean | 通知是否能被移除。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | isRemoveAllowed | boolean | 是 | 否 | 通知是否能被移除。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| source | 是 | 否 | number | 通知源。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | source | number | 是 | 否 | 通知源。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| distributedOption | 是 | 是 | [DistributedOptions](#distributedoptions) | 分布式通知的选项。 | | distributedOption | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 |
| deviceId | 是 | 否 | string | 通知源的deviceId。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | deviceId | string | 是 | 否 | 通知源的deviceId。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| notificationFlags | 是 | 否 | [NotificationFlags](#notificationflags) | 获取NotificationFlags。 | | notificationFlags | [NotificationFlags](#notificationflags) | 是 | 否 | 获取NotificationFlags。 |
| removalWantAgent | 是 | 是 | WantAgent | 当移除通知时,通知将被重定向到的WantAgent实例。 | | removalWantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 |
| badgeNumber | 是 | 是 | number | 应用程序图标上显示的通知数。 | | badgeNumber | number | 是 | 是 | 应用程序图标上显示的通知数。 |
## DistributedOptions ## DistributedOptions
...@@ -3897,12 +3888,12 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3897,12 +3888,12 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------------- | ---- | ---- | -------------- | ---------------------------------- | | ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
| isDistributed | 是 | 是 | boolean | 是否为分布式通知。 | | isDistributed | boolean | 是 | 是 | 是否为分布式通知。 |
| supportDisplayDevices | 是 | 是 | Array\<string> | 可以同步通知到的设备类型。 | | supportDisplayDevices | Array\<string> | 是 | 是 | 可以同步通知到的设备列表。 |
| supportOperateDevices | 是 | 是 | Array\<string> | 可以打开通知的设备。 | | supportOperateDevices | Array\<string> | 是 | 是 | 可以打开通知的设备列表。 |
| remindType | 是 | 否 | number | 通知的提醒方式。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | remindType | number | 是 | 否 | 通知的提醒方式。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
## NotificationSlot ## NotificationSlot
...@@ -3911,20 +3902,20 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3911,20 +3902,20 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------------- | ---- | --- | --------------------- | ------------------------------------------ | | -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
| type | 是 | 是 | [SlotType](#slottype) | 通道类型。 | | type | [SlotType](#slottype) | 是 | 是 | 通道类型。 |
| level | 是 | 是 | number | 通知级别,不设置则根据通知渠道类型有默认值。 | | level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 |
| desc | 是 | 是 | string | 通知渠道描述信息。 | | desc | string | 是 | 是 | 通知渠道描述信息。 |
| badgeFlag | 是 | 是 | boolean | 是否显示角标。 | | badgeFlag | boolean | 是 | 是 | 是否显示角标。 |
| bypassDnd | 是 | 是 | boolean | 置是否在系统中绕过免打扰模式。 | | bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 |
| lockscreenVisibility | 是 | 是 | number | 在锁定屏幕上显示通知的模式。 | | lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 |
| vibrationEnabled | 是 | 是 | boolean | 是否可振动。 | | vibrationEnabled | boolean | 是 | 是 | 是否可振动。 |
| sound | 是 | 是 | string | 通知提示音。 | | sound | string | 是 | 是 | 通知提示音。 |
| lightEnabled | 是 | 是 | boolean | 是否闪灯。 | | lightEnabled | boolean | 是 | 是 | 是否闪灯。 |
| lightColor | 是 | 是 | number | 通知灯颜色。 | | lightColor | number | 是 | 是 | 通知灯颜色。 |
| vibrationValues | 是 | 是 | Array\<number\> | 通知振动样式。 | | vibrationValues | Array\<number\> | 是 | 是 | 通知振动样式。 |
| enabled<sup>9+</sup> | 是 | 否 | boolean | 此通知插槽中的启停状态。 | | enabled<sup>9+</sup> | boolean | 是 | 否 | 此通知插槽中的启停状态。 |
## NotificationTemplate ## NotificationTemplate
...@@ -3933,7 +3924,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3933,7 +3924,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ---- | ---------------------- | ---- | ---- | ---------- | | ---- | ---------------------- | ---- | ---- | ---------- |
| name | string | 是 | 是 | 模板名称。 | | name | string | 是 | 是 | 模板名称。 |
| data | {[key:string]: Object} | 是 | 是 | 模板数据。 | | data | {[key:string]: Object} | 是 | 是 | 模板数据。 |
...@@ -3945,9 +3936,9 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3945,9 +3936,9 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | --- | ---- | ------ | ----------------------------- | | -------- | ------ | --- | ---- | ----------------------------- |
| inputKey | 是 | 是 | string | 用户输入时用于标识此输入的key。 | | inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 |
## DeviceRemindType ## DeviceRemindType
...@@ -3956,7 +3947,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3956,7 +3947,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 值 | 描述 | | 名称 | 值 | 说明 |
| -------------------- | --- | --------------------------------- | | -------------------- | --- | --------------------------------- |
| IDLE_DONOT_REMIND | 0 | 设备未被使用,无需提醒。 | | IDLE_DONOT_REMIND | 0 | 设备未被使用,无需提醒。 |
| IDLE_REMIND | 1 | 提醒设备未被使用。 | | IDLE_REMIND | 1 | 提醒设备未被使用。 |
...@@ -3970,7 +3961,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId) ...@@ -3970,7 +3961,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 值 | 描述 | | 名称 | 值 | 说明 |
| -------------------- | --- | -------------------- | | -------------------- | --- | -------------------- |
| TYPE_NORMAL | 0 | 一般通知。 | | TYPE_NORMAL | 0 | 一般通知。 |
| TYPE_CONTINUOUS | 1 | 连续通知。 | | TYPE_CONTINUOUS | 1 | 连续通知。 |
......
...@@ -28,10 +28,10 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c ...@@ -28,10 +28,10 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ---------------- | | ---------- | ------------------------- | ---- | ---------------- |
| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | | subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 |
| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 是 | 订阅信息。 | | info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 是 | 通知订阅信息。 |
| callback | AsyncCallback\<void\> | 是 | 订阅动作回调函数。 | | callback | AsyncCallback\<void\> | 是 | 订阅动作回调函数。 |
**错误码:** **错误码:**
...@@ -71,7 +71,7 @@ NotificationSubscribe.subscribe(subscriber, info, subscribeCallback); ...@@ -71,7 +71,7 @@ NotificationSubscribe.subscribe(subscriber, info, subscribeCallback);
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): void
订阅通知并指定订阅信息(callback形式)。 订阅当前用户下所有应用的通知(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -81,7 +81,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): ...@@ -81,7 +81,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>):
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | ---------------- | | ---------- | ---------------------- | ---- | ---------------- |
| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | | subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 |
| callback | AsyncCallback\<void\> | 是 | 订阅动作回调函数。 | | callback | AsyncCallback\<void\> | 是 | 订阅动作回调函数。 |
...@@ -129,10 +129,10 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): ...@@ -129,10 +129,10 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------ | | ---------- | ------------------------- | ---- | ------------ |
| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | | subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 |
| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 否 | 订阅信息。 | | info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 否 | 通知订阅信息。 |
**错误码:** **错误码:**
...@@ -146,17 +146,13 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): ...@@ -146,17 +146,13 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
```js ```js
function onConsumeCallback(data) { function onConsumeCallback(data) {
if (err) { console.info("Consume callback: " + JSON.stringify(data));
console.info("subscribe failed " + JSON.stringify(err));
} else {
console.info("subscribe success");
}
} }
var subscriber = { var subscriber = {
onConsume: onConsumeCallback onConsume: onConsumeCallback
}; };
NotificationSubscribe.subscribe(subscriber).then(() => { NotificationSubscribe.subscribe(subscriber).then(() => {
console.info("subscribe sucess"); console.info("subscribe success");
}); });
``` ```
...@@ -176,7 +172,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>) ...@@ -176,7 +172,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>)
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | -------------------- | | ---------- | ---------------------- | ---- | -------------------- |
| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | | subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 |
| callback | AsyncCallback\<void\> | 是 | 取消订阅动作回调函数。 | | callback | AsyncCallback\<void\> | 是 | 取消订阅动作回调函数。 |
...@@ -199,11 +195,11 @@ function unsubscribeCallback(err) { ...@@ -199,11 +195,11 @@ function unsubscribeCallback(err) {
console.info("unsubscribe success"); console.info("unsubscribe success");
} }
} }
function onCancelCallback(data) { function onDisconnectCallback(data) {
console.info("Cancel callback: " + JSON.stringify(data)); console.info("Cancel callback: " + JSON.stringify(data));
} }
var subscriber = { var subscriber = {
onCancel: onCancelCallback onDisconnect: onDisconnectCallback
} }
NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback);
``` ```
...@@ -224,7 +220,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\> ...@@ -224,7 +220,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | ------------ | | ---------- | ---------------------- | ---- | ------------ |
| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | | subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 |
...@@ -239,14 +235,14 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\> ...@@ -239,14 +235,14 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**示例:** **示例:**
```js ```js
function onCancelCallback(data) { function onDisconnectCallback(data) {
console.info("Cancel callback: " + JSON.stringify(data)); console.info("Cancel callback: " + JSON.stringify(data));
} }
var subscriber = { var subscriber = {
onCancel: onCancelCallback onDisconnect: onDisconnectCallback
}; };
NotificationSubscribe.unsubscribe(subscriber).then(() => { NotificationSubscribe.unsubscribe(subscriber).then(() => {
console.info("unsubscribe sucess"); console.info("unsubscribe success");
}); });
``` ```
...@@ -266,9 +262,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea ...@@ -266,9 +262,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------------- | ----------------------------------| ---- | -------------------- | | --------------- | ----------------------------------| ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | | notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
...@@ -320,9 +316,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea ...@@ -320,9 +316,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------------- | --------------- | ---- | ---------- | | --------------- | --------------- | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | | notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
...@@ -348,7 +344,7 @@ var notificationKey = { ...@@ -348,7 +344,7 @@ var notificationKey = {
} }
var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => { NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => {
console.info("remove sucess"); console.info("remove success");
}); });
``` ```
...@@ -368,9 +364,9 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): ...@@ -368,9 +364,9 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| hashCode | string | 是 | 通知唯一ID。 | | hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](#onconsume)回调的入参[SubscribeCallbackData](#subscribecallbackdata)获取其内部[NotificationRequest](#notificationrequest)对象中的hashCode。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
...@@ -415,7 +411,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\> ...@@ -415,7 +411,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------- | ---- | ---------- | | -------- | ---------- | ---- | ---------- |
| hashCode | string | 是 | 通知唯一ID。 | | hashCode | string | 是 | 通知唯一ID。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
...@@ -435,7 +431,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\> ...@@ -435,7 +431,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
var hashCode = 'hashCode' var hashCode = 'hashCode'
var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
NotificationSubscribe.remove(hashCode, reason).then(() => { NotificationSubscribe.remove(hashCode, reason).then(() => {
console.info("remove sucess"); console.info("remove success");
}); });
``` ```
...@@ -445,7 +441,7 @@ NotificationSubscribe.remove(hashCode, reason).then(() => { ...@@ -445,7 +441,7 @@ NotificationSubscribe.remove(hashCode, reason).then(() => {
removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
删除指定的所有通知(Callback形式)。 删除指定应用的所有通知(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -455,10 +451,10 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void ...@@ -455,10 +451,10 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------- | | -------- | --------------------- | ---- | ---------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定的所有通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定应用的所有通知回调函数。 |
**错误码:** **错误码:**
...@@ -501,7 +497,7 @@ removeAll(callback: AsyncCallback\<void\>): void ...@@ -501,7 +497,7 @@ removeAll(callback: AsyncCallback\<void\>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- | | -------- | --------------------- | ---- | -------------------- |
| callback | AsyncCallback\<void\> | 是 | 删除所有通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除所有通知回调函数。 |
...@@ -533,7 +529,7 @@ NotificationSubscribe.removeAll(removeAllCallback); ...@@ -533,7 +529,7 @@ NotificationSubscribe.removeAll(removeAllCallback);
removeAll(bundle?: BundleOption): Promise\<void\> removeAll(bundle?: BundleOption): Promise\<void\>
删除所有通知(Promise形式)。 删除指定应用的所有通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -543,9 +539,9 @@ removeAll(bundle?: BundleOption): Promise\<void\> ...@@ -543,9 +539,9 @@ removeAll(bundle?: BundleOption): Promise\<void\>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 否 | 指定包信息。 | | bundle | [BundleOption](#bundleoption) | 否 | 指定应用的包信息。 |
**错误码:** **错误码:**
...@@ -559,8 +555,9 @@ removeAll(bundle?: BundleOption): Promise\<void\> ...@@ -559,8 +555,9 @@ removeAll(bundle?: BundleOption): Promise\<void\>
**示例:** **示例:**
```js ```js
// 不指定应用时,删除所有通知
NotificationSubscribe.removeAll().then(() => { NotificationSubscribe.removeAll().then(() => {
console.info("removeAll sucess"); console.info("removeAll success");
}); });
``` ```
...@@ -568,7 +565,7 @@ NotificationSubscribe.removeAll().then(() => { ...@@ -568,7 +565,7 @@ NotificationSubscribe.removeAll().then(() => {
removeAll(userId: number, callback: AsyncCallback\<void>): void removeAll(userId: number, callback: AsyncCallback\<void>): void
删除所有通知(callback形式)。 删除指定用户下的所有通知(callback形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -578,10 +575,10 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void ...@@ -578,10 +575,10 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
| callback | AsyncCallback\<void\> | 是 | 删除所有通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定用户所有通知回调函数。 |
**错误码:** **错误码:**
...@@ -612,7 +609,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback); ...@@ -612,7 +609,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback);
removeAll(userId: number): Promise\<void> removeAll(userId: number): Promise\<void>
删除所有通知(Promise形式)。 删除指定用户下的所有通知(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -622,9 +619,9 @@ removeAll(userId: number): Promise\<void> ...@@ -622,9 +619,9 @@ removeAll(userId: number): Promise\<void>
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- | | ------ | ------------ | ---- | ---------- |
| userId | number | 是 | 接收通知用户的Id。 | | userId | number | 是 | 用户ID。 |
**错误码:** **错误码:**
...@@ -655,7 +652,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback); ...@@ -655,7 +652,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback);
## NotificationSubscriber ## NotificationSubscriber
提供订阅者接收到新通知或取消通知时的回调方法。 作为订阅通知接口[subscribe](#notificationsubscribe)的入参,提供订阅者接收到新通知、取消通知等的回调方法。
**系统API**:此接口为系统接口,三方应用不支持调用。 **系统API**:此接口为系统接口,三方应用不支持调用。
...@@ -663,7 +660,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback); ...@@ -663,7 +660,7 @@ NotificationSubscribe.removeAll(userId, removeAllCallback);
onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
接收通知回调函数。 接收到新通知的回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -673,7 +670,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void ...@@ -673,7 +670,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- | | ------------ | ------------------------ | ---- | -------------------------- |
| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 回调返回接收到的通知信息。 | | data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 接收到的通知信息。 |
**示例:** **示例:**
...@@ -703,7 +700,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -703,7 +700,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
删除通知回调函数。 取消通知的回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -713,7 +710,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void ...@@ -713,7 +710,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- | | ------------ | ------------------------ | ---- | -------------------------- |
| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 回调返回接收到的通知信息。 | | data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 需要取消的通知信息。 |
**示例:** **示例:**
...@@ -743,7 +740,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -743,7 +740,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
更新通知排序回调函数。 更新通知排序回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -753,7 +750,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void ...@@ -753,7 +750,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- | | ------------ | ------------------------ | ---- | -------------------------- |
| data | [NotificationSortingMap](#notificationsortingmap) | 是 | 回调返回接收到的通知信息。 | | data | [NotificationSortingMap](#notificationsortingmap) | 是 | 最新的通知排序列表。 |
**示例:** **示例:**
...@@ -766,8 +763,8 @@ function subscribeCallback(err) { ...@@ -766,8 +763,8 @@ function subscribeCallback(err) {
} }
}; };
function onUpdateCallback() { function onUpdateCallback(map) {
console.info('===> onUpdate in test'); console.info('===> onUpdateCallback map:' + JSON.stringify(map));
} }
var subscriber = { var subscriber = {
...@@ -781,7 +778,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -781,7 +778,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
onConnect?:() => void onConnect?:() => void
注册订阅回调函数。 订阅完成的回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -813,7 +810,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -813,7 +810,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
onDisconnect?:() => void onDisconnect?:() => void
取消订阅回调函数。 取消订阅回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -829,16 +826,30 @@ function subscribeCallback(err) { ...@@ -829,16 +826,30 @@ function subscribeCallback(err) {
console.info("subscribeCallback"); console.info("subscribeCallback");
} }
}; };
function unsubscribeCallback(err) {
if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err));
} else {
console.info("unsubscribeCallback");
}
};
function onConnectCallback() {
console.info('===> onConnect in test');
}
function onDisconnectCallback() { function onDisconnectCallback() {
console.info('===> onDisconnect in test'); console.info('===> onDisconnect in test');
} }
var subscriber = { var subscriber = {
onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback onDisconnect: onDisconnectCallback
}; };
// 订阅通知后会收到onConnect回调
NotificationSubscribe.subscribe(subscriber, subscribeCallback); NotificationSubscribe.subscribe(subscriber, subscribeCallback);
// 取消订阅后会收到onDisconnect回调
NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback);
``` ```
### onDestroy ### onDestroy
...@@ -877,7 +888,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -877,7 +888,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notificationManager.md#donotdisturbdate)) => void onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notificationManager.md#donotdisturbdate)) => void
免打扰时间选项变更回调函数。 免打扰时间选项发生变更时的回调函数。
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
...@@ -900,8 +911,8 @@ function subscribeCallback(err) { ...@@ -900,8 +911,8 @@ function subscribeCallback(err) {
} }
}; };
function onDoNotDisturbDateChangeCallback() { function onDoNotDisturbDateChangeCallback(mode) {
console.info('===> onDoNotDisturbDateChange in test'); console.info('===> onDoNotDisturbDateChange:' + mode);
} }
var subscriber = { var subscriber = {
...@@ -956,19 +967,19 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -956,19 +967,19 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ---- | ---- | ------ | -------- | | ------ | ------ |---- | --- | ------ |
| bundle | 是 | 是 | string | 包名。 | | bundle | string | 是 | 是 | 应用的包信息。 |
| uid | 是 | 是 | number | 用户id。 | | uid | number | 是 | 是 | 用户ID。 |
## NotificationKey ## NotificationKey
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ---- | ---- | ------ | ---------- | | ----- | ------ | ---- | --- | -------- |
| id | 是 | 是 | number | 通知ID。 | | id | number | 是 | 是 | 通知ID。 |
| label | 是 | 是 | string | 通知标签。 | | label | string | 是 | 是 | 通知标签。 |
## SubscribeCallbackData ## SubscribeCallbackData
...@@ -976,13 +987,13 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -976,13 +987,13 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**:此接口为系统接口,三方应用不支持调用。 **系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------- | ---- | --- | ------------------------------------------------- | -------- | | --------------- | ------------------------------------------------- | -------- | -------- | -------- |
| request | 是 | 否 | [NotificationRequest](js-apis-notificationManager.md#notificationrequest) | 通知内容。 | | request | [NotificationRequest](js-apis-notificationManager.md#notificationrequest) | 是 | 否 | 通知内容。 |
| sortingMap | 是 | 否 | [NotificationSortingMap](#notificationsortingmap) | 排序信息。 | | sortingMap | [NotificationSortingMap](#notificationsortingmap) | 是 | 否 | 排序信息。 |
| reason | 是 | 否 | number | 删除原因。 | | reason | number | 是 | 否 | 删除原因。 |
| sound | 是 | 否 | string | 通知声音。 | | sound | string | 是 | 否 | 通知声音。 |
| vibrationValues | 是 | 否 | Array\<number\> | 通知震动。 | | vibrationValues | Array\<number\> | 是 | 否 | 通知震动。 |
## EnabledNotificationCallbackData ## EnabledNotificationCallbackData
...@@ -991,11 +1002,11 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -991,11 +1002,11 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**:此接口为系统接口,三方应用不支持调用。 **系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 描述 |
| ------ | ---- | --- | ------- | ---------------- | | ------ | ------- | ---------------- | ---------------- | ---------------- |
| bundle | 是 | 否 | string | 应用的包名。 | | bundle | string | 是 | 否 | 应用的包名。 |
| uid | 是 | 否 | number | 应用的uid。 | | uid | number | 是 | 否 | 应用的uid。 |
| enable | 是 | 否 | boolean | 应用通知使能状态。 | | enable | boolean | 是 | 否 | 应用通知使能状态。 |
## NotificationSorting ## NotificationSorting
...@@ -1006,11 +1017,11 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1006,11 +1017,11 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ---- | --- | ------------------------------------- | ------------ | | -------- | ------------------------------------- | ---- | --- | ------------ |
| slot | 是 | 否 | [NotificationSlot](js-apis-notificationManager.md#notificationslot) | 通知通道内容。 | | slot | [NotificationSlot](js-apis-notificationManager.md#notificationslot) | 是 | 否 | 通知通道内容。 |
| hashCode | 是 | 否 | string | 通知唯一标识。 | | hashCode | string | 是 | 否 | 通知唯一标识。 |
| ranking | 是 | 否 | number | 通知排序序号。 | | ranking | number | 是 | 否 | 通知排序序号。 |
## NotificationSortingMap ## NotificationSortingMap
...@@ -1021,10 +1032,10 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1021,10 +1032,10 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**:此接口为系统接口,三方应用不支持调用。 **系统API**:此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ---- | --- | ------------------------------------------------------------ | ---------------- | | -------------- | ------------------------------------------------------------ | ---- | --- | ---------------- |
| sortings | 是 | 否 | {[key: string]: [NotificationSorting](#notificationsorting)} | 通知排序信息数组。 | | sortings | {[key: string]: [NotificationSorting](#notificationsorting)} | 是 | 否 | 通知排序信息数组。 |
| sortedHashCode | 是 | 否 | Array\<string\> | 通知唯一标识数组。 | | sortedHashCode | Array\<string\> | 是 | 否 | 通知唯一标识数组。 |
## NotificationSubscribeInfo ## NotificationSubscribeInfo
...@@ -1035,10 +1046,10 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1035,10 +1046,10 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | --- | ---- | --------------- | ------------------------------- | | ----------- | --------------- | --- | ---- | ------------------------------- |
| bundleNames | 是 | 是 | Array\<string\> | 指定订阅哪些包名的APP发来的通知。 | | bundleNames | Array\<string\> | 是 | 是 | 指定订阅哪些包名的APP发来的通知。 |
| userId | 是 | 是 | number | 指定订阅哪个用户下发来的通知。 | | userId | number | 是 | 是 | 指定订阅哪个用户下发来的通知。 |
## NotificationUserInput ## NotificationUserInput
...@@ -1047,9 +1058,9 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1047,9 +1058,9 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
| 名称 | 可读 | 可写 | 类型 | 描述 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | --- | ---- | ------ | ----------------------------- | | -------- | ------ | --- | ---- | ----------------------------- |
| inputKey | 是 | 是 | string | 用户输入时用于标识此输入的key。 | | inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 |
## RemoveReason ## RemoveReason
...@@ -1057,7 +1068,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback); ...@@ -1057,7 +1068,7 @@ NotificationSubscribe.subscribe(subscriber, subscribeCallback);
**系统API**: 此接口为系统接口,三方应用不支持调用。 **系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 值 | 描述 | | 名称 | 值 | 说明 |
| -------------------- | --- | -------------------- | | -------------------- | --- | -------------------- |
| CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 | | CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 |
| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 | | CANCEL_REASON_REMOVE | 2 | 用户删除通知。 |
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册