• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NotificationContent (System API)
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> This topic describes only system APIs provided by the module. For details about its public APIs, see [NotificationContent](./js-apis-inner-notification-notificationContent.md).
10
11## NotificationContent
12
13**System capability**: SystemCapability.Notification.Notification
14
15| Name          | Type                                                                       | Read Only| Optional| Description              |
16| -----------   | --------------------------------------------------------------------------- | ---- | --- | ------------------ |
17| liveView<sup>11+</sup>       | [NotificationLiveViewContent](#notificationliveviewcontent11)              | No | Yes | Common live view.<br>**System API**: This is a system API.|
18
19## NotificationLiveViewContent<sup>11+</sup>
20
21Describes the common live view.
22
23**System capability**: SystemCapability.Notification.Notification
24
25**System API**: This is a system API.
26
27| Name          | Type                                                               | Read Only| Optional| Description                                                 |
28| -------------- | ------------------------------------------------------------------ | --- | --- | ------------------------------------------------------|
29| status         | [LiveViewStatus](#liveviewstatus11)                                | No | No | Notification status.                 |
30| version        | number                                                             | No | Yes | If the version number stored in the database is not **0xffffffff**, the version number needs to be verified when the live view is updated or ended to ensure that the current version number is greater than the version number stored in the database. The default value is **0xffffffff**.|
31| extraInfo      | Record<string, Object\>                                               | No | Yes | Extra information of the live view.          |
32| pictureInfo    | Record<string, Array<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)\>\> | No | Yes | Extra image information of the live view.|
33| isLocalUpdateOnly<sup>12+</sup> | boolean                                           | No | Yes | Whether the live view is updated only locally.    |
34| liveViewType<sup>16+</sup>  | [LiveViewTypes](#liveviewtypes18)  | No| Yes | Live view types. |
35| cardButtons<sup>16+</sup> | Array\<[NotificationIconButton](#notificationiconbutton18)\>    |  No |  Yes | Live view buttons (a maximum of three buttons are supported).     |
36
37## NotificationCapsule<sup>11+</sup>
38
39Describe the notification capsule.
40
41**System capability**: SystemCapability.Notification.Notification
42
43**System API**: This is a system API.
44
45| Name                 |  Type                        | Read Only| Optional| Description                             |
46| --------------------- | ---------------------------- | ---- | ---- | -------------------------------- |
47| content<sup>12+</sup> | string                       |  No |  Yes | Extended text of the capsule.                  |
48| time<sup>18+</sup> | number                       |  No |  Yes | Display duration of the notification capsule of an instant task, in seconds.  |
49| capsuleButtons<sup>18+</sup> | Array\<[NotificationIconButton](#notificationiconbutton18)\>    |  No |  Yes | Buttons of the notification capsule of an instant task. A maximum of two buttons are supported.     |
50
51## LiveViewStatus<sup>11+</sup>
52
53Enumerates the statuses of the common live view.
54
55**System capability**: SystemCapability.Security.AccessToken
56
57**System API**: This is a system API.
58
59| Name                        | Value|   Description  |
60| ---------------------------- |----|----------|
61| LIVE_VIEW_CREATE             | 0  | The live view is created.    |
62| LIVE_VIEW_INCREMENTAL_UPDATE | 1  | The live view is updated in incremental mode.|
63| LIVE_VIEW_END                | 2  | The live view is ended.    |
64| LIVE_VIEW_FULL_UPDATE        | 3  | The live view is updated in full mode.|
65
66## NotificationIconButton<sup>18+</sup>
67
68Describes the information of a system notification button.
69
70**System capability**: SystemCapability.Notification.Notification
71
72**System API**: This is a system API.
73
74| Name | Type                                                  | Read Only| Optional| Description            |
75| ----- | ----------------------------------------------------- | --- | --- | ----------------- |
76| name | string                                       | No |  No| Button ID, which is used to distinguish multiple buttons of the same notification.  |
77| iconResource | [Resource](../apis-arkui/arkui-ts/ts-types.md#resource) \| [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | No |  No| Background image of a button.  |
78| text | string | No |  Yes| Text displayed on the button.  |
79| hidePanel | bool | No |  Yes| Whether to hide the notification panel when the button is tapped.  |
80
81## LiveViewTypes<sup>18+</sup>
82
83Enumerates live view types.
84
85**System capability**: SystemCapability.Notification.Notification
86
87**System API**: This is a system API.
88
89| Name                        | Value|   Description  |
90| ---------------------------- |----|----------|
91| LIVE_VIEW_ACTIVITY           | 0  | Real-time activity (progress).|
92| LIVE_VIEW_INSTANT            | 1  | Instant task.|
93| LIVE_VIEW_LONG_TERM          | 2  | Long-term task.|
94