From 35db91ecd3236379fc0e6e33693406ec17a45e9e Mon Sep 17 00:00:00 2001 From: xuzhihao Date: Fri, 24 Jun 2022 15:24:51 +0800 Subject: [PATCH] Fix issues of Notiofication docs Signed-off-by: xuzhihao --- .../reference/apis/js-apis-commonEvent.md | 21 +- .../reference/apis/js-apis-emitter.md | 20 +- .../reference/apis/js-apis-notification.md | 413 +++++++++++++++++- .../reference/apis/js-apis-reminderAgent.md | 2 + 4 files changed, 440 insertions(+), 16 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md index 6414f92f48..01c2bcd550 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @@ -3,9 +3,17 @@ > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -## support +## 导入模块 + +```js +import CommonEvent from '@ohos.commonEvent'; +``` + +## Support + +CommonEvent模块支持的事件类型。名称指的是系统公共事件宏;值指的是系统公共事件。 -| 系统公共事件宏 | 系统公共事件名称 | 订阅者所需权限 | 说明 | +| 名称 | 值 | 订阅者所需权限 | 说明 | | ------------ | ------------------ | ---------------------- | -------------------- | | COMMON_EVENT_BOOT_COMPLETED | usual.event.BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | 指示用户已完成引导并加载系统的公共事件的操作。 | | COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | 表示用户已完成引导,系统已加载,但屏幕仍锁定的公共事件的操作。 | @@ -158,11 +166,6 @@ | COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 | 表示设备飞行模式已更改的公共事件的动作。 | | COMMON_EVENT_SPLIT_SCREEN | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | 表示分屏的公共事件的动作。 | -## 导入模块 - -```js -import CommonEvent from '@ohos.commonEvent'; -``` ## CommonEvent.publish @@ -172,6 +175,8 @@ publish(event: string, callback: AsyncCallback\): void **系统能力:** SystemCapability.Notification.CommonEvent +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 读写属性 | 类型 | 必填 | 描述 | @@ -205,6 +210,8 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\ **系统能力:** SystemCapability.Notification.CommonEvent +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 读写属性 | 类型 | 必填 | 描述 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-emitter.md b/zh-cn/application-dev/reference/apis/js-apis-emitter.md index 705e3ae995..19e9fd4b8a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-emitter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-emitter.md @@ -16,12 +16,14 @@ import emitter from '@ohos.events.emitter' 用于表示事件被投递的优先级。 +**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter + | 名称 | 值 | 说明 | | --------- | ---- | ------------------------------------------------- | -| IMMEDIATE | 0 | 表示事件被立即投递。
**系统能力**: SystemCapability.Notification.Emitter | -| HIGH | 1 | 表示事件先于LOW优先级投递。
**系统能力**: SystemCapability.Notification.Emitter | -| LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。
**系统能力**: SystemCapability.Notification.Emitter | -| IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。
**系统能力**: SystemCapability.Notification.Emitter | +| IMMEDIATE | 0 | 表示事件被立即投递。 | +| HIGH | 1 | 表示事件先于LOW优先级投递。 | +| LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。 | +| IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。 | ## emitter.on @@ -131,15 +133,19 @@ emitter.emit(innerEvent, eventData); 进程内的事件。 +**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter + | 名称 | 参数类型 | 可读 | 可写 | 说明 | | -------- | ------------------------------- | ---- | ---- | ---------------------------------- | -| eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。
**系统能力**: SystemCapability.Notification.Emitter | -| priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。
**系统能力**: SystemCapability.Notification.Emitter | +| eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。 | +| priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。 | ## EventData 发送事件时传递的数据。 +**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter + | 名称 | 参数类型 | 可读 | 可写 | 说明 | | ---- | ------------------ | ---- | ---- | -------------- | -| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。
**系统能力**: SystemCapability.Notification.Emitter | +| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-notification.md b/zh-cn/application-dev/reference/apis/js-apis-notification.md index 931119a321..9f28caeb3a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -85,6 +85,10 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -287,6 +295,10 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -318,6 +330,10 @@ addSlot(slot: NotificationSlot): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -397,6 +413,10 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -432,6 +452,10 @@ addSlots(slots: Array\): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -669,6 +693,10 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -706,6 +734,10 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -738,6 +770,10 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -769,6 +805,10 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -801,6 +841,10 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -831,6 +875,10 @@ enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallbac **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -861,6 +909,10 @@ enableNotification(bundle: BundleOption, enable: boolean): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -889,6 +941,8 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -918,6 +972,10 @@ isNotificationEnabled(bundle: BundleOption): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -951,6 +1009,10 @@ isNotificationEnabled(callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -977,6 +1039,10 @@ isNotificationEnabled(): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1007,6 +1073,10 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1065,6 +1139,10 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1094,6 +1172,10 @@ isBadgeDisplayed(bundle: BundleOption): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1127,6 +1209,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1160,6 +1246,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1191,6 +1281,10 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1253,6 +1351,10 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1282,6 +1384,10 @@ getSlotNumByBundle(bundle: BundleOption): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1315,6 +1421,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCa **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1349,6 +1459,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1381,6 +1495,10 @@ remove(hashCode: string, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1410,6 +1528,10 @@ remove(hashCode: string): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1436,6 +1558,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1465,6 +1589,10 @@ removeAll(callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1491,6 +1619,10 @@ removeAll(bundle?: BundleOption): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1513,6 +1645,10 @@ removeAll(userId: number, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1540,6 +1676,10 @@ removeAll(userId: number): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1567,6 +1707,10 @@ getAllActiveNotifications(callback: AsyncCallback>) **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1593,6 +1737,10 @@ getAllActiveNotifications(): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1829,6 +1985,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\): vo **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1862,6 +2022,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1890,6 +2054,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1926,6 +2094,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1958,6 +2130,10 @@ getDoNotDisturbDate(callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -1984,6 +2160,10 @@ getDoNotDisturbDate(): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **返回值:** | 类型 | 说明 | @@ -2007,6 +2187,10 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\) **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -2036,6 +2220,10 @@ getDoNotDisturbDate(userId: number): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -2067,6 +2255,10 @@ supportDoNotDisturbMode(callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | @@ -2093,6 +2285,10 @@ supportDoNotDisturbMode(): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **返回值:** | 类型 | 说明 | @@ -2221,6 +2417,10 @@ enableDistributed(enable: boolean, callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2250,6 +2450,10 @@ enableDistributed(enable: boolean): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2326,6 +2530,10 @@ enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: Async **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2360,6 +2568,10 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2390,6 +2602,10 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2455,6 +2675,10 @@ getDeviceRemindType(callback: AsyncCallback\): void **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2481,6 +2705,10 @@ getDeviceRemindType(): Promise\ **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **返回值:** | 类型 | 说明 | @@ -2496,6 +2724,167 @@ Notification.getDeviceRemindType() }); ``` +## Notification.enableNotificationSlot9+ + +enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\): void + +设置是否启用应用通道(callback形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------- | ---- | -------------------------- | +| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 | +| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | +| enable | boolean | 是 | 是否启用的标记。true为启用;false为禁用。 | +| callback | AsyncCallback\ | 是 | 获取启用应用通道的回调函数。 | + +**示例:** +```js +var bundleOption = { + bundle: 'bundle', + uid: 1 +}; + +var type = Notification.SlotType.SOCIAL_COMMUNICATION; + +var enable = true; + +function enableNotificationSlotCallback(data) { + console.log('-------- enableNotificationSlotCallback ---------', data); +} + +Notification.enableNotificationSlot(bundleOption, type, enable, enableNotificationSlotCallback); +``` + + +## Notification.enableNotificationSlot9+ + +enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\ + +设置是否启用应用通道(Promise形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------- | ---- | -------------------------- | +| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 | +| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | +| enable | boolean | 是 | 是否启用的标记。true为启用;false为禁用。 | + +**示例:** +```js +var bundleOption = { + bundle: 'bundle', + uid: 1 +}; + +var type = Notification.SlotType.SOCIAL_COMMUNICATION; + +var enable = true; + +Notification.enableNotificationSlot(bundleOption, type, enable) + .then((data) => { + console.log('-------- enableNotificationSlotCallback success ---------', data); + }) + .catch((err) => { + console.log('-------- enableNotificationSlotCallback fail ---------', err); + }); +``` + + +## Notification.isNotificationSlotEnabled9+ + +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\): void + +获取应用通道是否启用的结果(callback形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------- | ---- | -------------------------- | +| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 | +| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | +| callback | AsyncCallback\ | 是 | 获取启用应用通道的回调函数。 | + +**示例:** +```js +var bundleOption = { + bundle: 'bundle', + uid: 1 +}; + +var type = Notification.SlotType.SOCIAL_COMMUNICATION; + +function isNotificationSlotEnabledCallback(data) { + console.log('------------ isNotificationSlotEnabledCallback ------------', data); +} + +Notification.isNotificationSlotEnabled(bundleOption, type, isNotificationSlotEnabledCallback); +``` + + +## Notification.isNotificationSlotEnabled9+ + +isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ + +获取应用通道是否启用的结果(Promise形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------- | ---- | -------------------------- | +| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 | +| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | + +**返回值:** +| 类型 | 说明 | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回应用通道是否启用的结果。true为启用;false为禁用。 | + +**示例:** +```js +var bundleOption = { + bundle: 'bundle', + uid: 1 +}; + +var type = Notification.SlotType.SOCIAL_COMMUNICATION; + +Notification.isNotificationSlotEnabled(bundleOption, type) + .then((data) => { + console.log('------------ isNotificationSlotEnabledCallback success ------------', data); + }) + .catch((err) => { + console.log('------------ isNotificationSlotEnabledCallback fail ------------', err); + }); +``` + + ## Notification.publishAsBundle9+ publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\): void @@ -2504,8 +2893,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user **系统能力**:SystemCapability.Notification.Notification -**参数:** +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER,ohos.permission.NOTIFICATION_AGENT_CONTROLLER +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | @@ -2549,6 +2941,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER,ohos.permission.NOTIFICATION_AGENT_CONTROLLER + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + **参数:** @@ -2591,6 +2987,8 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac **系统能力**:SystemCapability.Notification.Notification +**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER,ohos.permission.NOTIFICATION_AGENT_CONTROLLER + **参数:** @@ -3050,7 +3448,7 @@ Notification.subscribe(subscriber, subscribeCallback); | title | 是 | 是 | string | 是 | 按钮标题。 | | wantAgent | 是 | 是 | WantAgent | 是 | 点击按钮时触发的WantAgent。 | | extras | 是 | 是 | { [key: string]: any } | 否 | 按钮扩展信息。 | -| userInput9+ | 是 | 是 | [NotificationUserInput](#notificationuserinput8) | 否 | 用户输入对象实例。 | +| userInput8+ | 是 | 是 | [NotificationUserInput](#notificationuserinput8) | 否 | 用户输入对象实例。 | ## NotificationBasicContent @@ -3275,3 +3673,14 @@ Notification.subscribe(subscriber, subscribeCallback); | IDLE_REMIND | 1 | 提醒设备未被使用。 | | ACTIVE_DONOT_REMIND | 2 | 设备正在使用,无需提醒。 | | ACTIVE_REMIND | 3 | 提醒设备正在使用。 | + + +## SourceType8+ + +**系统能力**:SystemCapability.Notification.Notification + +| 名称 | 值 | 描述 | +| -------------------- | --- | -------------------- | +| TYPE_NORMAL | 0 | 一般通知。 | +| TYPE_CONTINUOUS | 1 | 连续通知。 | +| TYPE_TIMER | 2 | 计划通知。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md b/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md index dbee90cb5c..1cf0a39d95 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md @@ -50,6 +50,8 @@ publishReminder(reminderReq: ReminderRequest): Promise<number> 发布一个后台代理提醒,使用Promise方式实现异步调用。 +**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER + **系统能力**: SystemCapability.Notification.ReminderAgent **参数**: -- GitLab