1# NotificationContent 2 3The **NotificationContent** module provides APIs for defining the notification content. 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## NotificationContent 10 11Describes the notification contents. 12 13**System capability**: SystemCapability.Notification.Notification 14 15| Name | Type | Read Only| Optional| Description | 16| ----------- | --------------------------------------------------------------------------- | ---- | --- | ------------------ | 17| contentType<sup>(deprecated)</sup> | [notification.ContentType](./js-apis-notification.md#contenttype) | No | Yes | Notification content type.<br>This API is deprecated since API version 11. You are advised to use **notificationContentType** instead. | 18| notificationContentType<sup>11+</sup> | [notificationManager.ContentType](./js-apis-notificationManager.md#contenttype) | No | Yes | Notification content type. | 19| normal | [NotificationBasicContent](#notificationbasiccontent) | No | Yes | Normal text. | 20| longText | [NotificationLongTextContent](#notificationlongtextcontent) | No | Yes | Long text.| 21| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | No | Yes | Multi-line text. | 22| picture | [NotificationPictureContent](#notificationpicturecontent) | No | Yes | Picture-attached. | 23| systemLiveView<sup>11+</sup> | [NotificationSystemLiveViewContent](#notificationsystemliveviewcontent) | No | Yes | System live view. A third-party application cannot directly create a notification of this type. After the system proxy creates a system live view, the third-party application releases a notification with the same ID to update the specified content.| 24 25## NotificationBasicContent 26 27Describes the normal text notification. 28 29**System capability**: SystemCapability.Notification.Notification 30 31| Name | Type | Read Only| Optional| Description | 32| -------------- | ------ | ---- |-----| ---------------------------------- | 33| title | string | No | No | Notification title. It cannot be empty or exceed 200 bytes. Excess content will be truncated. | 34| text | string | No | No | Notification content. It cannot be empty or exceed 200 bytes. Excess content will be truncated. | 35| additionalText | string | No | Yes | Additional information of the notification. It cannot exceed 200 bytes. Excess content will be truncated. | 36| lockscreenPicture<sup>12+</sup> | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | No | Yes | Picture of a notification displayed on the lock screen. Currently, only the live view notification is supported. The total number of the icon pixel bytes cannot exceed 192 KB (which is obtained through [getPixelBytesNumber](../apis-image-kit/js-apis-image.md#getpixelbytesnumber7). The recommended icon size is 128 × 128 pixels. The display effect depends on the device capability and notification center UI style. | 37 38## NotificationLongTextContent 39 40Describes the long text notification. This API is inherited from [NotificationBasicContent](#notificationbasiccontent). 41 42> **NOTE** 43> 44> The display effect depends on the device capability and notification center UI style. 45 46**System capability**: SystemCapability.Notification.Notification 47 48| Name | Type | Read Only| Optional| Description | 49| -------------- | ------ | ---- | --- | -------------------------------- | 50| longText | string | No | No | Long text of the notification. It cannot be an empty string and exceed 1024 bytes. Excess content will be truncated. | 51| briefText | string | No | No | Brief text of the notification. It cannot be empty or exceed 200 bytes. Excess content will be truncated. | 52| expandedTitle | string | No | No | Title of the notification in the expanded state. It cannot be empty or exceed 200 bytes. Excess content will be truncated. | 53 54 55## NotificationMultiLineContent 56 57Describes the multi-line text notification. This API is inherited from [NotificationBasicContent](#notificationbasiccontent). 58 59> **NOTE** 60> 61> The display effect depends on the device capability and notification center UI style. 62 63**System capability**: SystemCapability.Notification.Notification 64 65| Name | Type | Read Only| Optional| Description | 66| -------------- | --------------- | --- | --- | -------------------------------- | 67| briefText | string | No | No | Brief text of the notification. It cannot be empty or exceed 200 bytes. Excess content will be truncated.| 68| longTitle | string | No | No | Title of the notification in the expanded state. It cannot be empty or exceed 200 bytes. Excess content will be truncated.| 69| lines | Array\<string\> | No | No | Multi-line text of the notification. It cannot exceed 200 bytes. Excess content will be truncated. | 70 71 72## NotificationPictureContent 73 74Describes the picture-attached notification. This API is inherited from [NotificationBasicContent](#notificationbasiccontent). 75 76> **NOTE** 77> 78> The display effect depends on the device capability and notification center UI style. 79 80**System capability**: SystemCapability.Notification.Notification 81 82| Name | Type | Read Only| Optional| Description | 83| -------------- | -------------------------------------------- | ---- | --- |------------------------------------| 84| briefText | string | No | No | Brief text of the notification. It cannot be empty or exceed 200 bytes. Excess content will be truncated.| 85| expandedTitle | string | No | No | Title of the notification in the expanded state. It cannot be empty or exceed 200 bytes. Excess content will be truncated. | 86| picture | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | No | No | Picture content of the notification. (The total number of bytes of image pixels cannot exceed 2 MB.)| 87 88 89## NotificationSystemLiveViewContent 90 91Describes the system live view notification. A third-party application cannot directly create a notification of this type. After the system proxy creates a system live view, the third-party application releases a notification with the same ID to update the specified content. This API is inherited from [NotificationBasicContent](#notificationbasiccontent). 92 93**System capability**: SystemCapability.Notification.Notification 94 95| Name | Type | Read Only| Optional| Description | 96| ---------------------------- | ----------------------------------------------- | --- | --- | -----------------------------------| 97| typeCode<sup>11+</sup> | number | No | No | Type code, which identifies the type of the service that invokes the API. | 98| capsule<sup>11+</sup> | [NotificationCapsule](#notificationcapsule11) | No | Yes | Capsule of the notification. | 99| button<sup>11+</sup> | [NotificationButton](#notificationbutton11) | No | Yes | Button in the notification. | 100| time<sup>11+</sup> | [NotificationTime](#notificationtime11) | No | Yes | Time of the notification. | 101| progress<sup>11+</sup> | [NotificationProgress](#notificationprogress11) | No | Yes | Progress of the notification. | 102 103 104## NotificationCapsule<sup>11+</sup> 105 106Describe the notification capsule. 107 108**System capability**: SystemCapability.Notification.Notification 109 110| Name | Type | Read Only| Optional| Description | 111| --------------- | -------------------------------------------- | --- | --- | -------------------------------- | 112| title | string | No | Yes | Title of the capsule. | 113| icon | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | No | Yes | Icon of the capsule. | 114| backgroundColor | string | No | Yes | Background color of the capsule. | 115 116 117## NotificationButton<sup>11+</sup> 118 119Describes the notification button. 120 121**System capability**: SystemCapability.Notification.Notification 122 123| Name | Type | Read Only| Optional| Description | 124| ----- | ----------------------------------------------------- | --- | --- | ----------------- | 125| names | Array\<string\> | No | Yes| Button names. A maximum of three names are supported. | 126| icons | Array\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)\> | No | Yes| Button icons. A maximum of three icons are supported. | 127| iconsResource<sup>12+</sup> | Array\<[Resource](../apis-arkui/arkui-ts/ts-types.md#resource)\> | No | Yes| Button icon resources. A maximum of three icon resources are supported. | 128 129## NotificationTime<sup>11+</sup> 130 131Describes the notification timing information. 132 133**System capability**: SystemCapability.Notification.Notification 134 135| Name | Type | Read Only| Optional| Description | 136| -------------- | ---------------- | --- | --- | -------------------------------- | 137| initialTime | number | No | Yes | Start time, in milliseconds. | 138| isCountDown | boolean | No | Yes | Whether to count down. | 139| isPaused | boolean | No | Yes | Whether to pause the progress. | 140| isInTitle | boolean | No | Yes | Whether the time is displayed in the title. | 141 142**Example**: 143 144```ts 145// The notification counts down from three seconds and the time is displayed in the title. 146time: { 147 initialTime: 3000, 148 isCountDown: true, 149 isPaused: false, 150 isInTitle: true, 151} 152``` 153 154 155## NotificationProgress<sup>11+</sup> 156 157Describes the notification progress. 158 159**System capability**: SystemCapability.Notification.Notification 160 161| Name | Type | Read Only| Optional| Description | 162| -------------- | --------------- | --- | --- | -------------------------------- | 163| maxValue | number | No | Yes | Maximum progress value. | 164| currentValue | number | No | Yes | Current progress value. | 165| isPercentage | boolean | No | Yes | Whether to show the progress in percentage. | 166