• 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/arkts-apis-image-PixelMap.md)\>\> | 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.  <br> - **true**: Yes.<br> - **false** (default): No.    |
34| liveViewType<sup>18+</sup>  | [LiveViewTypes](#liveviewtypes18)  | No| Yes | Live view types. |
35| cardButtons<sup>18+</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 | [IconType](#icontype18) | No  |  No | Background image of a button.                            |
78| text         | string                  | No  |  Yes | Text displayed on the button.                          |
79| hidePanel    | boolean                 | No  |  Yes | Whether to hide the notification panel when the button is tapped.  <br> - **true**: Yes.<br> - **false** (default): No.  |
80
81## IconType<sup>18+</sup>
82
83type IconType = Resource | image.PixelMap
84
85**System capability**: SystemCapability.Notification.Notification
86
87**System API**: This is a system API.
88
89| Type                                                            | Description                             |
90| ---------------------------------------------------------------- | -------------------------------- |
91| [Resource](../apis-arkui/arkui-ts/ts-types.md#resource)          | Image resource.            |
92| [image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md) | Image.                |
93
94## LiveViewTypes<sup>18+</sup>
95
96Enumerates live view types.
97
98**System capability**: SystemCapability.Notification.Notification
99
100**System API**: This is a system API.
101
102| Name                        | Value|   Description  |
103| ---------------------------- |----|----------|
104| LIVE_VIEW_ACTIVITY           | 0  | Real-time activity (progress).|
105| LIVE_VIEW_INSTANT            | 1  | Instant task.|
106| LIVE_VIEW_LONG_TERM          | 2  | Long-term task.|
107
108## NotificationMultiLineContent
109
110**System capability**: SystemCapability.Notification.Notification
111
112| Name          | Type   | Read-Only| Optional| Description                            |
113| -------------- | ------ | ---- | --- | -------------------------------- |
114| lineWantAgents<sup>20+</sup>       | Array<[wantAgent](../apis-ability-kit/js-apis-app-ability-wantAgent.md)> |  No | Yes | **wantAgent**s triggered when a line of text in the multi-line text is tapped. The text in different lines corresponds to different **wantAgent**s. The maximum number of lines configured for this field is equal to the value of [lines](./js-apis-inner-notification-notificationContent.md#notificationmultilinecontent).<br>**System API**: This is a system API.<br>**Required permissions**: ohos.permission.NOTIFICATION_AGENT_CONTROLLER|
115