• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.notificationManager (NotificationManager模块)
2
3本模块提供通知管理的能力,包括发布、取消发布通知,创建、获取、移除通知渠道,获取通知的使能状态、角标使能状态,获取通知的相关信息等。
4
5> **说明:**
6>
7> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8
9## 导入模块
10
11```ts
12import { notificationManager } from '@kit.NotificationKit';
13```
14
15## notificationManager.publish
16
17publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
18
19发布通知。使用callback异步回调。
20
21如果新发布通知与已发布通知的ID相同,且label相同,则新通知将取代原有通知。
22
23**系统能力**:SystemCapability.Notification.Notification
24
25**参数:**
26
27| 参数名     | 类型                                        | 必填 | 说明                                        |
28| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
29| request  | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是   | 用于设置要发布通知的内容和相关配置信息。 |
30| callback | AsyncCallback\<void\>                       | 是   | 发布通知的回调方法。                        |
31
32**错误码:**
33
34以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
35
36| 错误码ID | 错误信息                                              |
37| -------- | ---------------------------------------------------- |
38| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.    |
39| 1600001  | Internal error.                                      |
40| 1600002  | Marshalling or unmarshalling error.                  |
41| 1600003  | Failed to connect to the service.                    |
42| 1600004  | Notification disabled.                               |
43| 1600005  | Notification slot disabled.                          |
44| 1600007  | The notification does not exist.                     |
45| 1600009  | The notification sending frequency reaches the upper limit.            |
46| 1600012  | No memory space.                                     |
47| 1600014  | No permission.                                       |
48| 1600015  | The current notification status does not support duplicate configurations. |
49| 1600016  | The notification version for this update is too low. |
50| 1600020  | The application is not allowed to publish notifications due to permission control settings. |
51| 2300007  | Network unreachable.                                 |
52
53**示例:**
54
55```ts
56import { BusinessError } from '@kit.BasicServicesKit';
57
58// publish回调
59let publishCallback = (err: BusinessError): void => {
60  if (err) {
61    console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
62  } else {
63    console.info(`Succeeded in publishing notification.`);
64  }
65}
66// 通知Request对象
67let notificationRequest: notificationManager.NotificationRequest = {
68  id: 1,
69  content: {
70    notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
71    normal: {
72      title: "test_title",
73      text: "test_text",
74      additionalText: "test_additionalText"
75    }
76  }
77};
78notificationManager.publish(notificationRequest, publishCallback);
79```
80
81## notificationManager.publish
82
83publish(request: NotificationRequest): Promise\<void\>
84
85发布通知。使用Promise异步回调。
86
87如果新发布通知与已发布通知的ID相同,且label相同,则新通知将取代原有通知。
88
89**系统能力**:SystemCapability.Notification.Notification
90
91**参数:**
92
93| 参数名     | 类型                                        | 必填 | 说明                                        |
94| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
95| request  | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是   | 用于设置要发布通知的内容和相关配置信息。 |
96
97**返回值:**
98
99| 类型     | 说明 |
100| ------- |--|
101| Promise\<void\> | 无返回结果的Promise对象。 |
102
103**错误码:**
104
105以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
106
107| 错误码ID | 错误信息                                              |
108| -------- | ---------------------------------------------------- |
109| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.    |
110| 1600001  | Internal error.                                      |
111| 1600002  | Marshalling or unmarshalling error.                  |
112| 1600003  | Failed to connect to the service.                    |
113| 1600004  | Notification disabled.                               |
114| 1600005  | Notification slot disabled.                          |
115| 1600007  | The notification does not exist.                     |
116| 1600009  | The notification sending frequency reaches the upper limit.            |
117| 1600012  | No memory space.                                     |
118| 1600014  | No permission.                                       |
119| 1600015  | The current notification status does not support duplicate configurations. |
120| 1600016  | The notification version for this update is too low. |
121| 1600020  | The application is not allowed to publish notifications due to permission control settings. |
122| 2300007  | Network unreachable.                                 |
123
124**示例:**
125
126```ts
127import { BusinessError } from '@kit.BasicServicesKit';
128
129// 通知Request对象
130let notificationRequest: notificationManager.NotificationRequest = {
131  id: 1,
132  content: {
133    notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
134    normal: {
135      title: "test_title",
136      text: "test_text",
137      additionalText: "test_additionalText"
138    }
139  }
140};
141notificationManager.publish(notificationRequest).then(() => {
142  console.info(`Succeeded in publishing notification.`);
143}).catch((err: BusinessError) => {
144  console.error(`Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
145});
146
147```
148
149## notificationManager.cancel
150
151cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
152
153通过通知ID和通知标签取消已发布的通知。使用callback异步回调。
154
155**系统能力**:SystemCapability.Notification.Notification
156
157**参数:**
158
159| 参数名     | 类型                  | 必填 | 说明                 |
160| -------- | --------------------- | ---- | -------------------- |
161| id       | number                | 是   | 通知ID。               |
162| label    | string                | 是   | 通知标签。             |
163| callback | AsyncCallback\<void\> | 是   | 表示被指定通知的回调方法。 |
164
165**错误码:**
166
167以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
168
169| 错误码ID | 错误信息                            |
170| -------- | ----------------------------------- |
171| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
172| 1600001  | Internal error.                     |
173| 1600002  | Marshalling or unmarshalling error. |
174| 1600003  | Failed to connect to the service.          |
175| 1600007  | The notification does not exist.      |
176
177**示例:**
178
179```ts
180import { BusinessError } from '@kit.BasicServicesKit';
181
182// cancel回调
183let cancelCallback = (err: BusinessError): void => {
184  if (err) {
185    console.error(`Failed to cancel notification. Code is ${err.code}, message is ${err.message}`);
186  } else {
187    console.info(`Succeeded in canceling notification.`);
188  }
189}
190notificationManager.cancel(0, "label", cancelCallback);
191```
192
193## notificationManager.cancel
194
195cancel(id: number, label?: string): Promise\<void\>
196
197通过通知ID和通知标签取消已发布的通知,若label为空表示取消与指定通知ID相匹配的已发布通知。使用Promise异步回调。
198
199**系统能力**:SystemCapability.Notification.Notification
200
201**参数:**
202
203| 参数名  | 类型   | 必填 | 说明     |
204| ----- | ------ | ---- | -------- |
205| id    | number | 是   | 通知ID。   |
206| label | string | 否   | 通知标签,默认为空。 |
207
208**返回值:**
209
210| 类型     | 说明        |
211| ------- |-----------|
212| Promise\<void\> | 无返回结果的Promise对象。 |
213
214**错误码:**
215
216以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
217
218| 错误码ID | 错误信息                            |
219| -------- | ----------------------------------- |
220| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
221| 1600001  | Internal error.                     |
222| 1600002  | Marshalling or unmarshalling error. |
223| 1600003  | Failed to connect to the service.          |
224| 1600007  | The notification does not exist.      |
225
226**示例:**
227
228```ts
229import { BusinessError } from '@kit.BasicServicesKit';
230
231notificationManager.cancel(0).then(() => {
232  console.info(`Succeeded in canceling notification.`);
233}).catch((err: BusinessError) => {
234  console.error(`Failed to cancel notification. Code is ${err.code}, message is ${err.message}`);
235});
236```
237
238## notificationManager.cancel
239
240cancel(id: number, callback: AsyncCallback\<void\>): void
241
242取消与指定通知ID相匹配的已发布通知。使用callback异步回调。
243
244**系统能力**:SystemCapability.Notification.Notification
245
246**参数:**
247
248| 参数名     | 类型                  | 必填 | 说明                 |
249| -------- | --------------------- | ---- | -------------------- |
250| id       | number                | 是   | 通知ID。               |
251| callback | AsyncCallback\<void\> | 是   | 表示被指定通知的回调方法。 |
252
253**错误码:**
254
255以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
256
257| 错误码ID | 错误信息                            |
258| -------- | ----------------------------------- |
259| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
260| 1600001  | Internal error.                     |
261| 1600002  | Marshalling or unmarshalling error. |
262| 1600003  | Failed to connect to the service.          |
263| 1600007  | The notification does not exist.      |
264
265**示例:**
266
267```ts
268import { BusinessError } from '@kit.BasicServicesKit';
269
270// cancel回调
271let cancelCallback = (err: BusinessError): void => {
272  if (err) {
273    console.error(`Failed to cancel notification. Code is ${err.code}, message is ${err.message}`);
274  } else {
275    console.info(`Succeeded in canceling notification.`);
276  }
277}
278notificationManager.cancel(0, cancelCallback);
279```
280
281## notificationManager.cancelAll
282
283cancelAll(callback: AsyncCallback\<void\>): void
284
285取消当前应用所有已发布的通知。使用callback异步回调。
286
287**系统能力**:SystemCapability.Notification.Notification
288
289**参数:**
290
291| 参数名     | 类型                  | 必填 | 说明                 |
292| -------- | --------------------- | ---- | -------------------- |
293| callback | AsyncCallback\<void\> | 是   | 表示被指定通知的回调方法。 |
294
295**错误码:**
296
297以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
298
299| 错误码ID | 错误信息                            |
300| -------- | ----------------------------------- |
301| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
302| 1600001  | Internal error.                     |
303| 1600002  | Marshalling or unmarshalling error. |
304| 1600003  | Failed to connect to the service.          |
305
306**示例:**
307
308```ts
309import { BusinessError } from '@kit.BasicServicesKit';
310
311// cancel回调
312let cancelAllCallback = (err: BusinessError): void => {
313  if (err) {
314    console.error(`Failed to cancel all notification. Code is ${err.code}, message is ${err.message}`);
315  } else {
316    console.info(`Succeeded in canceling all notification.`);
317  }
318}
319notificationManager.cancelAll(cancelAllCallback);
320```
321
322## notificationManager.cancelAll
323
324cancelAll(): Promise\<void\>
325
326取消当前应用所有已发布的通知。使用Promise异步回调。
327
328**系统能力**:SystemCapability.Notification.Notification
329
330**返回值:**
331
332| 类型     | 说明        |
333| ------- |-----------|
334| Promise\<void\> | 无返回结果的Promise对象。 |
335
336**错误码:**
337
338以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
339
340| 错误码ID | 错误信息                            |
341| -------- | ----------------------------------- |
342| 1600001  | Internal error.                     |
343| 1600002  | Marshalling or unmarshalling error. |
344| 1600003  | Failed to connect to the service.          |
345
346**示例:**
347
348```ts
349import { BusinessError } from '@kit.BasicServicesKit';
350
351notificationManager.cancelAll().then(() => {
352  console.info(`Succeeded in canceling all notification.`);
353}).catch((err: BusinessError) => {
354  console.error(`Failed to cancel all notification. Code is ${err.code}, message is ${err.message}`);
355});
356```
357
358## notificationManager.addSlot
359
360addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
361
362创建指定类型的通知渠道。使用callback异步回调。
363
364**系统能力**:SystemCapability.Notification.Notification
365
366**参数:**
367
368| 参数名     | 类型                  | 必填 | 说明                   |
369| -------- | --------------------- | ---- | ---------------------- |
370| type     | [SlotType](#slottype)              | 是   | 要创建的通知渠道的类型。 |
371| callback | AsyncCallback\<void\> | 是   | 表示被指定通道的回调方法。   |
372
373**错误码:**
374
375以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
376
377| 错误码ID | 错误信息                            |
378| -------- | ----------------------------------- |
379| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
380| 1600001  | Internal error.                     |
381| 1600002  | Marshalling or unmarshalling error. |
382| 1600003  | Failed to connect to the service.          |
383| 1600012  | No memory space.                    |
384
385**示例:**
386
387```ts
388import { BusinessError } from '@kit.BasicServicesKit';
389
390// addslot回调
391let addSlotCallBack = (err: BusinessError): void => {
392  if (err) {
393    console.error(`Failed to add slot. Code is ${err.code}, message is ${err.message}`);
394  } else {
395    console.info(`Succeeded in adding slot.`);
396  }
397}
398notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);
399```
400
401## notificationManager.addSlot
402
403addSlot(type: SlotType): Promise\<void\>
404
405创建指定类型的通知渠道。使用Promise异步回调。
406
407**系统能力**:SystemCapability.Notification.Notification
408
409**参数:**
410
411| 参数名 | 类型     | 必填 | 说明                   |
412| ---- | -------- | ---- | ---------------------- |
413| type | [SlotType](#slottype) | 是   | 要创建的通知渠道的类型。 |
414
415**返回值:**
416
417| 类型     | 说明        |
418| ------- |-----------|
419| Promise\<void\> | 无返回结果的Promise对象。 |
420
421**错误码:**
422
423以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
424
425| 错误码ID | 错误信息                            |
426| -------- | ----------------------------------- |
427| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
428| 1600001  | Internal error.                     |
429| 1600002  | Marshalling or unmarshalling error. |
430| 1600003  | Failed to connect to the service.          |
431| 1600012  | No memory space.                    |
432
433**示例:**
434
435```ts
436import { BusinessError } from '@kit.BasicServicesKit';
437
438notificationManager.addSlot(notificationManager.SlotType.SOCIAL_COMMUNICATION).then(() => {
439  console.info(`Succeeded in adding slot.`);
440}).catch((err: BusinessError) => {
441  console.error(`Failed to add slot. Code is ${err.code}, message is ${err.message}`);
442});
443```
444
445## notificationManager.getSlot
446
447getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
448
449获取一个指定类型的通知渠道。使用callback异步回调。
450
451**系统能力**:SystemCapability.Notification.Notification
452
453**参数:**
454
455| 参数名     | 类型                              | 必填 | 说明                                                        |
456| -------- | --------------------------------- | ---- | ----------------------------------------------------------- |
457| slotType | [SlotType](#slottype)                          | 是   | 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 |
458| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是   | 表示被指定通道的回调方法。                                        |
459
460**错误码:**
461
462以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
463
464| 错误码ID | 错误信息                            |
465| -------- | ----------------------------------- |
466| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
467| 1600001  | Internal error.                     |
468| 1600002  | Marshalling or unmarshalling error. |
469| 1600003  | Failed to connect to the service.          |
470
471**示例:**
472
473```ts
474import { BusinessError } from '@kit.BasicServicesKit';
475
476// getSlot回调
477let getSlotCallback = (err: BusinessError, data: notificationManager.NotificationSlot): void => {
478  if (err) {
479    console.error(`Failed to get slot. Code is ${err.code}, message is ${err.message}`);
480  } else {
481    console.info(`Succeeded in getting slot, data is ` + JSON.stringify(data));
482  }
483}
484let slotType: notificationManager.SlotType = notificationManager.SlotType.SOCIAL_COMMUNICATION;
485notificationManager.getSlot(slotType, getSlotCallback);
486```
487
488## notificationManager.getSlot
489
490getSlot(slotType: SlotType): Promise\<NotificationSlot\>
491
492获取一个指定类型的通知渠道。使用Promise异步回调。
493
494**系统能力**:SystemCapability.Notification.Notification
495
496**参数:**
497
498| 参数名     | 类型     | 必填 | 说明                                                        |
499| -------- | -------- | ---- | ----------------------------------------------------------- |
500| slotType | [SlotType](#slottype) | 是   | 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 |
501
502**返回值:**
503
504| 类型                                                        | 说明                                                         |
505| ----------------------------------------------------------- | ------------------------------------------------------------ |
506| Promise\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 以Promise形式返回获取一个通知渠道。 |
507
508**错误码:**
509
510以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
511
512| 错误码ID | 错误信息                            |
513| -------- | ----------------------------------- |
514| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
515| 1600001  | Internal error.                     |
516| 1600002  | Marshalling or unmarshalling error. |
517| 1600003  | Failed to connect to the service.          |
518
519**示例:**
520
521```ts
522import { BusinessError } from '@kit.BasicServicesKit';
523
524let slotType: notificationManager.SlotType = notificationManager.SlotType.SOCIAL_COMMUNICATION;
525notificationManager.getSlot(slotType).then((data: notificationManager.NotificationSlot) => {
526  console.info(`Succeeded in getting slot, data is ` + JSON.stringify(data));
527}).catch((err: BusinessError) => {
528  console.error(`Failed to get slot. Code is ${err.code}, message is ${err.message}`);
529});
530```
531
532## notificationManager.getSlots
533
534getSlots(callback: AsyncCallback\<Array\<NotificationSlot>>): void
535
536获取此应用程序的所有通知渠道。使用callback异步回调。
537
538**系统能力**:SystemCapability.Notification.Notification
539
540**参数:**
541
542| 参数名     | 类型                              | 必填 | 说明                 |
543| -------- | --------------------------------- | ---- | -------------------- |
544| callback | AsyncCallback\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\>\> | 是   | 以callback形式返回获取此应用程序的所有通知渠道的结果。 |
545
546**错误码:**
547
548以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
549
550
551| 错误码ID | 错误信息                            |
552| -------- | ----------------------------------- |
553| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
554| 1600001  | Internal error.                     |
555| 1600002  | Marshalling or unmarshalling error. |
556| 1600003  | Failed to connect to the service.          |
557
558**示例:**
559
560```ts
561import { BusinessError } from '@kit.BasicServicesKit';
562
563// getSlots回调
564let getSlotsCallback = (err: BusinessError, data: Array<notificationManager.NotificationSlot>): void => {
565  if (err) {
566    console.error(`Failed to get slots. Code is ${err.code}, message is ${err.message}`);
567  } else {
568    console.info(`Succeeded in getting slots, data is ` + JSON.stringify(data));
569  }
570}
571notificationManager.getSlots(getSlotsCallback);
572```
573
574## notificationManager.getSlots
575
576getSlots(): Promise\<Array\<NotificationSlot>>
577
578获取此应用程序的所有通知渠道。使用Promise异步回调。
579
580**系统能力**:SystemCapability.Notification.Notification
581
582**返回值:**
583
584| 类型                                                        | 说明                                                         |
585| ----------------------------------------------------------- | ------------------------------------------------------------ |
586| Promise\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\>\> | 以Promise形式返回获取此应用程序的所有通知渠道的结果。 |
587
588**错误码:**
589
590以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
591
592| 错误码ID | 错误信息                            |
593| -------- | ----------------------------------- |
594| 1600001  | Internal error.                     |
595| 1600002  | Marshalling or unmarshalling error. |
596| 1600003  | Failed to connect to the service.          |
597
598**示例:**
599
600```ts
601import { BusinessError } from '@kit.BasicServicesKit';
602
603notificationManager.getSlots().then((data: Array<notificationManager.NotificationSlot>) => {
604  console.info(`Succeeded in getting slots, data is ` + JSON.stringify(data));
605}).catch((err: BusinessError) => {
606  console.error(`Failed to get slots. Code is ${err.code}, message is ${err.message}`);
607});
608```
609
610## notificationManager.removeSlot
611
612removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
613
614删除此应用程序指定类型的通知渠道。使用callback异步回调。
615
616**系统能力**:SystemCapability.Notification.Notification
617
618**参数:**
619
620| 参数名     | 类型                  | 必填 | 说明                                                        |
621| -------- | --------------------- | ---- | ----------------------------------------------------------- |
622| slotType | [SlotType](#slottype)              | 是   | 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 |
623| callback | AsyncCallback\<void\> | 是   | 表示被指定通道的回调方法。                                        |
624
625**错误码:**
626
627以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
628
629| 错误码ID | 错误信息                            |
630| -------- | ----------------------------------- |
631| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
632| 1600001  | Internal error.                     |
633| 1600002  | Marshalling or unmarshalling error. |
634| 1600003  | Failed to connect to the service.          |
635
636**示例:**
637
638```ts
639import { BusinessError } from '@kit.BasicServicesKit';
640
641// removeSlot回调
642let removeSlotCallback = (err: BusinessError): void => {
643  if (err) {
644    console.error(`Failed to remove slot. Code is ${err.code}, message is ${err.message}`);
645  } else {
646    console.info(`Succeeded in removing slot.`);
647  }
648}
649let slotType = notificationManager.SlotType.SOCIAL_COMMUNICATION;
650notificationManager.removeSlot(slotType, removeSlotCallback);
651```
652
653## notificationManager.removeSlot
654
655removeSlot(slotType: SlotType): Promise\<void\>
656
657删除此应用程序指定类型的通知渠道。使用Promise异步回调。
658
659**系统能力**:SystemCapability.Notification.Notification
660
661**参数:**
662
663| 参数名     | 类型     | 必填 | 说明                                                        |
664| -------- | -------- | ---- | ----------------------------------------------------------- |
665| slotType | [SlotType](#slottype) | 是   | 通知渠道类型,例如社交通信、服务提醒、内容咨询等类型。 |
666
667**返回值:**
668
669| 类型      | 说明        |
670|---------|-----------|
671| Promise\<void\> | 无返回结果的Promise对象。 |
672
673**错误码:**
674
675以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
676
677| 错误码ID | 错误信息                            |
678| -------- | ----------------------------------- |
679| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
680| 1600001  | Internal error.                     |
681| 1600002  | Marshalling or unmarshalling error. |
682| 1600003  | Failed to connect to the service.          |
683
684**示例:**
685
686```ts
687import { BusinessError } from '@kit.BasicServicesKit';
688
689let slotType: notificationManager.SlotType = notificationManager.SlotType.SOCIAL_COMMUNICATION;
690notificationManager.removeSlot(slotType).then(() => {
691  console.info(`Succeeded in removing slot.`);
692}).catch((err: BusinessError) => {
693  console.error(`Failed to remove slot. Code is ${err.code}, message is ${err.message}`);
694});
695```
696
697## notificationManager.removeAllSlots
698
699removeAllSlots(callback: AsyncCallback\<void\>): void
700
701删除此应用程序所有通知渠道。使用callback异步回调。
702
703**系统能力**:SystemCapability.Notification.Notification
704
705**参数:**
706
707| 参数名     | 类型                  | 必填 | 说明                 |
708| -------- | --------------------- | ---- | -------------------- |
709| callback | AsyncCallback\<void\> | 是   | 表示被指定通道的回调方法。 |
710
711**错误码:**
712
713以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
714
715| 错误码ID | 错误信息                            |
716| -------- | ----------------------------------- |
717| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
718| 1600001  | Internal error.                     |
719| 1600002  | Marshalling or unmarshalling error. |
720| 1600003  | Failed to connect to the service.          |
721
722**示例:**
723
724```ts
725import { BusinessError } from '@kit.BasicServicesKit';
726
727let removeAllSlotsCallback = (err: BusinessError): void => {
728  if (err) {
729    console.error(`Failed to remove all slots. Code is ${err.code}, message is ${err.message}`);
730  } else {
731    console.info(`Succeeded in removing all slots.`);
732  }
733}
734notificationManager.removeAllSlots(removeAllSlotsCallback);
735```
736
737## notificationManager.removeAllSlots
738
739removeAllSlots(): Promise\<void\>
740
741删除此应用程序所有通知渠道。使用Promise异步回调。
742
743**系统能力**:SystemCapability.Notification.Notification
744
745**返回值:**
746
747| 类型      | 说明        |
748|---------|-----------|
749| Promise\<void\> | 无返回结果的Promise对象。 |
750
751**错误码:**
752
753以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
754
755| 错误码ID | 错误信息                            |
756| -------- | ----------------------------------- |
757| 1600001  | Internal error.                     |
758| 1600002  | Marshalling or unmarshalling error. |
759| 1600003  | Failed to connect to the service.          |
760
761**示例:**
762
763```ts
764import { BusinessError } from '@kit.BasicServicesKit';
765
766notificationManager.removeAllSlots().then(() => {
767  console.info(`Succeeded in removing all slots.`);
768}).catch((err: BusinessError) => {
769  console.error(`Failed to remove all slots. Code is ${err.code}, message is ${err.message}`);
770});
771```
772
773## notificationManager.isNotificationEnabled<sup>11+</sup>
774
775isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
776
777获取通知使能状态。使用callback异步回调。
778
779**系统能力**:SystemCapability.Notification.Notification
780
781**参数:**
782
783| 参数名     | 类型                  | 必填 | 说明                     |
784| -------- | --------------------- | ---- | ------------------------ |
785| callback | AsyncCallback\<boolean\> | 是   | 获取通知使能状态回调函数(true:使能,false:禁止)。 |
786
787**错误码:**
788
789以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
790
791| 错误码ID | 错误信息                                  |
792| -------- | ---------------------------------------- |
793| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
794| 1600001  | Internal error.                          |
795| 1600002  | Marshalling or unmarshalling error.      |
796| 1600003  | Failed to connect to the service.               |
797| 1600008  | The user does not exist.                   |
798| 17700001 | The specified bundle name was not found. |
799
800**示例:**
801
802```ts
803import { BusinessError } from '@kit.BasicServicesKit';
804
805let isNotificationEnabledCallback = (err: BusinessError, data: boolean): void => {
806  if (err) {
807    console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
808  } else {
809    console.info(`isNotificationEnabled success, data is ${JSON.stringify(data)}`);
810  }
811}
812
813notificationManager.isNotificationEnabled(isNotificationEnabledCallback);
814```
815
816## notificationManager.isNotificationEnabled<sup>11+</sup>
817
818isNotificationEnabled(): Promise\<boolean\>
819
820获取通知使能状态。使用Promise异步回调。
821
822**系统能力**:SystemCapability.Notification.Notification
823
824**返回值:**
825
826| 类型                                                        | 说明                                                         |
827| ----------------------------------------------------------- | ------------------------------------------------------------ |
828| Promise\<boolean\> | 以Promise形式返回获取通知使能状态的结果(true:使能,false:禁止)。 |
829
830**错误码:**
831
832以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
833
834| 错误码ID | 错误信息                                 |
835| -------- | ---------------------------------------- |
836| 1600001  | Internal error.                          |
837| 1600002  | Marshalling or unmarshalling error.      |
838| 1600003  | Failed to connect to the service.               |
839| 1600008  | The user does not exist.                   |
840| 17700001 | The specified bundle name was not found. |
841
842**示例:**
843
844```ts
845import { BusinessError } from '@kit.BasicServicesKit';
846
847notificationManager.isNotificationEnabled().then((data: boolean) => {
848  console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
849}).catch((err: BusinessError) => {
850  console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
851});
852```
853
854## notificationManager.isNotificationEnabledSync<sup>12+</sup>
855
856isNotificationEnabledSync(): boolean
857
858同步获取通知使能状态。
859
860**系统能力**:SystemCapability.Notification.Notification
861
862**返回值:**
863
864| 类型                                                        | 说明                                                     |
865| ----------------------------------------------------------- |--------------------------------------------------------- |
866| boolean | 返回获取通知使能状态的结果。返回true,表示通知使能状态为开;返回false,表示通知使能状态为关。 |
867
868**错误码:**
869
870以下错误码的详细介绍请参见[通知错误码](./errorcode-notification.md)。
871
872| 错误码ID | 错误信息                                 |
873| -------- | ---------------------------------------- |
874| 1600001  | Internal error.                          |
875| 1600002  | Marshalling or unmarshalling error.      |
876| 1600003  | Failed to connect to the service.               |
877
878**示例:**
879
880```ts
881let enabled = notificationManager.isNotificationEnabledSync();
882console.info(`isNotificationEnabledSync success, data is : ${JSON.stringify(enabled)}`);
883```
884
885## notificationManager.setBadgeNumber<sup>10+</sup>
886
887setBadgeNumber(badgeNumber: number): Promise\<void\>
888
889设定角标个数,在应用的桌面图标上呈现。使用Promise异步回调。
890
891当角标设定个数取值小于或等于0时,表示清除角标。取值大于99时,通知角标将显示99+。
892
893该接口不支持tv和wearable设备。
894
895**系统能力**:SystemCapability.Notification.Notification
896
897**参数:**
898
899| 参数名      | 类型   | 必填 | 说明       |
900| ----------- | ------ | ---- | ---------- |
901| badgeNumber | number | 是   | 角标个数。 |
902
903**返回值:**
904
905| 类型      | 说明        |
906|---------|-----------|
907| Promise\<void\> | 无返回结果的Promise对象。 |
908
909**错误码:**
910
911以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
912
913| 错误码ID | 错误信息                            |
914| -------- | ----------------------------------- |
915| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
916| 801 | Capability not supported. |
917| 1600001  | Internal error.                     |
918| 1600002  | Marshalling or unmarshalling error. |
919| 1600003  | Failed to connect to the service.          |
920| 1600012  | No memory space.                          |
921
922**示例:**
923
924```ts
925import { BusinessError } from '@kit.BasicServicesKit';
926
927let badgeNumber: number = 10;
928notificationManager.setBadgeNumber(badgeNumber).then(() => {
929  console.info(`Succeeded in setting badge number.`);
930}).catch((err: BusinessError) => {
931  console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`);
932});
933```
934
935## notificationManager.setBadgeNumber<sup>10+</sup>
936
937setBadgeNumber(badgeNumber: number, callback: AsyncCallback\<void\>): void
938
939设定角标个数,在应用的桌面图标上呈现。使用callback异步回调。
940
941当角标设定个数取值小于或等于0时,表示清除角标。取值大于99时,通知角标将显示99+。
942
943该接口不支持tv和wearable设备。
944
945**系统能力**:SystemCapability.Notification.Notification
946
947**参数:**
948
949| 参数名      | 类型                  | 必填 | 说明               |
950| ----------- | --------------------- | ---- | ------------------ |
951| badgeNumber | number                | 是   | 角标个数。         |
952| callback    | AsyncCallback\<void\> | 是   | 设定角标回调函数。 |
953
954**错误码:**
955
956以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
957
958| 错误码ID | 错误信息                            |
959| -------- | ----------------------------------- |
960| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
961| 801 | Capability not supported. |
962| 1600001  | Internal error.                     |
963| 1600002  | Marshalling or unmarshalling error. |
964| 1600003  | Failed to connect to the service.          |
965| 1600012  | No memory space.                          |
966
967**示例:**
968
969```ts
970import { BusinessError } from '@kit.BasicServicesKit';
971
972let setBadgeNumberCallback = (err: BusinessError): void => {
973  if (err) {
974    console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`);
975  } else {
976    console.info(`Succeeded in setting badge number.`);
977  }
978}
979let badgeNumber: number = 10;
980notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback);
981```
982
983## notificationManager.getActiveNotificationCount
984
985getActiveNotificationCount(callback: AsyncCallback\<number\>): void
986
987获取当前应用未删除的通知数。使用callback异步回调。
988
989**系统能力**:SystemCapability.Notification.Notification
990
991**参数:**
992
993| 参数名     | 类型                   | 必填 | 说明                   |
994| -------- | ---------------------- | ---- | ---------------------- |
995| callback | AsyncCallback\<number\> | 是   | 获取未删除通知数回调函数。 |
996
997**错误码:**
998
999以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1000
1001| 错误码ID | 错误信息                            |
1002| -------- | ----------------------------------- |
1003| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1004| 1600001  | Internal error.                     |
1005| 1600002  | Marshalling or unmarshalling error. |
1006| 1600003  | Failed to connect to the service.          |
1007
1008**示例:**
1009
1010```ts
1011import { BusinessError } from '@kit.BasicServicesKit';
1012
1013let getActiveNotificationCountCallback = (err: BusinessError, data: number): void => {
1014  if (err) {
1015    console.error(`Failed to get active notification count. Code is ${err.code}, message is ${err.message}`);
1016  } else {
1017    console.info(`Succeeded in getting active notification count, data is ` + JSON.stringify(data));
1018  }
1019}
1020
1021notificationManager.getActiveNotificationCount(getActiveNotificationCountCallback);
1022```
1023
1024## notificationManager.getActiveNotificationCount
1025
1026getActiveNotificationCount(): Promise\<number\>
1027
1028获取当前应用未删除的通知数。使用Promise异步回调。
1029
1030**系统能力**:SystemCapability.Notification.Notification
1031
1032**返回值:**
1033
1034| 类型              | 说明                                        |
1035| ----------------- | ------------------------------------------- |
1036| Promise\<number\> | 以Promise形式返回获取当前应用未删除通知数。 |
1037
1038**错误码:**
1039
1040以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1041
1042| 错误码ID | 错误信息                            |
1043| -------- | ----------------------------------- |
1044| 1600001  | Internal error.                     |
1045| 1600002  | Marshalling or unmarshalling error. |
1046| 1600003  | Failed to connect to the service.          |
1047
1048**示例:**
1049
1050```ts
1051import { BusinessError } from '@kit.BasicServicesKit';
1052
1053notificationManager.getActiveNotificationCount().then((data: number) => {
1054  console.info(`Succeeded in getting active notification count, data is ` + JSON.stringify(data));
1055}).catch((err: BusinessError) => {
1056  console.error(`Failed to get active notification count. Code is ${err.code}, message is ${err.message}`);
1057});
1058```
1059
1060## notificationManager.getActiveNotifications
1061
1062getActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void
1063
1064获取当前应用未删除的通知列表。使用callback异步回调。
1065
1066**系统能力**:SystemCapability.Notification.Notification
1067
1068**参数:**
1069
1070| 参数名     | 类型                                                         | 必填 | 说明                           |
1071| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
1072| callback | AsyncCallback\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)>> | 是   | 获取当前应用通知列表回调函数。 |
1073
1074**错误码:**
1075
1076以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1077
1078| 错误码ID | 错误信息                            |
1079| -------- | ----------------------------------- |
1080| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1081| 1600001  | Internal error.                     |
1082| 1600002  | Marshalling or unmarshalling error. |
1083| 1600003  | Failed to connect to the service.          |
1084
1085**示例:**
1086
1087```ts
1088import { BusinessError } from '@kit.BasicServicesKit';
1089
1090let getActiveNotificationsCallback = (err: BusinessError, data: Array<notificationManager.NotificationRequest>): void => {
1091  if (err) {
1092    console.error(`Failed to get active notifications. Code is ${err.code}, message is ${err.message}`);
1093  } else {
1094    console.info(`Succeeded in getting active notifications, data is ` + JSON.stringify(data));
1095  }
1096}
1097notificationManager.getActiveNotifications(getActiveNotificationsCallback);
1098```
1099
1100## notificationManager.getActiveNotifications
1101
1102getActiveNotifications(): Promise\<Array\<NotificationRequest\>\>
1103
1104获取当前应用未删除的通知列表。使用Promise异步回调。
1105
1106**系统能力**:SystemCapability.Notification.Notification
1107
1108**返回值:**
1109
1110| 类型                                                         | 说明                                    |
1111| ------------------------------------------------------------ | --------------------------------------- |
1112| Promise\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)\>\> | 以Promise形式返回获取当前应用通知列表。 |
1113
1114**错误码:**
1115
1116以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1117
1118| 错误码ID | 错误信息                            |
1119| -------- | ----------------------------------- |
1120| 1600001  | Internal error.                     |
1121| 1600002  | Marshalling or unmarshalling error. |
1122| 1600003  | Failed to connect to the service.          |
1123
1124**示例:**
1125
1126```ts
1127import { BusinessError } from '@kit.BasicServicesKit';
1128
1129notificationManager.getActiveNotifications().then((data: Array<notificationManager.NotificationRequest>) => {
1130  console.info(`Succeeded in getting active notifications, data is ` + JSON.stringify(data));
1131}).catch((err: BusinessError) => {
1132  console.error(`Failed to get active notifications. Code is ${err.code}, message is ${err.message}`);
1133});
1134```
1135
1136## notificationManager.cancelGroup
1137
1138cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
1139
1140取消本应用指定组下的通知。使用callback异步回调。
1141
1142**系统能力**:SystemCapability.Notification.Notification
1143
1144**参数:**
1145
1146| 参数名      | 类型                  | 必填 | 说明                         |
1147| --------- | --------------------- | ---- | ---------------------------- |
1148| groupName | string                | 是   | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象指定。 |
1149| callback  | AsyncCallback\<void\> | 是   | 取消本应用指定组下通知的回调函数。 |
1150
1151**错误码:**
1152
1153以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1154
1155| 错误码ID | 错误信息                            |
1156| -------- | ----------------------------------- |
1157| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1158| 1600001  | Internal error.                     |
1159| 1600002  | Marshalling or unmarshalling error. |
1160| 1600003  | Failed to connect to the service.          |
1161
1162**示例:**
1163
1164```ts
1165import { BusinessError } from '@kit.BasicServicesKit';
1166
1167let cancelGroupCallback = (err: BusinessError): void => {
1168  if (err) {
1169    console.error(`Failed to cancel group. Code is ${err.code}, message is ${err.message}`);
1170  } else {
1171    console.info(`Succeeded in canceling group.`);
1172  }
1173}
1174let groupName: string = "GroupName";
1175notificationManager.cancelGroup(groupName, cancelGroupCallback);
1176```
1177
1178## notificationManager.cancelGroup
1179
1180cancelGroup(groupName: string): Promise\<void\>
1181
1182取消本应用指定组下的通知。使用Promise异步回调。
1183
1184**系统能力**:SystemCapability.Notification.Notification
1185
1186**参数:**
1187
1188| 参数名      | 类型   | 必填 | 说明           |
1189| --------- | ------ | ---- | -------------- |
1190| groupName | string | 是   | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象指定。 |
1191
1192**返回值:**
1193
1194| 类型      | 说明        |
1195|---------|-----------|
1196| Promise\<void\> | 无返回结果的Promise对象。 |
1197
1198**错误码:**
1199
1200以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1201
1202| 错误码ID | 错误信息                            |
1203| -------- | ----------------------------------- |
1204| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1205| 1600001  | Internal error.                     |
1206| 1600002  | Marshalling or unmarshalling error. |
1207| 1600003  | Failed to connect to the service.          |
1208
1209**示例:**
1210
1211```ts
1212import { BusinessError } from '@kit.BasicServicesKit';
1213
1214let groupName: string = "GroupName";
1215notificationManager.cancelGroup(groupName).then(() => {
1216  console.info(`Succeeded in canceling group.`);
1217}).catch((err: BusinessError) => {
1218  console.error(`Failed to cancel group. Code is ${err.code}, message is ${err.message}`);
1219});
1220```
1221
1222## notificationManager.isSupportTemplate
1223
1224isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): void
1225
1226查询模板是否存在。使用callback异步回调。
1227
1228**系统能力**:SystemCapability.Notification.Notification
1229
1230**参数:**
1231
1232| 参数名       | 类型                     | 必填 | 说明                       |
1233| ------------ | ------------------------ | ---- | -------------------------- |
1234| templateName | string                   | 是   | 模板名称。当前仅支持'downloadTemplate'。                   |
1235| callback     | AsyncCallback\<boolean\> | 是   | 查询模板是否存在的回调函数(true:存在,false:不存在)。 |
1236
1237**错误码:**
1238
1239以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1240
1241| 错误码ID | 错误信息                            |
1242| -------- | ----------------------------------- |
1243| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1244| 1600001  | Internal error.                     |
1245| 1600002  | Marshalling or unmarshalling error. |
1246| 1600003  | Failed to connect to the service.          |
1247
1248**示例:**
1249
1250```ts
1251import { BusinessError } from '@kit.BasicServicesKit';
1252
1253let templateName: string = 'downloadTemplate';
1254let isSupportTemplateCallback = (err: BusinessError, data: boolean): void => {
1255  if (err) {
1256    console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
1257  } else {
1258    console.info("isSupportTemplate success, data: " + JSON.stringify(data));
1259  }
1260}
1261notificationManager.isSupportTemplate(templateName, isSupportTemplateCallback);
1262```
1263
1264## notificationManager.isSupportTemplate
1265
1266isSupportTemplate(templateName: string): Promise\<boolean\>
1267
1268查询模板是否存在。使用Promise异步回调。
1269
1270**系统能力**:SystemCapability.Notification.Notification
1271
1272**参数:**
1273
1274| 参数名       | 类型   | 必填 | 说明     |
1275| ------------ | ------ | ---- | -------- |
1276| templateName | string | 是   | 模板名称。当前仅支持'downloadTemplate'。 |
1277
1278**返回值:**
1279
1280| 类型               | 说明            |
1281| ------------------ | --------------- |
1282| Promise\<boolean\> | Promise方式返回模板是否存在的结果(true:存在,false:不存在)。 |
1283
1284**错误码:**
1285
1286以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1287
1288| 错误码ID | 错误信息                            |
1289| -------- | ----------------------------------- |
1290| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1291| 1600001  | Internal error.                     |
1292| 1600002  | Marshalling or unmarshalling error. |
1293| 1600003  | Failed to connect to the service.          |
1294
1295**示例:**
1296
1297```ts
1298import { BusinessError } from '@kit.BasicServicesKit';
1299
1300let templateName: string = 'downloadTemplate';
1301notificationManager.isSupportTemplate(templateName).then((data: boolean) => {
1302  console.info("isSupportTemplate success, data: " + JSON.stringify(data));
1303}).catch((err: BusinessError) => {
1304  console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
1305});
1306```
1307
1308## notificationManager.requestEnableNotification<sup>(deprecated)</sup>
1309
1310requestEnableNotification(callback: AsyncCallback\<void\>): void
1311
1312应用请求通知使能。使用callback异步回调。
1313
1314> **说明:**
1315>
1316> 从API version 12开始不再维护,建议使用有context入参的[requestEnableNotification](#notificationmanagerrequestenablenotification10)代替。
1317
1318**系统能力**:SystemCapability.Notification.Notification
1319
1320**参数:**
1321
1322| 参数名   | 类型                     | 必填 | 说明                       |
1323| -------- | ------------------------ | ---- | -------------------------- |
1324| callback | AsyncCallback\<void\> | 是   | 应用请求通知使能的回调函数。 |
1325
1326**错误码:**
1327
1328以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1329
1330| 错误码ID | 错误信息                            |
1331| -------- | ----------------------------------- |
1332| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1333| 1600001  | Internal error.                     |
1334| 1600002  | Marshalling or unmarshalling error. |
1335| 1600003  | Failed to connect to the service.          |
1336| 1600004  | Notification disabled.          |
1337| 1600013  | A notification dialog box is already displayed.           |
1338
1339**示例:**
1340
1341```ts
1342import { BusinessError } from '@kit.BasicServicesKit';
1343
1344let requestEnableNotificationCallback = (err: BusinessError): void => {
1345  if (err) {
1346    console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
1347  } else {
1348    console.info("requestEnableNotification success");
1349  }
1350};
1351notificationManager.requestEnableNotification(requestEnableNotificationCallback);
1352```
1353
1354## notificationManager.requestEnableNotification<sup>(deprecated)</sup>
1355
1356requestEnableNotification(): Promise\<void\>
1357
1358应用请求通知使能。使用Promise异步回调。
1359
1360> **说明:**
1361>
1362> 从API version 12开始不再维护,建议使用有context入参的[requestEnableNotification](#notificationmanagerrequestenablenotification10-1)代替。
1363
1364**系统能力**:SystemCapability.Notification.Notification
1365
1366**返回值:**
1367
1368| 类型      | 说明        |
1369|---------|-----------|
1370| Promise\<void\> | 无返回结果的Promise对象。 |
1371
1372**错误码:**
1373
1374以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1375
1376| 错误码ID | 错误信息                            |
1377| -------- | ----------------------------------- |
1378| 1600001  | Internal error.                     |
1379| 1600002  | Marshalling or unmarshalling error. |
1380| 1600003  | Failed to connect to the service.          |
1381| 1600004  | Notification disabled.          |
1382| 1600013  | A notification dialog box is already displayed.           |
1383
1384**示例:**
1385
1386```ts
1387import { BusinessError } from '@kit.BasicServicesKit';
1388
1389notificationManager.requestEnableNotification().then(() => {
1390  console.info("requestEnableNotification success");
1391}).catch((err: BusinessError) => {
1392  console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
1393});
1394```
1395
1396## notificationManager.requestEnableNotification<sup>10+</sup>
1397
1398requestEnableNotification(context: UIAbilityContext, callback: AsyncCallback\<void\>): void
1399
1400应用请求通知使能模态弹窗。使用callback异步回调。
1401
1402仅当应用界面加载完成后(即调用[loadContent](../apis-ability-kit/js-apis-app-ability-uiExtensionContentSession.md#uiextensioncontentsessionloadcontent)成功),方可使用该接口。
1403
1404**模型约束**:此接口仅可在Stage模型下使用。
1405
1406**系统能力**:SystemCapability.Notification.Notification
1407
1408**参数:**
1409
1410| 参数名   | 类型                     | 必填 | 说明                 |
1411| -------- | ------------------------ | ---- |--------------------|
1412| context | [UIAbilityContext](../../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md) | 是   | 通知弹窗绑定Ability的上下文。 |
1413| callback | AsyncCallback\<void\> | 是   | 应用请求通知使能的回调函数。     |
1414
1415**错误码:**
1416
1417以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1418
1419| 错误码ID | 错误信息                            |
1420| -------- | ----------------------------------- |
1421| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1422| 1600001  | Internal error.                     |
1423| 1600002  | Marshalling or unmarshalling error. |
1424| 1600003  | Failed to connect to the service.          |
1425| 1600004  | Notification disabled.          |
1426| 1600013  | A notification dialog box is already displayed.           |
1427
1428**示例:**
1429
1430```ts
1431import { BusinessError } from '@kit.BasicServicesKit';
1432import { UIAbility } from '@kit.AbilityKit';
1433import { window } from '@kit.ArkUI';
1434import { hilog } from '@kit.PerformanceAnalysisKit';
1435
1436class MyAbility extends UIAbility {
1437  onWindowStageCreate(windowStage: window.WindowStage) {
1438  hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
1439    windowStage.loadContent('pages/Index', (err, data) => {
1440      if (err.code) {
1441        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
1442        return;
1443      }
1444      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
1445      let requestEnableNotificationCallback = (err: BusinessError): void => {
1446        if (err) {
1447          hilog.error(0x0000, 'testTag', `[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
1448        } else {
1449          hilog.info(0x0000, 'testTag', `[ANS] requestEnableNotification success`);
1450        }
1451      };
1452      notificationManager.requestEnableNotification(this.context, requestEnableNotificationCallback);
1453    });
1454  }
1455}
1456```
1457
1458## notificationManager.requestEnableNotification<sup>10+</sup>
1459
1460requestEnableNotification(context: UIAbilityContext): Promise\<void\>
1461
1462应用请求通知使能模态弹窗。使用Promise异步回调。
1463
1464仅当应用界面加载完成后(即调用[loadContent](../apis-ability-kit/js-apis-app-ability-uiExtensionContentSession.md#uiextensioncontentsessionloadcontent)成功),方可使用该接口。
1465
1466**模型约束**:此接口仅可在Stage模型下使用。
1467
1468**系统能力**:SystemCapability.Notification.Notification
1469
1470**参数:**
1471
1472| 参数名   | 类型                     | 必填 | 说明                 |
1473| -------- | ------------------------ | ---- |--------------------|
1474| context | [UIAbilityContext](../../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md) | 是   | 通知弹窗绑定Ability的上下文。 |
1475
1476**返回值:**
1477
1478| 类型      | 说明        |
1479|---------|-----------|
1480| Promise\<void\> | 无返回结果的Promise对象。 |
1481
1482**错误码:**
1483
1484以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1485
1486| 错误码ID | 错误信息                            |
1487| -------- | ----------------------------------- |
1488| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1489| 1600001  | Internal error.                     |
1490| 1600002  | Marshalling or unmarshalling error. |
1491| 1600003  | Failed to connect to the service.          |
1492| 1600004  | Notification disabled.          |
1493| 1600013  | A notification dialog box is already displayed.           |
1494
1495**示例:**
1496
1497```ts
1498import { BusinessError } from '@kit.BasicServicesKit';
1499import { UIAbility } from '@kit.AbilityKit';
1500import { window } from '@kit.ArkUI';
1501import { hilog } from '@kit.PerformanceAnalysisKit';
1502
1503class MyAbility extends UIAbility {
1504  onWindowStageCreate(windowStage: window.WindowStage) {
1505    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
1506    windowStage.loadContent('pages/Index', (err, data) => {
1507      if (err.code) {
1508        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
1509        return;
1510      }
1511      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
1512      notificationManager.requestEnableNotification(this.context).then(() => {
1513        hilog.info(0x0000, 'testTag', `[ANS] requestEnableNotification success`);
1514      }).catch((err: BusinessError) => {
1515        hilog.error(0x0000, 'testTag', `[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
1516      });
1517    });
1518  }
1519}
1520```
1521
1522## notificationManager.isDistributedEnabled
1523
1524isDistributedEnabled(callback: AsyncCallback\<boolean>): void
1525
1526查询设备是否支持分布式通知。使用callback异步回调。
1527
1528**系统能力**:SystemCapability.Notification.Notification
1529
1530**参数:**
1531
1532| 参数名   | 类型                     | 必填 | 说明                       |
1533| -------- | ------------------------ | ---- | -------------------------- |
1534| callback | AsyncCallback\<boolean\> | 是   | 设备是否支持分布式通知的回调函数(true:支持,false:不支持)。 |
1535
1536**错误码:**
1537
1538以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1539
1540| 错误码ID | 错误信息                            |
1541| -------- | ----------------------------------- |
1542| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1543| 1600001  | Internal error.                     |
1544| 1600002  | Marshalling or unmarshalling error. |
1545| 1600003  | Failed to connect to the service.          |
1546| 1600010  | Distributed operation failed.       |
1547
1548**示例:**
1549
1550```ts
1551import { BusinessError } from '@kit.BasicServicesKit';
1552
1553let isDistributedEnabledCallback = (err: BusinessError, data: boolean): void => {
1554  if (err) {
1555    console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`);
1556  } else {
1557    console.info("isDistributedEnabled success " + JSON.stringify(data));
1558  }
1559};
1560notificationManager.isDistributedEnabled(isDistributedEnabledCallback);
1561```
1562
1563## notificationManager.isDistributedEnabled
1564
1565isDistributedEnabled(): Promise\<boolean>
1566
1567查询设备是否支持分布式通知。使用Promise异步回调。
1568
1569**系统能力**:SystemCapability.Notification.Notification
1570
1571**返回值:**
1572
1573| 类型               | 说明                                          |
1574| ------------------ | --------------------------------------------- |
1575| Promise\<boolean\> | Promise方式返回设备是否支持分布式通知的结果(true:支持,false:不支持)。 |
1576
1577**错误码:**
1578
1579以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1580
1581| 错误码ID | 错误信息                            |
1582| -------- | ----------------------------------- |
1583| 1600001  | Internal error.                     |
1584| 1600002  | Marshalling or unmarshalling error. |
1585| 1600003  | Failed to connect to the service.          |
1586| 1600010  | Distributed operation failed.       |
1587
1588**示例:**
1589
1590```ts
1591import { BusinessError } from '@kit.BasicServicesKit';
1592
1593notificationManager.isDistributedEnabled().then((data: boolean) => {
1594  console.info("isDistributedEnabled success, data: " + JSON.stringify(data));
1595}).catch((err: BusinessError) => {
1596  console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`);
1597});
1598```
1599
1600## notificationManager.openNotificationSettings<sup>13+</sup>
1601
1602openNotificationSettings(context: UIAbilityContext): Promise\<void\>
1603
1604拉起应用的通知设置界面,该页面以半模态形式呈现,可用于设置通知开关、通知提醒方式等。使用Promise异步回调。
1605
1606该接口不支持wearable设备。
1607
1608**模型约束**:此接口仅可在Stage模型下使用。
1609
1610**系统能力**:SystemCapability.Notification.NotificationSettings
1611
1612**参数:**
1613
1614| 参数名   | 类型                     | 必填 | 说明                 |
1615| -------- | ------------------------ | ---- |--------------------|
1616| context | [UIAbilityContext](../../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md) | 是   | 通知设置页面绑定Ability的上下文。 |
1617
1618**返回值:**
1619
1620| 类型      | 说明        |
1621|---------|-----------|
1622| Promise\<void\> | 无返回结果的Promise对象。 |
1623
1624**错误码:**
1625
1626以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[通知错误码](./errorcode-notification.md)。
1627
1628| 错误码ID | 错误信息                            |
1629| -------- | ----------------------------------- |
1630| 801 | Capability not supported. |
1631| 1600001  | Internal error.                     |
1632| 1600003  | Failed to connect to the service.          |
1633| 1600018  | the notification settings window is already displayed.           |
1634
1635**示例:**
1636
1637```ts
1638import { BusinessError } from '@kit.BasicServicesKit';
1639import { UIAbility } from '@kit.AbilityKit';
1640import { window } from '@kit.ArkUI';
1641import { hilog } from '@kit.PerformanceAnalysisKit';
1642
1643class MyAbility extends UIAbility {
1644  onWindowStageCreate(windowStage: window.WindowStage) {
1645    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
1646    windowStage.loadContent('pages/Index', (err, data) => {
1647      if (err.code) {
1648        hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
1649        return;
1650      }
1651      hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
1652      notificationManager.openNotificationSettings(this.context).then(() => {
1653        hilog.info(0x0000, 'testTag', `[ANS] openNotificationSettings success`);
1654      }).catch((err: BusinessError) => {
1655        hilog.error(0x0000, 'testTag', `[ANS] openNotificationSettings failed, code is ${err.code}, message is ${err.message}`);
1656      });
1657    });
1658  }
1659}
1660```
1661
1662## ContentType
1663
1664通知内容类型。
1665
1666**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
1667
1668**系统能力**:SystemCapability.Notification.Notification
1669
1670| 名称                              | 值          | 说明               |
1671| --------------------------------- | ----------- |------------------|
1672| NOTIFICATION_CONTENT_BASIC_TEXT   | 0          | 普通类型通知。          |
1673| NOTIFICATION_CONTENT_LONG_TEXT    | 1          | 长文本类型通知。         |
1674| NOTIFICATION_CONTENT_PICTURE      | 2          | 图片类型通知。          |
1675| NOTIFICATION_CONTENT_CONVERSATION | 3          | 社交类型通知。预留能力,暂未支持。|
1676| NOTIFICATION_CONTENT_MULTILINE    | 4          | 多行文本类型通知。        |
1677| NOTIFICATION_CONTENT_SYSTEM_LIVE_VIEW<sup>11+</sup>    | 5 | 实况窗类型通知。不支持三方应用直接创建该类型通知,可以由系统代理创建系统实况窗类型通知后,三方应用发布同ID的通知来更新指定内容。|
1678| NOTIFICATION_CONTENT_LIVE_VIEW<sup>11+</sup>    | 6 | 普通实况窗类型通知。只支持系统应用。  |
1679
1680## SlotLevel
1681
1682通知级别。
1683
1684**系统能力**:SystemCapability.Notification.Notification
1685
1686| 名称                              | 值          | 说明               |
1687| --------------------------------- | ----------- | ------------------ |
1688| LEVEL_NONE                        | 0           | 表示关闭通知功能。     |
1689| LEVEL_MIN                         | 1           | 表示通知功能已启用,但状态栏中不显示通知图标,且没有横幅和提示音。 |
1690| LEVEL_LOW                         | 2           | 表示通知功能已启用,且状态栏中显示通知图标,但没有横幅和提示音。 |
1691| LEVEL_DEFAULT                     | 3           | 表示通知功能已启用,状态栏中显示通知图标,没有横幅但有提示音。 |
1692| LEVEL_HIGH                        | 4           | 表示通知功能已启用,状态栏中显示通知图标,有横幅和提示音。 |
1693
1694
1695## SlotType
1696
1697通知渠道类型。
1698
1699**原子化服务API:** 从API version 12开始,该接口支持在原子化服务中使用。
1700
1701**系统能力**:SystemCapability.Notification.Notification
1702
1703| 名称                 | 值       | 说明       |
1704| -------------------- | -------- | ---------- |
1705| UNKNOWN_TYPE         | 0 | 未知类型。该类型对应[SlotLevel](#slotlevel)为LEVEL_MIN。 |
1706| SOCIAL_COMMUNICATION | 1 | 社交通信。该类型对应[SlotLevel](#slotlevel)为LEVEL_HIGH。 |
1707| SERVICE_INFORMATION  | 2 | 服务提醒。该类型对应[SlotLevel](#slotlevel)为LEVEL_HIGH。|
1708| CONTENT_INFORMATION  | 3 | 内容资讯。该类型对应[SlotLevel](#slotlevel)为LEVEL_MIN。 |
1709| LIVE_VIEW<sup>11+</sup>            | 4 | 实况窗。不支持三方应用直接创建该渠道类型通知,可以由系统代理创建后,三方应用发布同ID的通知来更新指定内容。该类型对应[SlotLevel](#slotlevel)为LEVEL_DEFAULT。 |
1710| CUSTOMER_SERVICE<sup>11+</sup>     | 5 | 客服消息。该类型用于用户与商家之间的客服消息,需由用户主动发起。该类型对应[SlotLevel](#slotlevel)为LEVEL_DEFAULT。  |
1711| OTHER_TYPES          | 0xFFFF | 其他。该类型对应[SlotLevel](#slotlevel)为LEVEL_MIN。 |
1712
1713## BundleOption
1714
1715type BundleOption = _BundleOption
1716
1717描述BundleOption信息,即指定应用的包信息。
1718
1719**系统能力:** SystemCapability.Notification.Notification
1720
1721| 类型 | 说明 |
1722| --- | --- |
1723| [_BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 描述BundleOption信息,即指定应用的包信息。 |
1724
1725## NotificationActionButton
1726
1727type NotificationActionButton = _NotificationActionButton
1728
1729描述通知中显示的操作按钮。
1730
1731**系统能力:** SystemCapability.Notification.Notification
1732
1733| 类型 | 说明 |
1734| --- | --- |
1735| [_NotificationActionButton](js-apis-inner-notification-notificationActionButton.md) | 描述通知中显示的操作按钮。 |
1736
1737## NotificationBasicContent
1738
1739type NotificationBasicContent = _NotificationBasicContent
1740
1741描述普通文本通知。
1742
1743**系统能力:** SystemCapability.Notification.Notification
1744
1745| 类型 | 说明 |
1746| --- | --- |
1747| [_NotificationBasicContent](js-apis-inner-notification-notificationContent.md#notificationbasiccontent) | 描述普通文本通知。 |
1748
1749## NotificationContent
1750
1751type NotificationContent = _NotificationContent
1752
1753描述通知内容。
1754
1755**系统能力:** SystemCapability.Notification.Notification
1756
1757| 类型 | 说明 |
1758| --- | --- |
1759| [_NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 描述通知内容。 |
1760
1761## NotificationLongTextContent
1762
1763type NotificationLongTextContent = _NotificationLongTextContent
1764
1765描述长文本通知。
1766
1767**系统能力:** SystemCapability.Notification.Notification
1768
1769| 类型 | 说明 |
1770| --- | --- |
1771| [_NotificationLongTextContent](js-apis-inner-notification-notificationContent.md#notificationlongtextcontent) | 描述长文本通知。 |
1772
1773## NotificationMultiLineContent
1774
1775type NotificationMultiLineContent = _NotificationMultiLineContent
1776
1777描述多行文本通知。
1778
1779**系统能力:** SystemCapability.Notification.Notification
1780
1781| 类型 | 说明 |
1782| --- | --- |
1783| [_NotificationMultiLineContent](js-apis-inner-notification-notificationContent.md#notificationmultilinecontent) | 描述多行文本通知。 |
1784
1785## NotificationPictureContent
1786
1787type NotificationPictureContent = _NotificationPictureContent
1788
1789描述附有图片的通知。
1790
1791**系统能力:** SystemCapability.Notification.Notification
1792
1793| 类型 | 说明 |
1794| --- | --- |
1795| [_NotificationPictureContent](js-apis-inner-notification-notificationContent.md#notificationpicturecontent) | 描述附有图片的通知。 |
1796
1797## NotificationSystemLiveViewContent<sup>11+</sup>
1798
1799type NotificationSystemLiveViewContent = _NotificationSystemLiveViewContent
1800
1801描述系统实况窗通知内容。
1802
1803**系统能力:** SystemCapability.Notification.Notification
1804
1805| 类型 | 说明 |
1806| --- | --- |
1807| [_NotificationSystemLiveViewContent](js-apis-inner-notification-notificationContent.md#notificationsystemliveviewcontent) | 描述系统实况窗通知内容。 |
1808
1809## NotificationRequest
1810
1811type NotificationRequest = _NotificationRequest
1812
1813描述通知的请求。
1814
1815**系统能力:** SystemCapability.Notification.Notification
1816
1817| 类型 | 说明 |
1818| --- | --- |
1819| [_NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 描述通知的请求。 |
1820
1821## DistributedOptions
1822
1823type DistributedOptions = _DistributedOptions
1824
1825描述分布式选项。
1826
1827**系统能力:** SystemCapability.Notification.Notification
1828
1829| 类型 | 说明 |
1830| --- | --- |
1831| [_DistributedOptions](js-apis-inner-notification-notificationRequest.md#distributedoptions8) | 描述分布式选项。 |
1832
1833## NotificationSlot
1834
1835type NotificationSlot = _NotificationSlot
1836
1837描述通知槽。
1838
1839**系统能力:** SystemCapability.Notification.Notification
1840
1841| 类型 | 说明 |
1842| --- | --- |
1843| [_NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 描述通知槽。 |
1844
1845## NotificationTemplate
1846
1847type NotificationTemplate = _NotificationTemplate
1848
1849通知模板。
1850
1851**系统能力:** SystemCapability.Notification.Notification
1852
1853| 类型 | 说明 |
1854| --- | --- |
1855| [_NotificationTemplate](js-apis-inner-notification-notificationTemplate.md) | 通知模板。 |
1856
1857## NotificationUserInput
1858
1859type NotificationUserInput = _NotificationUserInput
1860
1861保存用户输入的通知消息。
1862
1863**系统能力:** SystemCapability.Notification.Notification
1864
1865| 类型 | 说明 |
1866| --- | --- |
1867| [_NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | 保存用户输入的通知消息。 |
1868
1869## NotificationCapsule<sup>11+</sup>
1870
1871type NotificationCapsule = _NotificationCapsule
1872
1873描述通知胶囊。
1874
1875**系统能力:** SystemCapability.Notification.Notification
1876
1877| 类型 | 说明 |
1878| --- | --- |
1879| [_NotificationCapsule](js-apis-inner-notification-notificationContent.md#notificationcapsule11) | 描述通知胶囊。 |
1880
1881## NotificationButton<sup>11+</sup>
1882
1883type NotificationButton = _NotificationButton
1884
1885描述通知按钮。
1886
1887**系统能力:** SystemCapability.Notification.Notification
1888
1889| 类型 | 说明 |
1890| --- | --- |
1891| [_NotificationButton](js-apis-inner-notification-notificationContent.md#notificationbutton11) | 描述通知按钮。 |
1892
1893## NotificationTime<sup>11+</sup>
1894
1895type NotificationTime = _NotificationTime
1896
1897描述通知计时信息。
1898
1899**系统能力:** SystemCapability.Notification.Notification
1900
1901| 类型 | 说明 |
1902| --- | --- |
1903| [_NotificationTime](js-apis-inner-notification-notificationContent.md#notificationtime11) | 描述通知计时信息。 |
1904
1905## NotificationProgress<sup>11+</sup>
1906
1907type NotificationProgress = _NotificationProgress
1908
1909描述通知进度。
1910
1911**系统能力:** SystemCapability.Notification.Notification
1912
1913| 类型 | 说明 |
1914| --- | --- |
1915| [_NotificationProgress](js-apis-inner-notification-notificationContent.md#notificationprogress11) | 描述通知进度。 |