NotificationContent
The NotificationContent module provides APIs for defining 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.
NotificationContent
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
contentType | ContentType | No | Yes | Notification content type. |
normal | NotificationBasicContent | No | No | Normal text. |
longText | NotificationLongTextContent | No | No | Long text. |
multiLine | NotificationMultiLineContent | No | No | Multi-line text. |
picture | NotificationPictureContent | No | No | Picture-attached. |
NotificationBasicContent
Describes the normal text notification.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
title | string | No | Yes | Notification title. It cannot be an empty string. |
text | string | No | Yes | Notification content. It cannot be an empty string. |
additionalText | string | No | No | Additional information of the notification. |
NotificationLongTextContent
Describes the long text notification.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
title | string | No | Yes | Notification title. It cannot be an empty string. |
text | string | No | Yes | Notification content. It cannot be an empty string. |
additionalText | string | No | No | Additional information of the notification. |
longText | string | No | Yes | Long text of the notification. It cannot be an empty string. |
briefText | string | No | Yes | Brief text of the notification. It cannot be an empty string. |
expandedTitle | string | No | Yes | Title of the notification in the expanded state. It cannot be an empty string. |
NotificationMultiLineContent
Describes the multi-line text notification.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
title | string | No | Yes | Notification title. It cannot be an empty string. |
text | string | No | Yes | Notification content. It cannot be an empty string. |
additionalText | string | No | No | Additional information of the notification. |
briefText | string | No | Yes | Brief text of the notification. It cannot be an empty string. |
longTitle | string | No | Yes | Title of the notification in the expanded state. It cannot be an empty string. |
lines | Array<string> | No | Yes | Multi-line text of the notification. |
NotificationPictureContent
Describes the picture-attached notification.
System capability: SystemCapability.Notification.Notification
Name | Type | Read-only | Mandatory | Description |
---|---|---|---|---|
title | string | No | Yes | Notification title. It cannot be an empty string. |
text | string | No | Yes | Notification content. It cannot be an empty string. |
additionalText | string | No | No | Additional information of the notification. |
briefText | string | No | Yes | Brief text of the notification. It cannot be an empty string. |
expandedTitle | string | No | Yes | Title of the notification in the expanded state. It cannot be an empty string. |
picture | image.PixelMap | No | Yes | Picture attached to the notification. The maximum size is 2 MB. |