NotificationRequest
The NotificationRequest module describes the notification request.
NOTE
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.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
content | NotificationContent | No | Yes | Notification content. |
id | number | No | No | Notification ID. |
slotType | SlotType | Yes | No | Notification slot type. |
isOngoing | boolean | No | No | Whether the notification is an ongoing notification. |
isUnremovable | boolean | No | No | Whether the notification can be removed. |
deliveryTime | number | No | No | Time when the notification is sent. |
tapDismissed | boolean | No | No | Whether the notification is automatically cleared. |
autoDeletedTime | number | No | No | Time when the notification is automatically cleared. |
wantAgent | WantAgent | No | No | WantAgent instance to which the notification will be redirected after being clicked. |
extraInfo | {[key: string]: any} | No | No | Extended parameters. |
color | number | No | No | Background color of the notification. Not supported currently. |
colorEnabled | boolean | No | No | Whether the notification background color can be enabled. Not supported currently. |
isAlertOnce | boolean | No | No | Whether the notification triggers an alert only once. |
isStopwatch | boolean | No | No | Whether to display the stopwatch. |
isCountDown | boolean | No | No | Whether to display the countdown time. |
isFloatingIcon | boolean | No | No | Whether the notification is displayed as a floating icon in the status bar. |
label | string | No | No | Notification label. |
badgeIconStyle | number | No | No | Notification badge type. Not supported currently. |
showDeliveryTime | boolean | No | No | Whether to display the time when the notification is delivered. |
actionButtons | Array<NotificationActionButton> | No | No | Buttons in the notification. Up to three buttons are allowed. |
smallIcon | image.PixelMap | No | No | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB. |
largeIcon | image.PixelMap | No | No | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB. |
creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. |
creatorUid8+ | number | Yes | No | UID used for creating the notification. |
creatorPid | number | Yes | No | PID used for creating the notification. |
creatorUserId | number | Yes | No | ID of the user who creates the notification. |
hashCode | string | Yes | No | Unique ID of the notification. |
classification | string | No | No | Notification category. System API: This is a system API and cannot be called by third-party applications. |
groupName8+ | string | No | No | Notification group name. |
template8+ | NotificationTemplate | No | No | Notification template. |
isRemoveAllowed8+ | boolean | Yes | No | Whether the notification can be removed. System API: This is a system API and cannot be called by third-party applications. |
source8+ | number | Yes | No | Notification source. System API: This is a system API and cannot be called by third-party applications. |
distributedOption8+ | DistributedOptions | No | No | Distributed notification options. |
deviceId8+ | string | Yes | No | Device ID of the notification source. System API: This is a system API and cannot be called by third-party applications. |
notificationFlags8+ | NotificationFlags | Yes | No | Notification flags. |
removalWantAgent9+ | WantAgent | No | No | WantAgent instance to which the notification will be redirected when it is removed. |
badgeNumber9+ | number | No | No | Number of notifications displayed on the application icon. |
DistributedOptions
Describes distributed notification options.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
isDistributed8+ | boolean | No | No | Whether the notification is a distributed notification. |
supportDisplayDevices8+ | Array<string> | No | No | List of the devices to which the notification can be synchronized. |
supportOperateDevices8+ | Array<string> | No | No | List of the devices on which the notification can be opened. |
remindType8+ | number | Yes | No | Notification reminder type. System API: This is a system API and cannot be called by third-party applications. |