未验证 提交 6166beca 编写于 作者: O openharmony_ci 提交者: Gitee

!5799 Fix issues of Notification docs

Merge pull request !5799 from xuzhihao/OpenHarmony-3.2-Beta1
...@@ -3,9 +3,17 @@ ...@@ -3,9 +3,17 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从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_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 | 表示用户已完成引导,系统已加载,但屏幕仍锁定的公共事件的操作。 | | COMMON_EVENT_LOCKED_BOOT_COMPLETED | usual.event.LOCKED_BOOT_COMPLETED | ohos.permission.RECEIVER_STARTUP_COMPLETED | 表示用户已完成引导,系统已加载,但屏幕仍锁定的公共事件的操作。 |
...@@ -158,11 +166,6 @@ ...@@ -158,11 +166,6 @@
| COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 | 表示设备飞行模式已更改的公共事件的动作。 | | COMMON_EVENT_AIRPLANE_MODE_CHANGED | usual.event.AIRPLANE_MODE | 无 | 表示设备飞行模式已更改的公共事件的动作。 |
| COMMON_EVENT_SPLIT_SCREEN | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | 表示分屏的公共事件的动作。 | | COMMON_EVENT_SPLIT_SCREEN | usual.event.SPLIT_SCREEN | ohos.permission.RECEIVER_SPLIT_SCREEN | 表示分屏的公共事件的动作。 |
## 导入模块
```js
import CommonEvent from '@ohos.commonEvent';
```
## CommonEvent.publish ## CommonEvent.publish
...@@ -172,6 +175,8 @@ publish(event: string, callback: AsyncCallback\<void>): void ...@@ -172,6 +175,8 @@ publish(event: string, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Notification.CommonEvent **系统能力:** SystemCapability.Notification.CommonEvent
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
...@@ -205,6 +210,8 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\ ...@@ -205,6 +210,8 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\
**系统能力:** SystemCapability.Notification.CommonEvent **系统能力:** SystemCapability.Notification.CommonEvent
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
......
...@@ -16,12 +16,14 @@ import emitter from '@ohos.events.emitter' ...@@ -16,12 +16,14 @@ import emitter from '@ohos.events.emitter'
用于表示事件被投递的优先级。 用于表示事件被投递的优先级。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 值 | 说明 | | 名称 | 值 | 说明 |
| --------- | ---- | ------------------------------------------------- | | --------- | ---- | ------------------------------------------------- |
| IMMEDIATE | 0 | 表示事件被立即投递。<br/>**系统能力**: SystemCapability.Notification.Emitter | | IMMEDIATE | 0 | 表示事件被立即投递。 |
| HIGH | 1 | 表示事件先于LOW优先级投递。<br/>**系统能力**: SystemCapability.Notification.Emitter | | HIGH | 1 | 表示事件先于LOW优先级投递。 |
| LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。<br/>**系统能力**: SystemCapability.Notification.Emitter | | LOW | 2 | 表示事件优于IDLE优先级投递,事件的默认优先级是LOW。 |
| IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。<br/>**系统能力**: SystemCapability.Notification.Emitter | | IDLE | 3 | 表示在没有其他事件的情况下,才投递该事件。 |
## emitter.on ## emitter.on
...@@ -131,15 +133,19 @@ emitter.emit(innerEvent, eventData); ...@@ -131,15 +133,19 @@ emitter.emit(innerEvent, eventData);
进程内的事件。 进程内的事件。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | ------------------------------- | ---- | ---- | ---------------------------------- | | -------- | ------------------------------- | ---- | ---- | ---------------------------------- |
| eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。<br/>**系统能力**: SystemCapability.Notification.Emitter | | eventId | number | 是 | 是 | 事件的ID,由开发者定义用来辨别事件。 |
| priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。<br/>**系统能力**: SystemCapability.Notification.Emitter | | priority | [EventPriority](#eventpriority) | 是 | 是 | 事件被投递的优先级。 |
## EventData ## EventData
发送事件时传递的数据。 发送事件时传递的数据。
**系统能力**: 以下各项对应的系统能力均为 SystemCapability.Notification.Emitter
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| ---- | ------------------ | ---- | ---- | -------------- | | ---- | ------------------ | ---- | ---- | -------------- |
| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。<br/>**系统能力**: SystemCapability.Notification.Emitter | | data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。 |
...@@ -85,6 +85,10 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v ...@@ -85,6 +85,10 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -125,6 +129,10 @@ publish(request: NotificationRequest, userId: number): Promise\<void\> ...@@ -125,6 +129,10 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -287,6 +295,10 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void ...@@ -287,6 +295,10 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -318,6 +330,10 @@ addSlot(slot: NotificationSlot): Promise\<void\> ...@@ -318,6 +330,10 @@ addSlot(slot: NotificationSlot): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -397,6 +413,10 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi ...@@ -397,6 +413,10 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -432,6 +452,10 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\> ...@@ -432,6 +452,10 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -669,6 +693,10 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c ...@@ -669,6 +693,10 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -706,6 +734,10 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>): ...@@ -706,6 +734,10 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>):
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -738,6 +770,10 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): ...@@ -738,6 +770,10 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -769,6 +805,10 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>) ...@@ -769,6 +805,10 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>)
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -801,6 +841,10 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\> ...@@ -801,6 +841,10 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -831,6 +875,10 @@ enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallbac ...@@ -831,6 +875,10 @@ enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallbac
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -861,6 +909,10 @@ enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -861,6 +909,10 @@ enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -889,6 +941,8 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): ...@@ -889,6 +941,8 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -918,6 +972,10 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\> ...@@ -918,6 +972,10 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -951,6 +1009,10 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void ...@@ -951,6 +1009,10 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -977,6 +1039,10 @@ isNotificationEnabled(): Promise\<boolean\> ...@@ -977,6 +1039,10 @@ isNotificationEnabled(): Promise\<boolean\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1007,6 +1073,10 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi ...@@ -1007,6 +1073,10 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1037,6 +1107,10 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -1037,6 +1107,10 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1065,6 +1139,10 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void ...@@ -1065,6 +1139,10 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1094,6 +1172,10 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\> ...@@ -1094,6 +1172,10 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1127,6 +1209,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal ...@@ -1127,6 +1209,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1160,6 +1246,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\> ...@@ -1160,6 +1246,10 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1191,6 +1281,10 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati ...@@ -1191,6 +1281,10 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1220,6 +1314,10 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>> ...@@ -1220,6 +1314,10 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1253,6 +1351,10 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi ...@@ -1253,6 +1351,10 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1282,6 +1384,10 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\> ...@@ -1282,6 +1384,10 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1315,6 +1421,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCa ...@@ -1315,6 +1421,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCa
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1349,6 +1459,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void\> ...@@ -1349,6 +1459,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1381,6 +1495,10 @@ remove(hashCode: string, callback: AsyncCallback\<void\>): void ...@@ -1381,6 +1495,10 @@ remove(hashCode: string, callback: AsyncCallback\<void\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1410,6 +1528,10 @@ remove(hashCode: string): Promise\<void\> ...@@ -1410,6 +1528,10 @@ remove(hashCode: string): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1436,6 +1558,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void ...@@ -1436,6 +1558,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1465,6 +1589,10 @@ removeAll(callback: AsyncCallback\<void\>): void ...@@ -1465,6 +1589,10 @@ removeAll(callback: AsyncCallback\<void\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1491,6 +1619,10 @@ removeAll(bundle?: BundleOption): Promise\<void\> ...@@ -1491,6 +1619,10 @@ removeAll(bundle?: BundleOption): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1513,6 +1645,10 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void ...@@ -1513,6 +1645,10 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1540,6 +1676,10 @@ removeAll(userId: number): Promise\<void> ...@@ -1540,6 +1676,10 @@ removeAll(userId: number): Promise\<void>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1567,6 +1707,10 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>) ...@@ -1567,6 +1707,10 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>)
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1593,6 +1737,10 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification ...@@ -1593,6 +1737,10 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。removeGroupByBundle
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
...@@ -1771,6 +1919,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall ...@@ -1771,6 +1919,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1802,6 +1954,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> ...@@ -1802,6 +1954,10 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1829,6 +1985,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo ...@@ -1829,6 +1985,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1862,6 +2022,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\> ...@@ -1862,6 +2022,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1890,6 +2054,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb ...@@ -1890,6 +2054,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1926,6 +2094,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\> ...@@ -1926,6 +2094,10 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1958,6 +2130,10 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void ...@@ -1958,6 +2130,10 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -1984,6 +2160,10 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\> ...@@ -1984,6 +2160,10 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
...@@ -2007,6 +2187,10 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>) ...@@ -2007,6 +2187,10 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -2036,6 +2220,10 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> ...@@ -2036,6 +2220,10 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -2067,6 +2255,10 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void ...@@ -2067,6 +2255,10 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 | | 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
...@@ -2093,6 +2285,10 @@ supportDoNotDisturbMode(): Promise\<boolean\> ...@@ -2093,6 +2285,10 @@ supportDoNotDisturbMode(): Promise\<boolean\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
...@@ -2221,6 +2417,10 @@ enableDistributed(enable: boolean, callback: AsyncCallback\<void\>): void ...@@ -2221,6 +2417,10 @@ enableDistributed(enable: boolean, callback: AsyncCallback\<void\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2250,6 +2450,10 @@ enableDistributed(enable: boolean): Promise\<void> ...@@ -2250,6 +2450,10 @@ enableDistributed(enable: boolean): Promise\<void>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2326,6 +2530,10 @@ enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: Async ...@@ -2326,6 +2530,10 @@ enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: Async
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2360,6 +2568,10 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle ...@@ -2360,6 +2568,10 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2390,6 +2602,10 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool ...@@ -2390,6 +2602,10 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2421,6 +2637,10 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean> ...@@ -2421,6 +2637,10 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2455,6 +2675,10 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void ...@@ -2455,6 +2675,10 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
...@@ -2481,6 +2705,10 @@ getDeviceRemindType(): Promise\<DeviceRemindType\> ...@@ -2481,6 +2705,10 @@ getDeviceRemindType(): Promise\<DeviceRemindType\>
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
...@@ -2496,6 +2724,167 @@ Notification.getDeviceRemindType() ...@@ -2496,6 +2724,167 @@ Notification.getDeviceRemindType()
}); });
``` ```
## Notification.enableNotificationSlot<sup>9+</sup>
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\<void\>): void
设置是否启用应用通道(callback形式)。
**系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 |
| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| enable | boolean | 是 | 是否启用的标记。true为启用;false为禁用。 |
| callback | AsyncCallback\<void\> | 是 | 获取启用应用通道的回调函数。 |
**示例:**
```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.enableNotificationSlot<sup>9+</sup>
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\<void\>
设置是否启用应用通道(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.isNotificationSlotEnabled<sup>9+</sup>
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\<boolean\>): void
获取应用通道是否启用的结果(callback形式)。
**系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 |
| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| callback | AsyncCallback\<boolean\> | 是 | 获取启用应用通道的回调函数。 |
**示例:**
```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.isNotificationSlotEnabled<sup>9+</sup>
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolean\>
获取应用通道是否启用的结果(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定的应用的包的信息。 |
| type | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<boolean\> | 以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.publishAsBundle<sup>9+</sup> ## Notification.publishAsBundle<sup>9+</sup>
publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\<void\>): void publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\<void\>): void
...@@ -2504,8 +2893,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -2504,8 +2893,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**参数:** **需要权限**: ohos.permission.NOTIFICATION_CONTROLLER,ohos.permission.NOTIFICATION_AGENT_CONTROLLER
**系统API**: 此接口为系统接口,三方应用不支持调用。
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
...@@ -2549,6 +2941,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -2549,6 +2941,10 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
**系统能力**:SystemCapability.Notification.Notification **系统能力**: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 ...@@ -2591,6 +2987,8 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
**系统能力**:SystemCapability.Notification.Notification **系统能力**:SystemCapability.Notification.Notification
**需要权限**: ohos.permission.NOTIFICATION_CONTROLLER,ohos.permission.NOTIFICATION_AGENT_CONTROLLER
**参数:** **参数:**
...@@ -3050,7 +3448,7 @@ Notification.subscribe(subscriber, subscribeCallback); ...@@ -3050,7 +3448,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| title | 是 | 是 | string | 是 | 按钮标题。 | | title | 是 | 是 | string | 是 | 按钮标题。 |
| wantAgent | 是 | 是 | WantAgent | 是 | 点击按钮时触发的WantAgent。 | | wantAgent | 是 | 是 | WantAgent | 是 | 点击按钮时触发的WantAgent。 |
| extras | 是 | 是 | { [key: string]: any } | 否 | 按钮扩展信息。 | | extras | 是 | 是 | { [key: string]: any } | 否 | 按钮扩展信息。 |
| userInput<sup>9+</sup> | 是 | 是 | [NotificationUserInput](#notificationuserinput8) | 否 | 用户输入对象实例。 | | userInput<sup>8+</sup> | 是 | 是 | [NotificationUserInput](#notificationuserinput8) | 否 | 用户输入对象实例。 |
## NotificationBasicContent ## NotificationBasicContent
...@@ -3275,3 +3673,14 @@ Notification.subscribe(subscriber, subscribeCallback); ...@@ -3275,3 +3673,14 @@ Notification.subscribe(subscriber, subscribeCallback);
| IDLE_REMIND | 1 | 提醒设备未被使用。 | | IDLE_REMIND | 1 | 提醒设备未被使用。 |
| ACTIVE_DONOT_REMIND | 2 | 设备正在使用,无需提醒。 | | ACTIVE_DONOT_REMIND | 2 | 设备正在使用,无需提醒。 |
| ACTIVE_REMIND | 3 | 提醒设备正在使用。 | | ACTIVE_REMIND | 3 | 提醒设备正在使用。 |
## SourceType<sup>8+</sup>
**系统能力**:SystemCapability.Notification.Notification
| 名称 | 值 | 描述 |
| -------------------- | --- | -------------------- |
| TYPE_NORMAL | 0 | 一般通知。 |
| TYPE_CONTINUOUS | 1 | 连续通知。 |
| TYPE_TIMER | 2 | 计划通知。 |
\ No newline at end of file
...@@ -50,6 +50,8 @@ publishReminder(reminderReq: ReminderRequest): Promise&lt;number&gt; ...@@ -50,6 +50,8 @@ publishReminder(reminderReq: ReminderRequest): Promise&lt;number&gt;
发布一个后台代理提醒,使用Promise方式实现异步调用。 发布一个后台代理提醒,使用Promise方式实现异步调用。
**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER
**系统能力**: SystemCapability.Notification.ReminderAgent **系统能力**: SystemCapability.Notification.ReminderAgent
**参数** **参数**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册