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