• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NotificationRequest
2
3The **NotificationRequest** module describes the notification request.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9**System capability**: SystemCapability.Notification.Notification
10
11| Name                 | Type                                         | Readable| Writable| Description                      |
12| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- |
13| content               | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent)   | Yes | Yes | Notification content.                  |
14| id                    | number                                        | Yes | Yes | Notification ID.                    |
15| slotType              | [SlotType](js-apis-notificationManager.md#slottype)                         | Yes | Yes | Notification slot type.                  |
16| isOngoing             | boolean                                       | Yes | Yes | Whether the notification is an ongoing notification.            |
17| isUnremovable         | boolean                                       | Yes | Yes | Whether the notification can be removed.                |
18| deliveryTime          | number                                        | Yes | Yes | Time when the notification is sent.              |
19| tapDismissed          | boolean                                       | Yes | Yes | Whether the notification is automatically cleared.          |
20| autoDeletedTime       | number                                        | Yes | Yes | Time when the notification is automatically cleared.            |
21| wantAgent             | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.|
22| extraInfo             | {[key: string]: any}                          | Yes | Yes | Extended parameters.                  |
23| color                 | number                                        | Yes | Yes | Background color of the notification. Not supported currently.|
24| colorEnabled          | boolean                                       | Yes | Yes | Whether the notification background color can be enabled. Not supported currently.|
25| isAlertOnce           | boolean                                       | Yes | Yes | Whether the notification triggers an alert only once.|
26| isStopwatch           | boolean                                       | Yes | Yes | Whether to display the stopwatch.          |
27| isCountDown           | boolean                                       | Yes | Yes | Whether to display the countdown time.        |
28| isFloatingIcon        | boolean                                       | Yes | Yes | Whether the notification is displayed as a floating icon in the status bar.        |
29| label                 | string                                        | Yes | Yes | Notification label.                  |
30| badgeIconStyle        | number                                        | Yes | Yes | Notification badge type.              |
31| showDeliveryTime      | boolean                                       | Yes | Yes | Whether to display the time when the notification is delivered.          |
32| actionButtons         | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\>             | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. |
33| smallIcon             | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
34| largeIcon             | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.|
35| creatorBundleName     | string                                        | Yes | No | Name of the bundle that creates the notification.            |
36| creatorUid<sup>8+<sup>  | number                                        | Yes | No | UID used for creating the notification.             |
37| creatorPid            | number                                        | Yes | No | PID used for creating the notification.             |
38| creatorUserId| number                                    | Yes | No | ID of the user who creates the notification.          |
39| hashCode              | string                                        | Yes | No | Unique ID of the notification.              |
40| classification        | string                                        | Yes | Yes | Notification category.<br>**System API**: This is a system API and cannot be called by third-party applications.                  |
41| groupName<sup>8+<sup> | string                                        | Yes | Yes | Notification group name.                |
42| template<sup>8+<sup> | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | Yes | Yes | Notification template.                  |
43| isRemoveAllowed<sup>8+<sup> | boolean                                | Yes | No | Whether the notification can be removed.<br>**System API**: This is a system API and cannot be called by third-party applications.                  |
44| source<sup>8+<sup> | number                                        | Yes | No | Notification source.<br>**System API**: This is a system API and cannot be called by third-party applications.                  |
45| distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions)                 | Yes | Yes | Distributed notification options.         |
46| deviceId<sup>8+<sup> | string                                        | Yes | No | Device ID of the notification source.<br>**System API**: This is a system API and cannot be called by third-party applications.         |
47| notificationFlags<sup>8+<sup> | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags)                    | Yes | No | Notification flags.         |
48| removalWantAgent<sup>9+<sup> | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected when it is removed.         |
49| badgeNumber<sup>9+<sup> | number                    | Yes | Yes | Number of notifications displayed on the application icon.         |
50
51
52## DistributedOptions
53
54Describes distributed notification options.
55
56**System capability**: SystemCapability.Notification.Notification
57
58| Name                  | Type           | Readable| Writable| Description                              |
59| ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
60| isDistributed<sup>8+<sup>          | boolean        | Yes  | Yes  | Whether the notification is a distributed notification.                 |
61| supportDisplayDevices<sup>8+<sup>  | Array\<string> | Yes  | Yes  | List of the devices to which the notification can be synchronized.        |
62| supportOperateDevices<sup>8+<sup>  | Array\<string> | Yes  | Yes  | List of the devices on which the notification can be opened.             |
63| remindType<sup>8+<sup>             | number         | Yes  | No  | Notification reminder type.<br>**System API**: This is a system API and cannot be called by third-party applications.                   |
64