• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NotificationRequest
2
3描述通知的请求。
4
5> **说明:**
6>
7> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8
9## NotificationRequest
10
11**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
12
13| 名称                            | 类型                                          | 必填 | 说明                                                                    |
14|-------------------------------| --------------------------------------------- | --- |-----------------------------------------------------------------------|
15| content                       | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent)   | 是  | 通知内容。                                                                 |
16| id                            | number                                        | 否  | 通知ID。                                                                 |
17| slotType                      | [SlotType](js-apis-notificationManager.md#slottype)                         | 否  | 通道类型。                                                                 |
18| isOngoing                     | boolean                                       | 否  | 是否进行时通知。                                                              |
19| isUnremovable                 | boolean                                       | 否  | 是否可移除(应用于长时间通知任务上,比如地图、音乐播放;点击通知下方删除按钮无法删除,左滑点击单个删除按钮可删除)。            |
20| deliveryTime                  | number                                        | 否  | 通知发送时间。                                                               |
21| tapDismissed                  | boolean                                       | 否  | 通知是否自动清除。                                                             |
22| autoDeletedTime               | number                                        | 否  | 自动清除的时间。                                                              |
23| wantAgent                     | [WantAgent](js-apis-app-ability-wantAgent.md) | 否  | WantAgent封装了应用的行为意图,点击通知时触发该行为。                                       |
24| extraInfo                     | {[key: string]: any}                          | 否  | 扩展参数。                                                                 |
25| color                         | number                                        | 否  | 通知背景颜色。预留能力,暂未支持。                                                     |
26| colorEnabled                  | boolean                                       | 否  | 通知背景颜色是否使能。预留能力,暂未支持。                                                 |
27| isAlertOnce                   | boolean                                       | 否  | 设置是否仅有一次此通知提醒。                                                        |
28| isStopwatch                   | boolean                                       | 否  | 是否显示已用时间。                                                             |
29| isCountDown                   | boolean                                       | 否  | 是否显示倒计时时间。                                                            |
30| isFloatingIcon                | boolean                                       | 否  | 是否显示状态栏图标。                                                            |
31| label                         | string                                        | 否  | 通知标签。                                                                 |
32| badgeIconStyle                | number                                        | 否  | 通知角标类型。预留能力,暂未支持。                                                     |
33| showDeliveryTime              | boolean                                       | 否  | 是否显示分发时间。                                                             |
34| actionButtons                 | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\>             | 否  | 通知按钮,最多三个按钮。                                                          |
35| smallIcon                     | [image.PixelMap](js-apis-image.md#pixelmap7) | 否  | 通知小图标。可选字段,大小不超过30KB。                                                 |
36| largeIcon                     | [image.PixelMap](js-apis-image.md#pixelmap7) | 否  | 通知大图标。可选字段,大小不超过30KB。                                                 |
37| creatorBundleName             | string                                        | 否  | 创建通知的包名。                                                              |
38| creatorUid                    | number                                        | 否  | 创建通知的UID。                                                             |
39| creatorPid                    | number                                        | 否  | 创建通知的PID。                                                             |
40| creatorUserId<sup>8+<sup>     | number                                       | 否  | 创建通知的UserId。                                                          |
41| hashCode                      | string                                        | 否  | 通知唯一标识。                                                               |
42| classification                | string                                        | 否  | 通知分类。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。                               |
43| groupName<sup>8+<sup>         | string                                        | 否  | 组通知名称。                                                                |
44| template<sup>8+<sup>          | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 否  | 通知模板。                                                                 |
45| isRemoveAllowed<sup>8+<sup>   | boolean                                | 否  | 通知是否能被移除(点击通知下方删除按钮无法删除,左滑不出现删除按钮)。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
46| source<sup>8+<sup>            | number                                        | 否  | 通知源。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。                                |
47| distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions)                 | 否  | 分布式通知的选项。                                                             |
48| deviceId<sup>8+<sup>          | string                                        | 否  | 通知源的deviceId。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。                       |
49| notificationFlags<sup>8+<sup> | [NotificationFlags](js-apis-inner-notification-notificationFlags.md#notificationflags)                    | 否  | 获取NotificationFlags。                                                  |
50| removalWantAgent<sup>9+<sup>  | [WantAgent](js-apis-app-ability-wantAgent.md) | 否  | 当移除通知时,通知将被重定向到的WantAgent实例。                                          |
51| badgeNumber<sup>9+<sup>       | number                    | 否  | 应用程序图标上显示的通知数。                                                        |
52
53
54## DistributedOptions
55
56描述分布式选项。
57
58**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
59
60| 名称                   | 类型            | 必填 | 说明                               |
61| ---------------------- | -------------- | ---- | ---------------------------------- |
62| isDistributed<sup>8+<sup>          | boolean        | 否   | 是否为分布式通知。                   |
63| supportDisplayDevices<sup>8+<sup>  | Array\<string> | 否   | 可以同步通知到的设备列表。            |
64| supportOperateDevices<sup>8+<sup>  | Array\<string> | 否   | 可以打开通知的设备列表。              |
65| remindType<sup>8+<sup>             | number         | 否   | 通知的提醒方式。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。                    |
66