The **NotificationActionButton** module describes the button displayed in the notification.
> **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.
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## BundleOption
Provides the bundle information of an application.
The **NotificationContent** module describes the notification content.
> **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.
The **NotificationFlags** module implements a **NotificationFlags** instance.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
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.
| isOngoing | boolean | Yes | Yes | Whether the notification is an ongoing notification. |
| isUnremovable | boolean | Yes | Yes | Whether the notification can be removed. |
| deliveryTime | number | Yes | Yes | Time when the notification is sent. |
| tapDismissed | boolean | Yes | Yes | Whether the notification is automatically cleared. |
| autoDeletedTime | number | Yes | Yes | Time when the notification is automatically cleared. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.|
| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. |
| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. |
| 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.|
| 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.|
| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. |
| creatorUid<sup>8+<sup> | 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 | Yes | Yes | Notification category.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| 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. |
| 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. |
| 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. |
| 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. |
| badgeNumber<sup>9+<sup> | number | Yes | Yes | Number of notifications displayed on the application icon. |
| isDistributed<sup>8+<sup> | boolean | Yes | Yes | Whether the notification is a distributed notification. |
| supportDisplayDevices<sup>8+<sup> | Array\<string> | Yes | Yes | List of the devices to which the notification can be synchronized. |
| supportOperateDevices<sup>8+<sup> | Array\<string> | Yes | Yes | List of the devices on which the notification can be opened. |
| 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. |
The **NotificationSlot** module describes the notification slot.
> **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.
| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.|
The **NotificationTemplate** module describes the notification template.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The **NotificationUserInput** module provides the notification user input.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
...
...
@@ -78,7 +78,7 @@ Publishes a notification. This API uses a promise to return the result.
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
**Error codes**
...
...
@@ -130,7 +130,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| userId | number | Yes | User ID. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
...
...
@@ -192,7 +192,7 @@ Publishes a notification to a specified user. This API uses a promise to return
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| userId | number | Yes | User ID. |
**Error codes**
...
...
@@ -427,7 +427,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r
| slotType | [SlotType](#slottype) | Yes | Type of the notification slot, which can be used for social communication, service information, content consultation, and other purposes.|
| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | Yes | Callback used to return the result. |
**Error codes**
...
...
@@ -757,7 +757,7 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/
| callback | AsyncCallback\<Array\<[NotificationSlot](#notificationslot)\>\> | Yes | Callback used to return all notification slots of the current application.|
| callback | AsyncCallback\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\>\> | Yes | Callback used to return all notification slots of the current application.|
**Error codes**
...
...
@@ -793,7 +793,7 @@ Obtains all notification slots of this application. This API uses a promise to r
| Promise\<Array\<[NotificationSlot](#notificationslot)\>\> | Promise used to return all notification slots of the current application.|
| Promise\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\>\> | Promise used to return all notification slots of the current application.|
**Error codes**
...
...
@@ -965,7 +965,7 @@ Sets whether to enable notification for a specified application. This API uses a
| callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | Yes | Callback used to return the result.|
| callback | AsyncCallback<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)\>> | Yes | Callback used to return the result.|
| Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> | Promise used to return the result.|
| Promise\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)\>\> | Promise used to return the result.|
**Error codes**
...
...
@@ -1904,7 +1904,7 @@ Obtains active notifications of this application. This API uses an asynchronous
| callback | AsyncCallback<Array\<[NotificationRequest](#notificationrequest)\>> | Yes | Callback used to return the result.|
| callback | AsyncCallback<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)\>> | Yes | Callback used to return the result.|
| Promise\<Array\<[NotificationRequest](#notificationrequest)\>\> | Promise used to return the result.|
| Promise\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)\>\> | Promise used to return the result.|
**Error codes**
...
...
@@ -1974,7 +1974,7 @@ Cancels notifications under a notification group of this application. This API u
| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](#notificationrequest) when the notification is published.|
| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) when the notification is published.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
...
...
@@ -2052,7 +2052,7 @@ Removes notifications under a notification group of a specified application. Thi
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. |
| userId | number | Yes | User ID. |
| callback | AsyncCallback | Yes | Callback used to return the result. |
...
...
@@ -3231,7 +3231,7 @@ Publishes a notification through the reminder agent. This API uses a promise to
| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.|
| representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. |
| userId | number | Yes | User ID. |
...
...
@@ -3391,9 +3391,9 @@ Sets whether to enable a specified notification slot type for a specified applic
| isOngoing | boolean | Yes | Yes | Whether the notification is an ongoing notification. |
| isUnremovable | boolean | Yes | Yes | Whether the notification can be removed. |
| deliveryTime | number | Yes | Yes | Time when the notification is sent. |
| tapDismissed | boolean | Yes | Yes | Whether the notification is automatically cleared. |
| autoDeletedTime | number | Yes | Yes | Time when the notification is automatically cleared. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.|
| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. |
| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. |
| 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.|
| 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.|
| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. |
| creatorUid | 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 | Yes | Yes | Notification category.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| isRemoveAllowed | 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. |
| source | number | Yes | No | Notification source.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| deviceId | 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. |
| removalWantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected when it is removed. |
| badgeNumber | number | Yes | Yes | Number of notifications displayed on the application icon. |
| isDistributed | boolean | Yes | Yes | Whether the notification is a distributed notification. |
| supportDisplayDevices | Array\<string> | Yes | Yes | List of the devices to which the notification can be synchronized. |
| supportOperateDevices | Array\<string> | Yes | Yes | List of the devices on which the notification can be opened. |
| remindType | number | Yes | No | Notification reminder type.<br>**System API**: This is a system API and cannot be called by third-party applications. |
| hashCode | string | Yes | Unique notification ID. It is the **hashCode** in the [NotificationRequest](#notificationrequest) object of [SubscribeCallbackData](#subscribecallbackdata) of the [onConsume](#onconsume) callback.|
| hashCode | string | Yes | Unique notification ID. It is the value of **hashCode** in the [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) object of [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) in the [onConsume](#onconsume) callback. |
| reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
...
...
@@ -459,7 +459,7 @@ Removes all notifications for a specified application. This API uses an asynchro
| callback | AsyncCallback\<[EnabledNotificationCallbackData](#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.|
| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.|
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.notification`](js-apis-notification.md).
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [@ohos.notification](js-apis-notification.md).
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...
...
@@ -17,22 +17,22 @@ import notification from '@system.notification';