• 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                                                   |  Read-only| Mandatory| Description                                                                   |
14|-------------------------------| -------------------------------------------------------- | ----- | --- |-----------------------------------------------------------------------|
15| content                       | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent)   |   No | Yes | Notification content.                                                                |
16| id                            | number                                                   |   No | No | Notification ID.                                                                |
17| slotType<sup>(deprecated)</sup> | [SlotType](js-apis-notificationManager.md#slottype)    |   No | No | Notification slot type.<br>This API is deprecated since API version 11. You are advised to use **notificationSlotType** instead.                       |
18| notificationSlotType<sup>11+</sup> | [SlotType](js-apis-notificationManager.md#slottype) |   No | No | Notification slot type.                       |
19| isOngoing                     | boolean                                                  |   No | No | Whether the notification is an ongoing notification.                                                             |
20| isUnremovable                 | boolean                                                  |   No | No | Reserved. |
21| deliveryTime                  | number                                                   |   No | No | Time when the notification is sent.                                                              |
22| tapDismissed                  | boolean                                                  |   No | No | Whether the notification is automatically cleared.                                                            |
23| autoDeletedTime               | number                                                   |   No | No | Time when the notification is automatically cleared.                                                             |
24| wantAgent                     | [WantAgent](js-apis-app-ability-wantAgent.md)            |   No | No | **WantAgent** instance to which the notification will be redirected after being clicked.                                      |
25| extraInfo                     | {[key: string]: any}                                     |   No | No | Extended parameters.                                                                |
26| color                         | number                                                   |   No | No | Background color of the notification. Not supported currently.                                                    |
27| colorEnabled                  | boolean                                                  |   No | No | Whether the notification background color can be enabled. Not supported currently.                                                |
28| isAlertOnce                   | boolean                                                  |   No | No | Whether the notification triggers an alert only once.                                                       |
29| isStopwatch                   | boolean                                                  |   No | No | Whether to display the stopwatch.                                                            |
30| isCountDown                   | boolean                                                  |   No | No | Whether to display the countdown time.                                                           |
31| isFloatingIcon                | boolean                                                  |   No | No | Whether the notification is displayed as a floating icon in the status bar.                                                           |
32| label                         | string                                                   |   No | No | Notification label.                                                                |
33| badgeIconStyle                | number                                                   |   No | No | Notification badge type. Not supported currently.                                                    |
34| showDeliveryTime              | boolean                                                  |   No | No | Whether to display the time when the notification is delivered.                                                            |
35| actionButtons                 | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\>             |   No | No | Buttons in the notification. Up to three buttons are allowed.                                                         |
36| smallIcon                     | [image.PixelMap](js-apis-image.md#pixelmap7)             |   No | No | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.                                                |
37| largeIcon                     | [image.PixelMap](js-apis-image.md#pixelmap7)             |   No | No | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.                                                |
38| overlayIcon<sup>11+<sup>      | [image.PixelMap](js-apis-image.md#pixelmap7)             |   No | No | Notification overlay icon. This field is optional, and the icon size cannot exceed 30 KB.<br>**System API**: This is a system API.                                                |
39| creatorBundleName             | string                                                   |   Yes | No | Name of the bundle that creates the notification.                                                             |
40| creatorUid                    | number                                                   |   Yes | No | UID used for creating the notification.                                                            |
41| creatorPid                    | number                                                   |   Yes | No | PID used for creating the notification.                                                            |
42| creatorUserId<sup>8+<sup>     | number                                                   |   Yes | No | ID of the user who creates the notification.                                                         |
43| hashCode                      | string                                                   |   Yes | No | Unique ID of the notification.                                                              |
44| classification                | string                                                   |   No | No | Notification category.<br>**System API**: This is a system API.                              |
45| groupName<sup>8+<sup>         | string                                                   |   No | No | Notification group name.                                                               |
46| template<sup>8+<sup>          | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) |   No | No | Notification template.                                                                |
47| isRemoveAllowed<sup>8+<sup>   | boolean                                                  |   No | No | Whether the notification can be removed. If a notification is not removable, it will not be deleted when the user touches the delete button below the notification, but it can still be deleted by swiping left on the notification and touching the delete button.<br>**System API**: This is a system API.<br>**Required permissions**: ohos.permission.SET_UNREMOVABLE_NOTIFICATION|
48| source<sup>8+<sup>            | number                                                   |   Yes | No | Notification source.<br>**System API**: This is a system API.                               |
49| distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions)                |   No | No | Distributed notification options.                                                            |
50| deviceId<sup>8+<sup>          | string                                                   |   Yes | No | Device ID of the notification source.<br>**System API**: This is a system API.                      |
51| notificationFlags<sup>8+<sup> | [NotificationFlags](js-apis-inner-notification-notificationFlags.md#notificationflags)                   |   Yes | No | Notification flags.                                                 |
52| removalWantAgent<sup>9+<sup>  | [WantAgent](js-apis-app-ability-wantAgent.md)            |   No | No | **WantAgent** instance to which the notification will be redirected when it is removed. The target **WantAgent** instance must be a common event or a system service (for which the value of **OperationType** is 3 or larger).                                         |
53| badgeNumber<sup>9+<sup>       | number                                                   |   No | No | Number of notifications displayed on the application icon.                                                       |
54
55
56## DistributedOptions
57
58Describes distributed notification options.
59
60**System capability**: SystemCapability.Notification.Notification
61
62| Name                  | Type           | Mandatory| Description                              |
63| ---------------------- | -------------- | ---- | ---------------------------------- |
64| isDistributed<sup>8+<sup>          | boolean        | No  | Whether the notification is a distributed notification.                  |
65| supportDisplayDevices<sup>8+<sup>  | Array\<string> | No  | List of the devices to which the notification can be synchronized.           |
66| supportOperateDevices<sup>8+<sup>  | Array\<string> | No  | List of the devices on which the notification can be opened.             |
67| remindType<sup>8+<sup>             | number         | No  | Notification reminder type.<br>**System API**: This is a system API.                   |
68
69
70## NotificationFilter<sup>11+</sup>
71
72Describes the filter criteria for querying the live view.
73
74**System capability**: SystemCapability.Notification.Notification
75
76**System API**: This is a system API.
77
78| Name           | Type                                  | Mandatory| Description                              |
79| ----------------| ------------------------------------- | ---- | ---------------------------------- |
80| bundle          | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the live view.|
81| notificationKey | [NotificationKey](js-apis-notificationSubscribe.md#notificationkey) | Yes  | Notification information, including the notification ID and label.  |
82| extraInfoKeys   | Array\<string>                        | No  | List of extra keys. If this parameter is left empty, all extra information is included.|
83
84
85## NotificationCheckRequest<sup>11+</sup>
86
87Describes the notification authentication information.
88
89**System capability**: SystemCapability.Notification.Notification
90
91**System API**: This is a system API.
92
93| Name         | Type                                                      | Mandatory| Description             |
94| --------------| --------------------------------------------------------- | ---- | ----------------- |
95| contentType   | [ContentType](js-apis-notificationManager.md#contenttype) | Yes  | Notification type.        |
96| slotType      | [SlotType](js-apis-notificationManager.md#slottype)       | Yes  | Notification slot type.        |
97| extraInfoKeys | Array\<string>                                            | Yes  | Extra information about the live view.|
98