1e41f4b71Sopenharmony_ci# NotificationContent
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci描述通知类型。
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **说明:**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## NotificationContent
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci| 名称           | 类型                                                                        | 只读 | 可选 | 说明               |
14e41f4b71Sopenharmony_ci| -----------   | --------------------------------------------------------------------------- | ---- | --- | ------------------ |
15e41f4b71Sopenharmony_ci| contentType<sup>(deprecated)</sup> | [notification.ContentType](./js-apis-notification.md#contenttype)  | 否  | 是  | 通知内容类型。<br>从API version 11开始不再维护,建议使用notificationContentType代替。       |
16e41f4b71Sopenharmony_ci| notificationContentType<sup>11+</sup>    | [notificationManager.ContentType](./js-apis-notificationManager.md#contenttype)                | 否  | 是  | 通知内容类型。       |
17e41f4b71Sopenharmony_ci| normal         | [NotificationBasicContent](#notificationbasiccontent)                      | 否  | 是  | 基本类型通知内容。   |
18e41f4b71Sopenharmony_ci| longText       | [NotificationLongTextContent](#notificationlongtextcontent)                | 否  | 是  | 长文本类型通知内容。 |
19e41f4b71Sopenharmony_ci| multiLine      | [NotificationMultiLineContent](#notificationmultilinecontent)              | 否  | 是  | 多行类型通知内容。   |
20e41f4b71Sopenharmony_ci| picture        | [NotificationPictureContent](#notificationpicturecontent)                  | 否  | 是  | 图片类型通知内容。   |
21e41f4b71Sopenharmony_ci| systemLiveView<sup>11+</sup> | [NotificationSystemLiveViewContent](#notificationsystemliveviewcontent)    | 否  | 是  | 系统实况窗类型通知内容。不支持三方应用直接创建该类型通知,可以由系统代理创建系统实况窗类型通知后,三方应用发布同ID的通知来更新指定内容。|
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## NotificationBasicContent
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci描述普通文本通知。
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci| 名称           | 类型    | 只读 | 可选 | 说明                               |
30e41f4b71Sopenharmony_ci| -------------- | ------ | ---- |-----| ---------------------------------- |
31e41f4b71Sopenharmony_ci| title          | string |  否  |  否  | 通知标题(不可为空字符串,大小不超过200字节,超出部分会被截断)。         |
32e41f4b71Sopenharmony_ci| text           | string |  否  |  否  | 通知内容(不可为空字符串,大小不超过200字节,超出部分会被截断)。         |
33e41f4b71Sopenharmony_ci| additionalText | string |  否  |  是  | 通知附加内容,是对通知内容的补充(大小不超过200字节,超出部分会被截断)。   |
34e41f4b71Sopenharmony_ci| lockscreenPicture<sup>12+</sup> | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) |  否  |  是  | 通知在锁屏界面显示的图片。当前仅支持实况窗类型通知。图标像素的总字节数不超过192KB(图标像素的总字节数通过[getPixelBytesNumber](../apis-image-kit/js-apis-image.md#getpixelbytesnumber7)获取),建议图标像素长宽为128*128。实际显示效果依赖于设备能力和通知中心UI样式。   |
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci## NotificationLongTextContent
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci描述长文本通知。继承自[NotificationBasicContent](#notificationbasiccontent)。
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci> **说明:**
41e41f4b71Sopenharmony_ci>
42e41f4b71Sopenharmony_ci> 实际显示效果依赖于设备能力和通知中心UI样式。
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci| 名称           | 类型    | 只读 | 可选 | 说明                             |
47e41f4b71Sopenharmony_ci| -------------- | ------ | ---- | --- | -------------------------------- |
48e41f4b71Sopenharmony_ci| longText       | string |  否  | 否  | 通知的长文本(不可为空字符串,大小不超过1024字节,超出部分会被截断)。                     |
49e41f4b71Sopenharmony_ci| briefText      | string |  否  | 否  | 通知概要内容,是对通知内容的总结(不可为空字符串,大小不超过200字节,超出部分会被截断)。   |
50e41f4b71Sopenharmony_ci| expandedTitle  | string |  否  | 否  | 通知展开时的标题(不可为空字符串,大小不超过200字节,超出部分会被截断)。                 |
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci## NotificationMultiLineContent
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci描述多行文本通知。继承自[NotificationBasicContent](#notificationbasiccontent)。
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci> **说明:**
58e41f4b71Sopenharmony_ci>
59e41f4b71Sopenharmony_ci> 实际显示效果依赖于设备能力和通知中心UI样式。
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci| 名称           | 类型            | 只读 | 可选 | 说明                             |
64e41f4b71Sopenharmony_ci| -------------- | --------------- | --- | --- | -------------------------------- |
65e41f4b71Sopenharmony_ci| briefText      | string          | 否  | 否  | 通知概要内容,是对通知内容的总结(不可为空字符串,大小不超过200字节,超出部分会被截断)。 |
66e41f4b71Sopenharmony_ci| longTitle      | string          | 否  | 否  | 通知展开时的标题(不可为空字符串,大小不超过200字节,超出部分会被截断)。|
67e41f4b71Sopenharmony_ci| lines          | Array\<string\> | 否  | 否  | 通知的多行文本(大小不超过200字节,超出部分会被截断)。                  |
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci## NotificationPictureContent
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ci描述附有图片的通知。继承自[NotificationBasicContent](#notificationbasiccontent)。
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci> **说明:**
75e41f4b71Sopenharmony_ci>
76e41f4b71Sopenharmony_ci> 实际显示效果依赖于设备能力和通知中心UI样式。
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci| 名称           | 类型                                          | 只读 | 可选 | 说明                               |
81e41f4b71Sopenharmony_ci| -------------- | -------------------------------------------- | ---- | --- |------------------------------------|
82e41f4b71Sopenharmony_ci| briefText      | string                                       |  否  | 否  | 通知概要内容,是对通知内容的总结(不可为空字符串,大小不超过200字节,超出部分会被截断)。 |
83e41f4b71Sopenharmony_ci| expandedTitle  | string                                       |  否  | 否  | 通知展开时的标题(不可为空字符串,大小不超过200字节,超出部分会被截断)。    |
84e41f4b71Sopenharmony_ci| picture        | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) |  否  | 否  | 通知的图片内容(图像像素的总字节数不能超过2MB)。|
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci## NotificationSystemLiveViewContent
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci描述系统实况窗通知内容。不支持三方应用直接创建该类型通知,可以由系统代理创建系统实况窗类型通知后,三方应用发布同ID的通知来更新指定内容。继承自[NotificationBasicContent](#notificationbasiccontent)。
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci| 名称                         | 类型                                             | 只读| 可选 | 说明                               |
94e41f4b71Sopenharmony_ci| ---------------------------- | ----------------------------------------------- | --- | --- | -----------------------------------|
95e41f4b71Sopenharmony_ci| typeCode<sup>11+</sup>       | number                                          | 否  | 否  | 类型标识符,标记调用方业务类型。       |
96e41f4b71Sopenharmony_ci| capsule<sup>11+</sup>        | [NotificationCapsule](#notificationcapsule11)   | 否  | 是  | 实况通知的胶囊。                     |
97e41f4b71Sopenharmony_ci| button<sup>11+</sup>         | [NotificationButton](#notificationbutton11)     | 否  | 是  | 实况通知的按钮。                     |
98e41f4b71Sopenharmony_ci| time<sup>11+</sup>           | [NotificationTime](#notificationtime11)         | 否  | 是  | 实况通知的时间。                     |
99e41f4b71Sopenharmony_ci| progress<sup>11+</sup>       | [NotificationProgress](#notificationprogress11) | 否  | 是  | 实况内容的进度。                     |
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci
102e41f4b71Sopenharmony_ci## NotificationCapsule<sup>11+</sup>
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci描述通知胶囊。
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ci| 名称            | 类型                                          | 只读 | 可选 | 说明                            |
109e41f4b71Sopenharmony_ci| --------------- | -------------------------------------------- | --- | --- | -------------------------------- |
110e41f4b71Sopenharmony_ci| title           | string                                       | 否  | 是  | 胶囊标题。                        |
111e41f4b71Sopenharmony_ci| icon            | [image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | 否  | 是  | 胶囊图片。                        |
112e41f4b71Sopenharmony_ci| backgroundColor | string                                       | 否  | 是  | 背景颜色。                        |
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci## NotificationButton<sup>11+</sup>
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci描述通知按钮。
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci| 名称  | 类型                                                   | 只读 | 可选 | 说明             |
122e41f4b71Sopenharmony_ci| ----- | ----------------------------------------------------- | --- | --- | ----------------- |
123e41f4b71Sopenharmony_ci| names | Array\<string\>                                       | 否  |  是 | 按钮名称(最多支持3个)。   |
124e41f4b71Sopenharmony_ci| icons | Array\<[image.PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7)\> | 否  |  是 | 按钮图片(最多支持3个)。   |
125e41f4b71Sopenharmony_ci| iconsResource<sup>12+</sup> | Array\<[Resource](../apis-arkui/arkui-ts/ts-types.md#resource)\> | 否  |  是 | 按钮资源(最多支持3个)。   |
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci## NotificationTime<sup>11+</sup>
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci描述通知计时信息。
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci| 名称           | 类型              | 只读 | 可选 | 说明                             |
134e41f4b71Sopenharmony_ci| -------------- | ---------------- | --- | --- | -------------------------------- |
135e41f4b71Sopenharmony_ci| initialTime    | number           | 否  | 是  | 计时起始时间。单位:ms。                |
136e41f4b71Sopenharmony_ci| isCountDown    | boolean          | 否  | 是  | 是否倒计时。                     |
137e41f4b71Sopenharmony_ci| isPaused       | boolean          | 否  | 是  | 是否暂停。                       |
138e41f4b71Sopenharmony_ci| isInTitle      | boolean          | 否  | 是  | 时间是否展示在title中。           |
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci**示例:**
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci```ts
143e41f4b71Sopenharmony_ci// 该通知从3秒开始倒计时,并且时间展示在title中。
144e41f4b71Sopenharmony_citime: {
145e41f4b71Sopenharmony_ci    initialTime: 3000,
146e41f4b71Sopenharmony_ci    isCountDown: true,
147e41f4b71Sopenharmony_ci    isPaused: false,
148e41f4b71Sopenharmony_ci    isInTitle: true,
149e41f4b71Sopenharmony_ci}
150e41f4b71Sopenharmony_ci```
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci## NotificationProgress<sup>11+</sup>
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ci描述通知进度。
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci| 名称           | 类型            | 只读 | 可选 | 说明                             |
160e41f4b71Sopenharmony_ci| -------------- | --------------- | --- | --- | -------------------------------- |
161e41f4b71Sopenharmony_ci| maxValue        | number         | 否  | 是  | 进度最大值。                       |
162e41f4b71Sopenharmony_ci| currentValue    | number         | 否  | 是  | 进度当前值。                       |
163e41f4b71Sopenharmony_ci| isPercentage    | boolean        | 否  | 是  | 是否按百分比展示。                   |
164