harmony 鸿蒙NotificationRequest

  • 2023-06-24
  • 浏览 (566)

NotificationRequest

The NotificationRequest module provides APIs for defining 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.

NotificationRequest

System capability: SystemCapability.Notification.Notification

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

DistributedOptions

Describes distributed notification options.

System capability: SystemCapability.Notification.Notification

Name Type Mandatory Description
isDistributed8+ boolean No Whether the notification is a distributed notification.
supportDisplayDevices8+ Array<string> No List of the devices to which the notification can be synchronized.
supportOperateDevices8+ Array<string> No List of the devices on which the notification can be opened.
remindType8+ number No Notification reminder type.
System API: This is a system API and cannot be called by third-party applications.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

0  赞