• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# NotificationContent(系统接口)
2
3描述通知类型。
4
5> **说明:**
6>
7> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8>
9> 当前界面仅包含本模块的系统接口,其他公开接口参见[NotificationContent](./js-apis-inner-notification-notificationContent.md)。
10
11## NotificationContent
12
13**系统能力**:SystemCapability.Notification.Notification
14
15| 名称           | 类型                                                                        | 只读 | 可选 | 说明               |
16| -----------   | --------------------------------------------------------------------------- | ---- | --- | ------------------ |
17| liveView<sup>11+</sup>       | [NotificationLiveViewContent](#notificationliveviewcontent11)              | 否  | 是  | 普通实况窗类型通知内容。<br>**系统接口**:此接口为系统接口。|
18
19## NotificationLiveViewContent<sup>11+</sup>
20
21描述普通实况通知。
22
23**系统能力**:SystemCapability.Notification.Notification
24
25**系统接口**:此接口为系统接口。
26
27| 名称           | 类型                                                                | 只读| 可选 | 说明                                                  |
28| -------------- | ------------------------------------------------------------------ | --- | --- | ------------------------------------------------------|
29| status         | [LiveViewStatus](#liveviewstatus11)                                | 否  | 否  | 通知状态。                  |
30| version        | number                                                             | 否  | 是  | 通知版本号(如果数据库存储版本号为0xffffffff,则本次更新和结束不校验版本号大小,否则需要校验本次版本号>数据库存储版本号)。不填默认为0xffffffff。|
31| extraInfo      | Record<string, Object\>                                               | 否  | 是  | 实况通知附加内容。           |
32| pictureInfo    | Record<string, Array<[image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md)\>\> | 否  | 是  | 实况通知附加内容中的图片信息。|
33| isLocalUpdateOnly<sup>12+</sup> | boolean                                           | 否  | 是  | 实况窗是否只在本地更新。默认为false。<br> - true:是。<br> - false:否。     |
34| liveViewType<sup>18+</sup>  | [LiveViewTypes](#liveviewtypes18)  | 否 | 是  | 实况窗类型。  |
35| cardButtons<sup>18+</sup> | Array\<[NotificationIconButton](#notificationiconbutton18)\>    |  否  |  是  | 实况窗按钮(最多支持3个)。      |
36
37## NotificationCapsule<sup>11+</sup>
38
39描述通知胶囊。
40
41**系统能力**:SystemCapability.Notification.Notification
42
43**系统接口**:此接口为系统接口。
44
45| 名称                  |  类型                         | 只读 | 可选 | 说明                              |
46| --------------------- | ---------------------------- | ---- | ---- | -------------------------------- |
47| content<sup>12+</sup> | string                       |  否  |  是  | 胶囊的拓展文本。                   |
48| time<sup>18+</sup> | number                       |  否  |  是  | 即时任务类实况胶囊展示时长(单位:秒)。   |
49| capsuleButtons<sup>18+</sup> | Array\<[NotificationIconButton](#notificationiconbutton18)\>    |  否  |  是  | 即时任务类实况胶囊的按钮(最多支持2个)。      |
50
51## LiveViewStatus<sup>11+</sup>
52
53描述普通实况通知的状态。
54
55**系统能力**:SystemCapability.Security.AccessToken
56
57**系统接口**:此接口为系统接口。
58
59| 名称                         | 值 |   说明   |
60| ---------------------------- |----|----------|
61| LIVE_VIEW_CREATE             | 0  | 创建     |
62| LIVE_VIEW_INCREMENTAL_UPDATE | 1  | 增量更新 |
63| LIVE_VIEW_END                | 2  | 结束     |
64| LIVE_VIEW_FULL_UPDATE        | 3  | 全量更新 |
65
66## NotificationIconButton<sup>18+</sup>
67
68描述系统通知按钮。
69
70**系统能力**:SystemCapability.Notification.Notification
71
72**系统接口**:此接口为系统接口。
73
74| 名称          | 类型                    | 只读 | 可选 | 说明                                      |
75| ------------ | ----------------------- | ---- | ---- | ---------------------------------------- |
76| name         | string                  | 否   |  否  | 按钮标识,用于区分同一通知的多个不同按钮。   |
77| iconResource | [IconType](#icontype18) | 否   |  否  | 按钮的背景图。                             |
78| text         | string                  | 否   |  是  | 按钮展示的信息。                           |
79| hidePanel    | boolean                 | 否   |  是  | 点击按钮时,是否隐藏通知中心。默认为false。<br> - true:是。<br> - false:否。   |
80
81## IconType<sup>18+</sup>
82
83type IconType = Resource | image.PixelMap
84
85**系统能力**:SystemCapability.Notification.Notification
86
87**系统接口**:此接口为系统接口。
88
89| 类型                                                             | 说明                              |
90| ---------------------------------------------------------------- | -------------------------------- |
91| [Resource](../apis-arkui/arkui-ts/ts-types.md#resource)          | 表示值类型为图片资源。             |
92| [image.PixelMap](../apis-image-kit/arkts-apis-image-PixelMap.md) | 表示值类型为图片。                 |
93
94## LiveViewTypes<sup>18+</sup>
95
96描述实况通知的类型。
97
98**系统能力**:SystemCapability.Notification.Notification
99
100**系统接口**:此接口为系统接口。
101
102| 名称                         | 值 |   说明   |
103| ---------------------------- |----|----------|
104| LIVE_VIEW_ACTIVITY           | 0  | 实时活动类(进度类)系统实况 |
105| LIVE_VIEW_INSTANT            | 1  | 即时任务类系统实况 |
106| LIVE_VIEW_LONG_TERM          | 2  | 长时任务类系统实况 |
107
108## NotificationMultiLineContent
109
110**系统能力**:SystemCapability.Notification.Notification
111
112| 名称           | 类型    | 只读 | 可选 | 说明                             |
113| -------------- | ------ | ---- | --- | -------------------------------- |
114| lineWantAgents<sup>20+</sup>       | Array<[wantAgent](../apis-ability-kit/js-apis-app-ability-wantAgent.md)> |  否  | 是  | 点击多行文本中某一行文本消息触发的wantAgent。不同行的文本分别对应于不同的wantAgent。该字段配置的行数不能大于[lines](./js-apis-inner-notification-notificationContent.md#notificationmultilinecontent)字段配置的行数。<br>**系统接口**:此接口为系统接口。<br>**需要权限**:ohos.permission.NOTIFICATION_AGENT_CONTROLLER |