1# @ohos.notificationManager (NotificationManager) (System API)
2
3The **NotificationManager** module provides notification management capabilities, covering notifications, notification slots, notification enabled status, and notification badge status.
4
5> **NOTE**<br>
6>
7> The initial APIs of this module are supported since API version 9. 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 [[NotificationManager](./js-apis-notificationManager.md).
10
11## Modules to Import
12
13```ts
14import { notificationManager } from '@kit.NotificationKit';
15```
16
17## notificationManager.publish
18
19publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void\>): void
20
21Publishes a notification to a specified user. This API uses an asynchronous callback to return the result.
22
23**System capability**: SystemCapability.Notification.Notification
24
25**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
26
27**System API**: This is a system API.
28
29**Parameters**
30
31| Name    | Type                                       | Mandatory| Description                                       |
32| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
33| request  | [NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest) | Yes  | Content and related configuration of the notification to publish.|
34| userId   | number                                      | Yes  | User ID.                          |
35| callback | AsyncCallback\<void\>                       | Yes  | Callback used to return the result.                          |
36
37**Error codes**
38
39For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
40
41| ID| Error Message                                             |
42| -------- | ---------------------------------------------------- |
43| 201      | Permission denied.     |
44| 202      | Not system application to call the interface.                                      |
45| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
46| 1600001  | Internal error.                                      |
47| 1600002  | Marshalling or unmarshalling error.                  |
48| 1600003  | Failed to connect to the service.                    |
49| 1600004  | Notification disabled.                               |
50| 1600005  | Notification slot disabled.                    |
51| 1600007  | The notification does not exist.                       |
52| 1600008  | The user does not exist.                               |
53| 1600009  | Over max number notifications per second.            |
54| 1600012  | No memory space.                                     |
55| 1600014  | No permission.                                   |
56| 1600015  | The current notification status does not support duplicate configurations. |
57| 1600016  | The notification version for this update is too low. |
58| 2300007  | Network unreachable.                              |
59
60**Example**
61
62```ts
63import { BusinessError } from '@kit.BasicServicesKit';
64
65// publish callback
66let publishCallback = (err: BusinessError): void => {
67    if (err) {
68        console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
69    } else {
70        console.info("publish success");
71    }
72}
73// Use the actual user ID when calling the API.
74let userId: number = 1;
75// NotificationRequest object
76let notificationRequest: notificationManager.NotificationRequest = {
77    id: 1,
78    content: {
79        notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
80        normal: {
81            title: "test_title",
82            text: "test_text",
83            additionalText: "test_additionalText"
84        }
85    }
86};
87notificationManager.publish(notificationRequest, userId, publishCallback);
88```
89
90## notificationManager.publish
91
92publish(request: NotificationRequest, userId: number): Promise\<void\>
93
94Publishes a notification to a specified user. This API uses a promise to return the result.
95
96**System capability**: SystemCapability.Notification.Notification
97
98**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
99
100**System API**: This is a system API.
101
102**Parameters**
103
104| Name    |  Type                                       | Mandatory| Description                                       |
105| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
106| request  | [NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest) | Yes  | Content and related configuration of the notification to publish.|
107| userId   | number                                      | Yes  | User ID.                          |
108
109**Return value**
110
111| Type    | Description       |
112| ------- |-----------|
113| Promise\<void\> | Promise that returns no value.|
114
115**Error codes**
116
117For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
118
119| ID| Error Message                                             |
120| -------- | ---------------------------------------------------- |
121| 201      | Permission denied.     |
122| 202      | Not system application to call the interface.                                      |
123| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
124| 1600001  | Internal error.                                      |
125| 1600002  | Marshalling or unmarshalling error.                  |
126| 1600003  | Failed to connect to the service.                           |
127| 1600004  | Notification disabled.                         |
128| 1600005  | Notification slot disabled.                    |
129| 1600007  | The notification does not exist.                       |
130| 1600008  | The user does not exist.                               |
131| 1600009  | Over max number notifications per second.            |
132| 1600012  | No memory space.                                     |
133| 1600014  | No permission.                                   |
134| 1600015  | The current notification status does not support duplicate configurations. |
135| 1600016  | The notification version for this update is too low. |
136| 2300007  | Network unreachable.                              |
137
138**Example**
139
140```ts
141import { BusinessError } from '@kit.BasicServicesKit';
142
143let notificationRequest: notificationManager.NotificationRequest = {
144    id: 1,
145    content: {
146        notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
147        normal: {
148            title: "test_title",
149            text: "test_text",
150            additionalText: "test_additionalText"
151        }
152    }
153};
154
155// Use the actual user ID when calling the API.
156let userId: number = 1;
157
158notificationManager.publish(notificationRequest, userId).then(() => {
159	console.info("publish success");
160}).catch((err: BusinessError) => {
161    console.error(`publish fail: ${JSON.stringify(err)}`);
162});
163```
164
165## notificationManager.addSlot
166
167addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
168
169Adds a notification slot. This API uses an asynchronous callback to return the result.
170
171**System capability**: SystemCapability.Notification.Notification
172
173**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
174
175**System API**: This is a system API.
176
177**Parameters**
178
179| Name    | Type                 | Mandatory| Description                |
180| -------- | --------------------- | ---- | -------------------- |
181| slot     | [NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)       | Yes  | Notification slot to add.|
182| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
183
184**Error codes**
185
186For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
187
188| ID| Error Message                           |
189| -------- | ----------------------------------- |
190| 201      | Permission denied.     |
191| 202      | Not system application to call the interface.                                      |
192| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
193| 1600001  | Internal error.                     |
194| 1600002  | Marshalling or unmarshalling error. |
195| 1600003  | Failed to connect to the service.          |
196| 1600012  | No memory space.                          |
197
198**Example**
199
200```ts
201import { BusinessError } from '@kit.BasicServicesKit';
202
203// addSlot callback
204let addSlotCallBack = (err: BusinessError): void => {
205    if (err) {
206        console.error(`addSlot failed, code is ${err.code}, message is ${err.message}`);
207    } else {
208        console.info("addSlot success");
209    }
210}
211// NotificationSlot object
212let notificationSlot: notificationManager.NotificationSlot = {
213    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
214};
215notificationManager.addSlot(notificationSlot, addSlotCallBack);
216```
217
218## notificationManager.addSlot
219
220addSlot(slot: NotificationSlot): Promise\<void\>
221
222Adds a notification slot. This API uses a promise to return the result.
223
224**System capability**: SystemCapability.Notification.Notification
225
226**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
227
228**System API**: This is a system API.
229
230**Parameters**
231
232| Name| Type            | Mandatory| Description                |
233| ---- | ---------------- | ---- | -------------------- |
234| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md) | Yes  | Notification slot to add.|
235
236**Return value**
237
238| Type    | Description       |
239| ------- |-----------|
240| Promise\<void\> | Promise that returns no value.|
241
242**Error codes**
243
244For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
245
246| ID| Error Message                           |
247| -------- | ----------------------------------- |
248| 201      | Permission denied.     |
249| 202      | Not system application to call the interface.                                      |
250| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
251| 1600001  | Internal error.                     |
252| 1600002  | Marshalling or unmarshalling error. |
253| 1600003  | Failed to connect to the service.          |
254| 1600012  | No memory space.                          |
255
256**Example**
257
258```ts
259import { BusinessError } from '@kit.BasicServicesKit';
260
261// NotificationSlot object
262let notificationSlot: notificationManager.NotificationSlot = {
263    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
264};
265notificationManager.addSlot(notificationSlot).then(() => {
266	console.info("addSlot success");
267}).catch((err: BusinessError) => {
268    console.error(`addSlot fail: ${JSON.stringify(err)}`);
269});
270```
271
272## notificationManager.addSlots
273
274addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): void
275
276Adds an array of notification slots. This API uses an asynchronous callback to return the result.
277
278**System capability**: SystemCapability.Notification.Notification
279
280**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
281
282**System API**: This is a system API.
283
284**Parameters**
285
286| Name    | Type                     | Mandatory| Description                    |
287| -------- | ------------------------- | ---- | ------------------------ |
288| slots    | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)\> | Yes  | Notification slots to add.|
289| callback | AsyncCallback\<void\>     | Yes  | Callback used to return the result.    |
290
291**Error codes**
292
293For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
294
295| ID| Error Message                           |
296| -------- | ----------------------------------- |
297| 201      | Permission denied.     |
298| 202      | Not system application to call the interface.                                      |
299| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
300| 1600001  | Internal error.                     |
301| 1600002  | Marshalling or unmarshalling error. |
302| 1600003  | Failed to connect to the service.          |
303| 1600012  | No memory space.                          |
304
305**Example**
306
307```ts
308import { BusinessError } from '@kit.BasicServicesKit';
309
310// addSlots callback
311let addSlotsCallBack = (err: BusinessError): void => {
312    if (err) {
313        console.error(`addSlots failed, code is ${err.code}, message is ${err.message}`);
314    } else {
315        console.info("addSlots success");
316    }
317}
318// NotificationSlot object
319let notificationSlot: notificationManager.NotificationSlot = {
320    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
321};
322// NotificationSlotArray object
323let notificationSlotArray: notificationManager.NotificationSlot[] = new Array();
324notificationSlotArray[0] = notificationSlot;
325
326notificationManager.addSlots(notificationSlotArray, addSlotsCallBack);
327```
328
329## notificationManager.addSlots
330
331addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
332
333Adds an array of notification slots. This API uses a promise to return the result.
334
335**System capability**: SystemCapability.Notification.Notification
336
337**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
338
339**System API**: This is a system API.
340
341**Parameters**
342
343| Name | Type                     | Mandatory| Description                    |
344| ----- | ------------------------- | ---- | ------------------------ |
345| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)\> | Yes  | Notification slots to add.|
346
347**Return value**
348
349| Type     | Description       |
350|---------|-----------|
351| Promise\<void\> | Promise that returns no value.|
352
353**Error codes**
354
355For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
356
357| ID| Error Message                           |
358| -------- | ----------------------------------- |
359| 201      | Permission denied.     |
360| 202      | Not system application to call the interface.                                      |
361| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
362| 1600001  | Internal error.                     |
363| 1600002  | Marshalling or unmarshalling error. |
364| 1600003  | Failed to connect to the service.          |
365| 1600012  | No memory space.                          |
366
367**Example**
368
369```ts
370import { BusinessError } from '@kit.BasicServicesKit';
371
372// NotificationSlot object
373let notificationSlot: notificationManager.NotificationSlot = {
374    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
375};
376// NotificationSlotArray object
377let notificationSlotArray: notificationManager.NotificationSlot[] = new Array();
378notificationSlotArray[0] = notificationSlot;
379
380notificationManager.addSlots(notificationSlotArray).then(() => {
381	console.info("addSlots success");
382}).catch((err: BusinessError) => {
383    console.error(`addSlots fail: ${JSON.stringify(err)}`);
384});
385```
386
387
388## notificationManager.setNotificationEnable
389
390setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
391
392Sets whether to enable notification for a specified application. This API uses an asynchronous callback to return the result.
393
394**System capability**: SystemCapability.Notification.Notification
395
396**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
397
398**System API**: This is a system API.
399
400**Parameters**
401
402| Name    | Type                 | Mandatory| Description                |
403| -------- | --------------------- | ---- | -------------------- |
404| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)   | Yes  | Bundle information of the application.       |
405| enable   | boolean               | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.            |
406| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
407
408**Error codes**
409
410For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
411
412| ID| Error Message                                |
413| -------- | ---------------------------------------- |
414| 201      | Permission denied.     |
415| 202      | Not system application to call the interface.                                      |
416| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
417| 1600001  | Internal error.                          |
418| 1600002  | Marshalling or unmarshalling error.      |
419| 1600003  | Failed to connect to the service.               |
420| 17700001 | The specified bundle name was not found. |
421
422**Example**
423
424```ts
425import { BusinessError } from '@kit.BasicServicesKit';
426
427let setNotificationEnableCallback = (err: BusinessError): void => {
428    if (err) {
429        console.error(`setNotificationEnable failed, code is ${err.code}, message is ${err.message}`);
430    } else {
431        console.info("setNotificationEnable success");
432    }
433}
434let bundle: notificationManager.BundleOption = {
435    bundle: "bundleName1",
436};
437notificationManager.setNotificationEnable(bundle, false, setNotificationEnableCallback);
438```
439
440## notificationManager.setNotificationEnable
441
442setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
443
444Sets whether to enable notification for a specified application. This API uses a promise to return the result.
445
446**System capability**: SystemCapability.Notification.Notification
447
448**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
449
450**System API**: This is a system API.
451
452**Parameters**
453
454| Name  | Type        | Mandatory| Description      |
455| ------ | ------------ | ---- | ---------- |
456| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
457| enable | boolean      | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.  |
458
459**Return value**
460
461| Type     | Description       |
462|---------|-----------|
463| Promise\<void\> | Promise that returns no value.|
464
465**Error codes**
466
467For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
468
469| ID| Error Message                                |
470| -------- | ---------------------------------------- |
471| 201      | Permission denied.     |
472| 202      | Not system application to call the interface.                                      |
473| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
474| 1600001  | Internal error.                          |
475| 1600002  | Marshalling or unmarshalling error.      |
476| 1600003  | Failed to connect to the service.               |
477| 17700001 | The specified bundle name was not found. |
478
479**Example**
480
481```ts
482import { BusinessError } from '@kit.BasicServicesKit';
483
484let bundle: notificationManager.BundleOption = {
485    bundle: "bundleName1",
486};
487notificationManager.setNotificationEnable(bundle, false).then(() => {
488	console.info("setNotificationEnable success");
489}).catch((err: BusinessError) => {
490    console.error(`setNotificationEnable fail: ${JSON.stringify(err)}`);
491});
492```
493
494## notificationManager.getAllNotificationEnabledBundles<sup>12+</sup>
495
496getAllNotificationEnabledBundles(): Promise<Array<BundleOption\>>
497
498Obtains a list of applications that allow notifications. This API uses a promise to return the result.
499
500**System capability**: SystemCapability.Notification.Notification
501
502**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
503
504**System API**: This is a system API.
505
506**Return value**
507
508| Type     | Description       |
509|---------|-----------|
510| Promise<Array<[BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption)\>> | Returns a list of applications that allow notifications.|
511
512**Error codes**
513
514For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
515
516| ID| Error Message                           |
517| -------- | ----------------------------------- |
518| 201      | Permission denied.     |
519| 202      | Not system application to call the interface.                                      |
520| 1600001  | Internal error.                     |
521| 1600002  | Marshalling or unmarshalling error. |
522| 1600003  | Failed to connect to the service.          |
523
524**Example**
525
526```ts
527import { BusinessError } from '@kit.BasicServicesKit';
528
529notificationManager.getAllNotificationEnabledBundles().then((data: Array<notificationManager.BundleOption>) => {
530    console.info("Enable bundle data is" + JSON.stringify(data));
531    data.forEach(element => {
532        console.info("Enable uid is " + JSON.stringify(element.uid));
533        console.info("Enable bundle is " + JSON.stringify(element.bundle));
534    });
535}).catch((err: BusinessError) => {
536    console.error("getAllNotificationEnabledBundles failed, error is" + JSON.stringify(err));
537})
538```
539
540## notificationManager.isNotificationEnabled
541
542isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
543
544Checks whether notification is enabled for the specified application. This API uses an asynchronous callback to return the result.
545
546**System capability**: SystemCapability.Notification.Notification
547
548**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
549
550**System API**: This is a system API.
551
552**Parameters**
553
554| Name    | Type                 | Mandatory| Description                    |
555| -------- | --------------------- | ---- | ------------------------ |
556| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)          | Yes  | Bundle information of the application.           |
557| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result. The value **true** means that the notification is enabled, and **false** means the opposite.|
558
559**Error codes**
560
561For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
562
563| ID| Error Message                                |
564| -------- | ---------------------------------------- |
565| 201      | Permission denied.     |
566| 202      | Not system application to call the interface.                                      |
567| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
568| 1600001  | Internal error.                          |
569| 1600002  | Marshalling or unmarshalling error.      |
570| 1600003  | Failed to connect to the service.               |
571| 17700001 | The specified bundle name was not found. |
572
573**Example**
574
575```ts
576import { BusinessError } from '@kit.BasicServicesKit';
577
578let isNotificationEnabledCallback = (err: BusinessError, data: boolean): void => {
579    if (err) {
580        console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
581    } else {
582        console.info(`isNotificationEnabled success, data is ${JSON.stringify(data)}`);
583    }
584}
585
586let bundle: notificationManager.BundleOption = {
587    bundle: "bundleName1",
588};
589
590notificationManager.isNotificationEnabled(bundle, isNotificationEnabledCallback);
591```
592
593## notificationManager.isNotificationEnabled
594
595isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
596
597Checks whether notification is enabled for the specified application. This API uses a promise to return the result.
598
599**System capability**: SystemCapability.Notification.Notification
600
601**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
602
603**System API**: This is a system API.
604
605**Parameters**
606
607| Name  | Type        | Mandatory| Description      |
608| ------ | ------------ | ---- | ---------- |
609| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
610
611**Return value**
612
613| Type              | Description                                               |
614| ------------------ | --------------------------------------------------- |
615| Promise\<boolean\> | Promise used to return the result. The value **true** means that the notification is enabled, and **false** means the opposite.|
616
617**Error codes**
618
619For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
620
621| ID| Error Message                                |
622| -------- | ---------------------------------------- |
623| 201      | Permission denied.     |
624| 202      | Not system application to call the interface.                                      |
625| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
626| 1600001  | Internal error.                          |
627| 1600002  | Marshalling or unmarshalling error.      |
628| 1600003  | Failed to connect to the service.               |
629| 17700001 | The specified bundle name was not found. |
630
631**Example**
632
633```ts
634import { BusinessError } from '@kit.BasicServicesKit';
635
636let bundle: notificationManager.BundleOption = {
637    bundle: "bundleName1",
638};
639notificationManager.isNotificationEnabled(bundle).then((data: boolean) => {
640	console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
641}).catch((err: BusinessError) => {
642    console.error(`isNotificationEnabled fail: ${JSON.stringify(err)}`);
643});
644```
645
646## notificationManager.isNotificationEnabled
647
648isNotificationEnabled(userId: number, callback: AsyncCallback\<boolean\>): void
649
650Checks whether notification is enabled for a specified user. This API uses an asynchronous callback to return the result.
651
652**System capability**: SystemCapability.Notification.Notification
653
654**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
655
656**System API**: This is a system API.
657
658**Parameters**
659
660| Name    | Type                 | Mandatory| Description                    |
661| -------- | --------------------- | ---- | ------------------------ |
662| userId   | number                | Yes  | User ID.|
663| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result. The value **true** means that the notification is enabled, and **false** means the opposite.|
664
665**Error codes**
666
667For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
668
669| ID| Error Message                           |
670| -------- | ----------------------------------- |
671| 201      | Permission denied.     |
672| 202      | Not system application to call the interface.                                      |
673| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
674| 1600001  | Internal error.                     |
675| 1600002  | Marshalling or unmarshalling error. |
676| 1600003  | Failed to connect to the service.          |
677| 1600008  | The user does not exist.              |
678
679**Example**
680
681```ts
682import { BusinessError } from '@kit.BasicServicesKit';
683
684let isNotificationEnabledCallback = (err: BusinessError, data: boolean): void => {
685    if (err) {
686        console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
687    } else {
688        console.info(`isNotificationEnabled success, data is ${JSON.stringify(data)}`);
689    }
690}
691
692// Use the actual user ID when calling the API.
693let userId: number = 1;
694
695notificationManager.isNotificationEnabled(userId, isNotificationEnabledCallback);
696```
697
698## notificationManager.isNotificationEnabled
699
700isNotificationEnabled(userId: number): Promise\<boolean\>
701
702Checks whether notification is enabled for a specified user. This API uses a promise to return the result.
703
704**System capability**: SystemCapability.Notification.Notification
705
706**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
707
708**System API**: This is a system API.
709
710**Parameters**
711
712| Name  | Type        | Mandatory| Description      |
713| ------ | ------------ | ---- | ---------- |
714| userId | number       | Yes  | User ID.|
715
716**Return value**
717
718| Type                                                       | Description                                                        |
719| ----------------------------------------------------------- | ------------------------------------------------------------ |
720| Promise\<boolean\> | Promise used to return the result. The value **true** means that the notification is enabled, and **false** means the opposite.|
721
722**Error codes**
723
724For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
725
726| ID| Error Message                                |
727| -------- | ---------------------------------------- |
728| 201      | Permission denied.     |
729| 202      | Not system application to call the interface.                                      |
730| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
731| 1600001  | Internal error.                          |
732| 1600002  | Marshalling or unmarshalling error.      |
733| 1600003  | Failed to connect to the service.               |
734| 1600008  | The user does not exist.                  |
735
736**Example**
737
738```ts
739import { BusinessError } from '@kit.BasicServicesKit';
740
741// Use the actual user ID when calling the API.
742let userId: number = 1;
743
744notificationManager.isNotificationEnabled(userId).then((data: boolean) => {
745	console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
746}).catch((err: BusinessError) => {
747    console.error(`isNotificationEnabled fail: ${JSON.stringify(err)}`);
748});
749```
750
751## notificationManager.displayBadge
752
753displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void\>): void
754
755Sets whether to enable the notification badge for a specified application. This API uses an asynchronous callback to return the result.
756
757**System capability**: SystemCapability.Notification.Notification
758
759**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
760
761**System API**: This is a system API.
762
763**Parameters**
764
765| Name    | Type                 | Mandatory| Description                |
766| -------- | --------------------- | ---- | -------------------- |
767| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)          | Yes  | Bundle information of the application.          |
768| enable   | boolean               | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.            |
769| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
770
771**Error codes**
772
773For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
774
775| ID| Error Message                                |
776| -------- | ---------------------------------------- |
777| 201      | Permission denied.     |
778| 202      | Not system application to call the interface.                                      |
779| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
780| 1600001  | Internal error.                          |
781| 1600002  | Marshalling or unmarshalling error.      |
782| 1600003  | Failed to connect to the service.               |
783| 17700001 | The specified bundle name was not found. |
784
785**Example**
786
787```ts
788import { BusinessError } from '@kit.BasicServicesKit';
789
790let displayBadgeCallback = (err: BusinessError): void => {
791    if (err) {
792        console.error(`displayBadge failed, code is ${err.code}, message is ${err.message}`);
793    } else {
794        console.info("displayBadge success");
795    }
796}
797let bundle: notificationManager.BundleOption = {
798    bundle: "bundleName1",
799};
800notificationManager.displayBadge(bundle, false, displayBadgeCallback);
801```
802
803## notificationManager.displayBadge
804
805displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
806
807Sets whether to enable the notification badge for a specified application. This API uses a promise to return the result.
808
809**System capability**: SystemCapability.Notification.Notification
810
811**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
812
813**System API**: This is a system API.
814
815**Parameters**
816
817| Name  | Type        | Mandatory| Description      |
818| ------ | ------------ | ---- | ---------- |
819| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
820| enable | boolean      | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.  |
821
822**Return value**
823
824| Type     | Description       |
825|---------|-----------|
826| Promise\<void\> | Promise that returns no value.|
827
828**Error codes**
829
830For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
831
832| ID| Error Message                                |
833| -------- | ---------------------------------------- |
834| 201      | Permission denied.     |
835| 202      | Not system application to call the interface.                                      |
836| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
837| 1600001  | Internal error.                          |
838| 1600002  | Marshalling or unmarshalling error.      |
839| 1600003  | Failed to connect to the service.               |
840| 17700001 | The specified bundle name was not found. |
841
842**Example**
843
844```ts
845import { BusinessError } from '@kit.BasicServicesKit';
846
847let bundle: notificationManager.BundleOption = {
848    bundle: "bundleName1",
849};
850notificationManager.displayBadge(bundle, false).then(() => {
851	console.info("displayBadge success");
852}).catch((err: BusinessError) => {
853    console.error(`displayBadge fail: ${JSON.stringify(err)}`);
854});
855```
856
857## notificationManager.isBadgeDisplayed
858
859isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
860
861Checks whether the notification badge is enabled for a specified application. This API uses an asynchronous callback to return the result.
862
863**System capability**: SystemCapability.Notification.Notification
864
865**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
866
867**System API**: This is a system API.
868
869**Parameters**
870
871| Name    | Type                 | Mandatory| Description                    |
872| -------- | --------------------- | ---- | ------------------------ |
873| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)          | Yes  | Bundle information of the application.              |
874| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result. The value **true** means that the badge is enabled, and **false** means the opposite.|
875
876**Error codes**
877
878For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
879
880| ID| Error Message                                |
881| -------- | ---------------------------------------- |
882| 201      | Permission denied.     |
883| 202      | Not system application to call the interface.                                      |
884| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
885| 1600001  | Internal error.                          |
886| 1600002  | Marshalling or unmarshalling error.      |
887| 1600003  | Failed to connect to the service.               |
888| 17700001 | The specified bundle name was not found. |
889
890**Example**
891
892```ts
893import { BusinessError } from '@kit.BasicServicesKit';
894
895let isBadgeDisplayedCallback = (err: BusinessError, data: boolean): void => {
896    if (err) {
897        console.error(`isBadgeDisplayed failed, code is ${err.code}, message is ${err.message}`);
898    } else {
899        console.info(`isBadgeDisplayed success, data is ${JSON.stringify(data)}`);
900    }
901}
902let bundle: notificationManager.BundleOption = {
903    bundle: "bundleName1",
904};
905notificationManager.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
906```
907
908## notificationManager.isBadgeDisplayed
909
910isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
911
912Checks whether the notification badge is enabled for a specified application. This API uses a promise to return the result.
913
914**System capability**: SystemCapability.Notification.Notification
915
916**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
917
918**System API**: This is a system API.
919
920**Parameters**
921
922| Name  | Type        | Mandatory| Description      |
923| ------ | ------------ | ---- | ---------- |
924| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
925
926**Return value**
927
928| Type                                                       | Description                                                        |
929| ----------------------------------------------------------- | ------------------------------------------------------------ |
930| Promise\<boolean\> | Promise used to return the result. The value **true** means that the badge is enabled, and **false** means the opposite.|
931
932**Error codes**
933
934For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
935
936| ID| Error Message                                |
937| -------- | ---------------------------------------- |
938| 201      | Permission denied.     |
939| 202      | Not system application to call the interface.                                      |
940| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
941| 1600001  | Internal error.                          |
942| 1600002  | Marshalling or unmarshalling error.      |
943| 1600003  | Failed to connect to the service.               |
944| 17700001 | The specified bundle name was not found. |
945
946**Example**
947
948```ts
949import { BusinessError } from '@kit.BasicServicesKit';
950
951let bundle: notificationManager.BundleOption = {
952  bundle: "bundleName1",
953};
954
955notificationManager.isBadgeDisplayed(bundle).then((data: boolean) => {
956	console.info("isBadgeDisplayed success, data: " + JSON.stringify(data));
957}).catch((err: BusinessError) => {
958    console.error(`isBadgeDisplayed fail: ${JSON.stringify(err)}`);
959});
960```
961
962## notificationManager.setSlotFlagsByBundle<sup>11+</sup>
963
964setSlotFlagsByBundle(bundle: BundleOption, slotFlags: number): Promise\<void\>
965
966Sets the notification slot for a specified application. This API uses a promise to return the result.
967
968**System capability**: SystemCapability.Notification.Notification
969
970**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
971
972**System API**: This is a system API.
973
974**Parameters**
975
976| Name  | Type        | Mandatory| Description      |
977| ------ | ------------ | ---- | ---------- |
978| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
979| slotFlags   | number | Yes  | Notification slot flags.<br>- Bit 0: sound alert. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 1: locking the screen. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 2: banner. The value **0** means to disable the feature, and **1** means the opposite.<br>- BIt 3: turning on the screen. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 4: vibration. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 5: notification icon in the status bar. The value **0** means to disable the feature, and **1** means the opposite.|
980
981**Return value**
982
983| Type     | Description       |
984|---------|-----------|
985| Promise\<void\> | Promise that returns no value.|
986
987**Error codes**
988
989For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
990
991| ID| Error Message                                |
992| -------- | ---------------------------------------- |
993| 201      | Permission denied.     |
994| 202      | Not system application to call the interface.                                      |
995| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
996| 1600001  | Internal error.                          |
997| 1600002  | Marshalling or unmarshalling error.      |
998| 1600003  | Failed to connect to the service.               |
999| 17700001 | The specified bundle name was not found. |
1000
1001**Example**
1002
1003```ts
1004import { BusinessError } from '@kit.BasicServicesKit';
1005
1006let bundle: notificationManager.BundleOption = {
1007    bundle: "bundleName1",
1008};
1009
1010let slotFlags: number = 1;
1011
1012notificationManager.setSlotFlagsByBundle(bundle, slotFlags).then(() => {
1013	console.info("setSlotFlagsByBundle success");
1014}).catch((err: BusinessError) => {
1015    console.error(`setSlotFlagsByBundle fail: ${JSON.stringify(err)}`);
1016});
1017```
1018
1019## notificationManager.setSlotByBundle
1020
1021setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void\>): void
1022
1023Sets the notification slot for a specified application. This API uses an asynchronous callback to return the result.
1024
1025Before setting a notification slot, create a slot through [addSlot](#notificationmanageraddslot).
1026
1027**System capability**: SystemCapability.Notification.Notification
1028
1029**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1030
1031**System API**: This is a system API.
1032
1033**Parameters**
1034
1035| Name    | Type                 | Mandatory| Description                |
1036| -------- | --------------------- | ---- | -------------------- |
1037| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)          | Yes  | Bundle information of the application.          |
1038| slot     | [NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)      | Yes  | Notification slot.            |
1039| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
1040
1041**Error codes**
1042
1043For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1044
1045| ID| Error Message                                |
1046| -------- | ---------------------------------------- |
1047| 201      | Permission denied.     |
1048| 202      | Not system application to call the interface.                                      |
1049| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1050| 1600001  | Internal error.                          |
1051| 1600002  | Marshalling or unmarshalling error.      |
1052| 1600003  | Failed to connect to the service.               |
1053| 17700001 | The specified bundle name was not found. |
1054
1055**Example**
1056
1057```ts
1058import { BusinessError } from '@kit.BasicServicesKit';
1059
1060let setSlotByBundleCallback = (err: BusinessError): void => {
1061    if (err) {
1062        console.error(`setSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
1063    } else {
1064        console.info("setSlotByBundle success");
1065    }
1066}
1067let bundle: notificationManager.BundleOption = {
1068    bundle: "bundleName1",
1069};
1070let notificationSlot: notificationManager.NotificationSlot = {
1071    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
1072};
1073notificationManager.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
1074```
1075
1076## notificationManager.setSlotByBundle
1077
1078setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
1079
1080Sets the notification slot for a specified application. This API uses a promise to return the result.
1081
1082Before setting a notification slot, create a slot through [addSlot](#notificationmanageraddslot).
1083
1084**System capability**: SystemCapability.Notification.Notification
1085
1086**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1087
1088**System API**: This is a system API.
1089
1090**Parameters**
1091
1092| Name  | Type        | Mandatory| Description      |
1093| ------ | ------------ | ---- | ---------- |
1094| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
1095| slot   | [NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md) | Yes  | Notification slot.|
1096
1097**Return value**
1098
1099| Type     | Description       |
1100|---------|-----------|
1101| Promise\<void\> | Promise that returns no value.|
1102
1103**Error codes**
1104
1105For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1106
1107| ID| Error Message                                |
1108| -------- | ---------------------------------------- |
1109| 201      | Permission denied.     |
1110| 202      | Not system application to call the interface.                                      |
1111| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1112| 1600001  | Internal error.                          |
1113| 1600002  | Marshalling or unmarshalling error.      |
1114| 1600003  | Failed to connect to the service.               |
1115| 17700001 | The specified bundle name was not found. |
1116
1117**Example**
1118
1119```ts
1120import { BusinessError } from '@kit.BasicServicesKit';
1121
1122let bundle: notificationManager.BundleOption = {
1123    bundle: "bundleName1",
1124};
1125
1126let notificationSlot: notificationManager.NotificationSlot = {
1127    notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
1128};
1129
1130notificationManager.setSlotByBundle(bundle, notificationSlot).then(() => {
1131	console.info("setSlotByBundle success");
1132}).catch((err: BusinessError) => {
1133    console.error(`setSlotByBundle fail: ${JSON.stringify(err)}`);
1134});
1135```
1136
1137## notificationManager.getSlotFlagsByBundle<sup>11+</sup>
1138
1139getSlotFlagsByBundle(bundle: BundleOption): Promise\<number\>
1140
1141Obtains the notification slot flag of a specified application. This API uses a promise to return the result.
1142
1143**System capability**: SystemCapability.Notification.Notification
1144
1145**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1146
1147**System API**: This is a system API.
1148
1149**Parameters**
1150
1151| Name  | Type        | Mandatory| Description      |
1152| ------ | ------------ | ---- | ---------- |
1153| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
1154
1155**Return value**
1156
1157| Type                                                       | Description                                                        |
1158| ----------------------------------------------------------- | ------------------------------------------------------------ |
1159|  Promise\<number\>| Promise used to return the notification slot flag.<br>- Bit 0: sound alert. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 1: locking the screen. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 2: banner. The value **0** means to disable the feature, and **1** means the opposite.<br>- BIt 3: turning on the screen. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 4: vibration. The value **0** means to disable the feature, and **1** means the opposite.<br>- Bit 5: notification icon in the status bar. The value **0** means to disable the feature, and **1** means the opposite.|
1160
1161**Error codes**
1162
1163For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1164
1165| ID| Error Message                                |
1166| -------- | ---------------------------------------- |
1167| 201      | Permission denied.     |
1168| 202      | Not system application to call the interface.                                      |
1169| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1170| 1600001  | Internal error.                          |
1171| 1600002  | Marshalling or unmarshalling error.      |
1172| 1600003  | Failed to connect to the service.               |
1173| 17700001 | The specified bundle name was not found. |
1174
1175**Example**
1176
1177```ts
1178import { BusinessError } from '@kit.BasicServicesKit';
1179
1180let bundle: notificationManager.BundleOption = {
1181    bundle: "bundleName1",
1182};
1183notificationManager.getSlotFlagsByBundle(bundle).then((data : number) => {
1184	console.info("getSlotFlagsByBundle success, data: " + JSON.stringify(data));
1185}).catch((err: BusinessError) => {
1186    console.error(`getSlotFlagsByBundle fail: ${JSON.stringify(err)}`);
1187});
1188```
1189
1190## notificationManager.getSlotsByBundle
1191
1192getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\<Array\<NotificationSlot>>): void
1193
1194Obtains the notification slots of a specified application. This API uses an asynchronous callback to return the result.
1195
1196**System capability**: SystemCapability.Notification.Notification
1197
1198**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1199
1200**System API**: This is a system API.
1201
1202**Parameters**
1203
1204| Name    | Type                                    | Mandatory| Description                |
1205| -------- | ---------------------------------------- | ---- | -------------------- |
1206| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)                             | Yes  | Bundle information of the application.          |
1207| callback | AsyncCallback\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)>> | Yes  | Callback used to return the result.|
1208
1209**Error codes**
1210
1211For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1212
1213| ID| Error Message                                |
1214| -------- | ---------------------------------------- |
1215| 201      | Permission denied.     |
1216| 202      | Not system application to call the interface.                                      |
1217| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1218| 1600001  | Internal error.                          |
1219| 1600002  | Marshalling or unmarshalling error.      |
1220| 1600003  | Failed to connect to the service.               |
1221| 17700001 | The specified bundle name was not found. |
1222
1223**Example**
1224
1225```ts
1226import { BusinessError } from '@kit.BasicServicesKit';
1227
1228let getSlotsByBundleCallback = (err: BusinessError, data: Array<notificationManager.NotificationSlot>): void => {
1229    if (err) {
1230        console.error(`getSlotsByBundle failed, code is ${err.code}, message is ${err.message}`);
1231    } else {
1232        console.info(`getSlotsByBundle success, data is ${JSON.stringify(data)}`);
1233    }
1234}
1235let bundle: notificationManager.BundleOption = {
1236    bundle: "bundleName1",
1237};
1238notificationManager.getSlotsByBundle(bundle, getSlotsByBundleCallback);
1239```
1240
1241## notificationManager.getSlotsByBundle
1242
1243getSlotsByBundle(bundle: BundleOption): Promise\<Array\<NotificationSlot>>
1244
1245Obtains the notification slots of a specified application. This API uses a promise to return the result.
1246
1247**System capability**: SystemCapability.Notification.Notification
1248
1249**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1250
1251**System API**: This is a system API.
1252
1253**Parameters**
1254
1255| Name  | Type        | Mandatory| Description      |
1256| ------ | ------------ | ---- | ---------- |
1257| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
1258
1259**Return value**
1260
1261| Type                                                       | Description                                                        |
1262| ----------------------------------------------------------- | ------------------------------------------------------------ |
1263| Promise\<Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)>> | Promise used to return the result.|
1264
1265**Error codes**
1266
1267For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1268
1269| ID| Error Message                                |
1270| -------- | ---------------------------------------- |
1271| 201      | Permission denied.     |
1272| 202      | Not system application to call the interface.                                      |
1273| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1274| 1600001  | Internal error.                          |
1275| 1600002  | Marshalling or unmarshalling error.      |
1276| 1600003  | Failed to connect to the service.               |
1277| 17700001 | The specified bundle name was not found. |
1278
1279**Example**
1280
1281```ts
1282import { BusinessError } from '@kit.BasicServicesKit';
1283
1284let bundle: notificationManager.BundleOption = {
1285    bundle: "bundleName1",
1286};
1287
1288notificationManager.getSlotsByBundle(bundle).then((data: Array<notificationManager.NotificationSlot>) => {
1289	console.info("getSlotsByBundle success, data: " + JSON.stringify(data));
1290}).catch((err: BusinessError) => {
1291    console.error(`getSlotsByBundle fail: ${JSON.stringify(err)}`);
1292});
1293```
1294
1295## notificationManager.getSlotNumByBundle
1296
1297getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): void
1298
1299Obtains the number of notification slots of a specified application. This API uses an asynchronous callback to return the result.
1300
1301**System capability**: SystemCapability.Notification.Notification
1302
1303**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1304
1305**System API**: This is a system API.
1306
1307**Parameters**
1308
1309| Name    | Type                     | Mandatory| Description                  |
1310| -------- | ------------------------- | ---- | ---------------------- |
1311| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)              | Yes  | Bundle information of the application.            |
1312| callback | AsyncCallback\<number\> | Yes  | Callback used to return the result.|
1313
1314**Error codes**
1315
1316For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1317
1318| ID| Error Message                                |
1319| -------- | ---------------------------------------- |
1320| 201      | Permission denied.     |
1321| 202      | Not system application to call the interface.                                      |
1322| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1323| 1600001  | Internal error.                          |
1324| 1600002  | Marshalling or unmarshalling error.      |
1325| 1600003  | Failed to connect to the service.               |
1326| 17700001 | The specified bundle name was not found. |
1327
1328**Example**
1329
1330```ts
1331import { BusinessError } from '@kit.BasicServicesKit';
1332
1333let getSlotNumByBundleCallback = (err: BusinessError, data: number): void => {
1334    if (err) {
1335        console.error(`getSlotNumByBundle failed, code is ${err.code}, message is ${err.message}`);
1336    } else {
1337        console.info(`getSlotNumByBundle success data is ${JSON.stringify(data)}`);
1338    }
1339}
1340
1341let bundle: notificationManager.BundleOption = {
1342  bundle: "bundleName1",
1343};
1344
1345notificationManager.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
1346```
1347
1348## notificationManager.getSlotNumByBundle
1349
1350getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
1351
1352Obtains the number of notification slots of a specified application. This API uses a promise to return the result.
1353
1354**System capability**: SystemCapability.Notification.Notification
1355
1356**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1357
1358**System API**: This is a system API.
1359
1360**Parameters**
1361
1362| Name  | Type        | Mandatory| Description      |
1363| ------ | ------------ | ---- | ---------- |
1364| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
1365
1366**Return value**
1367
1368| Type                                                       | Description                                                        |
1369| ----------------------------------------------------------- | ------------------------------------------------------------ |
1370| Promise\<number\> | Promise used to return the result.|
1371
1372**Error codes**
1373
1374For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1375
1376| ID| Error Message                                |
1377| -------- | ---------------------------------------- |
1378| 201      | Permission denied.     |
1379| 202      | Not system application to call the interface.                                      |
1380| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1381| 1600001  | Internal error.                          |
1382| 1600002  | Marshalling or unmarshalling error.      |
1383| 1600003  | Failed to connect to the service.               |
1384| 17700001 | The specified bundle name was not found. |
1385
1386**Example**
1387
1388```ts
1389import { BusinessError } from '@kit.BasicServicesKit';
1390
1391let bundle: notificationManager.BundleOption = {
1392  bundle: "bundleName1",
1393};
1394
1395notificationManager.getSlotNumByBundle(bundle).then((data: number) => {
1396	console.info("getSlotNumByBundle success, data: " + JSON.stringify(data));
1397}).catch((err: BusinessError) => {
1398    console.error(`getSlotNumByBundle fail: ${JSON.stringify(err)}`);
1399});
1400```
1401
1402
1403## notificationManager.getAllActiveNotifications
1404
1405getAllActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void
1406
1407Obtains all active notifications. This API uses an asynchronous callback to return the result.
1408
1409**System capability**: SystemCapability.Notification.Notification
1410
1411**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1412
1413**System API**: This is a system API.
1414
1415**Parameters**
1416
1417| Name    | Type                                                        | Mandatory| Description                |
1418| -------- | ------------------------------------------------------------ | ---- | -------------------- |
1419| callback | AsyncCallback\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest)>> | Yes  | Callback used to return the result.|
1420
1421**Error codes**
1422
1423For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1424
1425| ID| Error Message                           |
1426| -------- | ----------------------------------- |
1427| 201      | Permission denied.     |
1428| 202      | Not system application to call the interface.                                      |
1429| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1430| 1600001  | Internal error.                     |
1431| 1600002  | Marshalling or unmarshalling error. |
1432| 1600003  | Failed to connect to the service.          |
1433
1434**Example**
1435
1436```ts
1437import { BusinessError } from '@kit.BasicServicesKit';
1438
1439let getAllActiveNotificationsCallback = (err: BusinessError, data: Array<notificationManager.NotificationRequest>): void => {
1440    if (err) {
1441        console.error(`getAllActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
1442    } else {
1443        console.info(`getAllActiveNotifications success, data is ${JSON.stringify(data)}`);
1444    }
1445}
1446
1447notificationManager.getAllActiveNotifications(getAllActiveNotificationsCallback);
1448```
1449
1450## notificationManager.getAllActiveNotifications
1451
1452getAllActiveNotifications(): Promise\<Array\<NotificationRequest\>\>
1453
1454Obtains all active notifications. This API uses a promise to return the result.
1455
1456**System capability**: SystemCapability.Notification.Notification
1457
1458**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1459
1460**System API**: This is a system API.
1461
1462**Return value**
1463
1464| Type                                                       | Description                                                        |
1465| ----------------------------------------------------------- | ------------------------------------------------------------ |
1466| Promise\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest)\>\> | Promise used to return the result.|
1467
1468**Error codes**
1469
1470For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1471
1472| ID| Error Message                           |
1473| -------- | ----------------------------------- |
1474| 201      | Permission denied.     |
1475| 202      | Not system application to call the interface.                                      |
1476| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1477| 1600001  | Internal error.                     |
1478| 1600002  | Marshalling or unmarshalling error. |
1479| 1600003  | Failed to connect to the service.          |
1480
1481**Example**
1482
1483```ts
1484import { BusinessError } from '@kit.BasicServicesKit';
1485
1486notificationManager.getAllActiveNotifications().then((data: Array<notificationManager.NotificationRequest>) => {
1487	console.info("getAllActiveNotifications success, data: " + JSON.stringify(data));
1488}).catch((err: BusinessError) => {
1489    console.error(`getAllActiveNotifications fail: ${JSON.stringify(err)}`);
1490});
1491```
1492
1493## notificationManager.getActiveNotificationByFilter<sup>11+</sup>
1494
1495getActiveNotificationByFilter(filter: NotificationFilter, callback: AsyncCallback\<NotificationRequest\>): void
1496
1497Obtains information about the common live view that matches the specified filter criteria. This API uses an asynchronous callback to return the result.
1498
1499**System capability**: SystemCapability.Notification.Notification
1500
1501**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1502
1503**System API**: This is a system API.
1504
1505
1506**Parameters**
1507
1508| Name    | Type                                                        | Mandatory| Description                          |
1509| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
1510| filter   | [NotificationFilter](js-apis-inner-notification-notificationRequest-sys.md#notificationfilter11) | Yes  | Filter criteria for querying the common live view.|
1511| callback | AsyncCallback\<Array\<[NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest)>> | Yes  | Callback used to return the result.|
1512
1513**Error codes**
1514
1515For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1516
1517| ID| Error Message                                 |
1518| -------- | ---------------------------------------- |
1519| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1520| 1600007  | The notification does not exist.           |
1521| 17700001 | The specified bundle name was not found. |
1522
1523**Example**
1524
1525```ts
1526import { BusinessError } from '@kit.BasicServicesKit';
1527import { notificationSubscribe } from '@kit.NotificationKit';
1528
1529let bundleOption: notificationManager.BundleOption = {
1530  bundle: "bundleName1",
1531};
1532let notificationKey: notificationSubscribe.NotificationKey = {
1533    id: 11,
1534    label: ""
1535};
1536let filter: notificationManager.NotificationFilter = {
1537    bundle: bundleOption,
1538    notificationKey: notificationKey,
1539    extraInfoKeys: ['event']
1540}
1541let getActiveNotificationByFilterCallback = (err: BusinessError, data: notificationManager.NotificationRequest): void => {
1542    if (err) {
1543        console.error(`getActiveNotificationByFilter failed, code is ${err.code}, message is ${err.message}`);
1544    } else {
1545        console.info("getActiveNotificationByFilter success");
1546    }
1547}
1548notificationManager.getActiveNotificationByFilter(filter, getActiveNotificationByFilterCallback);
1549```
1550
1551## notificationManager.getActiveNotificationByFilter<sup>11+</sup>
1552
1553getActiveNotificationByFilter(filter: NotificationFilter): Promise\<NotificationRequest\>
1554
1555Obtains information about the common live view that matches the specified filter criteria. This API uses a promise to return the result.
1556
1557**System capability**: SystemCapability.Notification.Notification
1558
1559**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1560
1561**System API**: This is a system API.
1562
1563
1564**Parameters**
1565
1566| Name    | Type                                                        | Mandatory| Description                          |
1567| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
1568| filter   | [NotificationFilter](js-apis-inner-notification-notificationRequest-sys.md#notificationfilter11) | Yes  | Filter criteria for querying the common live view.|
1569
1570**Return value**
1571
1572| Type                                                        | Description                                   |
1573| ------------------------------------------------------------ | --------------------------------------- |
1574| Promise\<[NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest)\> | Promise used to return the result.|
1575
1576**Error codes**
1577
1578For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1579
1580| ID| Error Message                                 |
1581| -------- | ---------------------------------------- |
1582| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1583| 1600007  | The notification does not exist.         |
1584| 17700001 | The specified bundle name was not found. |
1585
1586**Example**
1587
1588```ts
1589import { BusinessError } from '@kit.BasicServicesKit';
1590import { notificationSubscribe } from '@kit.NotificationKit';
1591
1592let bundleOption: notificationManager.BundleOption = {
1593  bundle: "bundleName1",
1594};
1595let notificationKey: notificationSubscribe.NotificationKey = {
1596    id: 11,
1597    label: ""
1598};
1599let filter: notificationManager.NotificationFilter = {
1600    bundle: bundleOption,
1601    notificationKey: notificationKey,
1602    extraInfoKeys: ['event']
1603}
1604notificationManager.getActiveNotificationByFilter(filter).then((data: notificationManager.NotificationRequest) => {
1605	console.info("getActiveNotificationByFilter success, data: " + JSON.stringify(data));
1606}).catch((err: BusinessError) => {
1607    console.error(`getActiveNotificationByFilter fail: ${JSON.stringify(err)}`);
1608});
1609```
1610
1611## notificationManager.removeGroupByBundle
1612
1613removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void\>): void
1614
1615Removes notifications under a notification group of the specified application. This API uses an asynchronous callback to return the result.
1616
1617**System capability**: SystemCapability.Notification.Notification
1618
1619**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1620
1621**System API**: This is a system API.
1622
1623**Parameters**
1624
1625| Name     | Type                 | Mandatory| Description                        |
1626| --------- | --------------------- | ---- | ---------------------------- |
1627| bundle    | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)          | Yes  | Bundle information of the application.                  |
1628| groupName | string                | Yes  | Name of the notification group.              |
1629| callback  | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
1630
1631**Error codes**
1632
1633For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1634
1635| ID| Error Message                                |
1636| -------- | ---------------------------------------- |
1637| 201      | Permission denied.     |
1638| 202      | Not system application to call the interface.                                      |
1639| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1640| 1600001  | Internal error.                          |
1641| 1600002  | Marshalling or unmarshalling error.      |
1642| 1600003  | Failed to connect to the service.               |
1643| 17700001 | The specified bundle name was not found. |
1644
1645**Example**
1646
1647```ts
1648import { BusinessError } from '@kit.BasicServicesKit';
1649
1650let removeGroupByBundleCallback = (err: BusinessError): void => {
1651    if (err) {
1652        console.error(`removeGroupByBundle failed, code is ${err.code}, message is ${err.message}`);
1653    } else {
1654        console.info("removeGroupByBundle success");
1655    }
1656}
1657
1658let bundleOption: notificationManager.BundleOption = { bundle: "Bundle" };
1659let groupName: string = "GroupName";
1660
1661notificationManager.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback);
1662```
1663
1664## notificationManager.removeGroupByBundle
1665
1666removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
1667
1668Removes notifications under a notification group of the specified application. This API uses a promise to return the result.
1669
1670**System capability**: SystemCapability.Notification.Notification
1671
1672**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1673
1674**System API**: This is a system API.
1675
1676**Parameters**
1677
1678| Name     | Type        | Mandatory| Description          |
1679| --------- | ------------ | ---- | -------------- |
1680| bundle    | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.    |
1681| groupName | string       | Yes  | Name of the notification group.|
1682
1683**Return value**
1684
1685| Type     | Description       |
1686|---------|-----------|
1687| Promise\<void\> | Promise that returns no value.|
1688
1689**Error codes**
1690
1691For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1692
1693| ID| Error Message                                |
1694| -------- | ---------------------------------------- |
1695| 201      | Permission denied.     |
1696| 202      | Not system application to call the interface.                                      |
1697| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1698| 1600001  | Internal error.                          |
1699| 1600002  | Marshalling or unmarshalling error.      |
1700| 1600003  | Failed to connect to the service.               |
1701| 17700001 | The specified bundle name was not found. |
1702
1703**Example**
1704
1705```ts
1706import { BusinessError } from '@kit.BasicServicesKit';
1707
1708let bundleOption: notificationManager.BundleOption = { bundle: "Bundle" };
1709let groupName: string = "GroupName";
1710
1711notificationManager.removeGroupByBundle(bundleOption, groupName).then(() => {
1712	console.info("removeGroupByBundle success");
1713}).catch((err: BusinessError) => {
1714    console.error(`removeGroupByBundle fail: ${JSON.stringify(err)}`);
1715});
1716```
1717
1718## notificationManager.setDoNotDisturbDate
1719
1720setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): void
1721
1722Sets the DND time. This API uses an asynchronous callback to return the result.
1723
1724**System capability**: SystemCapability.Notification.Notification
1725
1726**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1727
1728**System API**: This is a system API.
1729
1730**Parameters**
1731
1732| Name    | Type                 | Mandatory| Description                  |
1733| -------- | --------------------- | ---- | ---------------------- |
1734| date     | [DoNotDisturbDate](#donotdisturbdate)      | Yes  | DND time to set.        |
1735| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
1736
1737**Error codes**
1738
1739For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1740
1741| ID| Error Message                           |
1742| -------- | ----------------------------------- |
1743| 201      | Permission denied.     |
1744| 202      | Not system application to call the interface.                                      |
1745| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1746| 1600001  | Internal error.                     |
1747| 1600002  | Marshalling or unmarshalling error. |
1748| 1600003  | Failed to connect to the service.          |
1749| 1600012  | No memory space.                          |
1750
1751**Example**
1752
1753```ts
1754import { BusinessError } from '@kit.BasicServicesKit';
1755
1756let setDoNotDisturbDateCallback = (err: BusinessError): void => {
1757    if (err) {
1758        console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
1759    } else {
1760        console.info("setDoNotDisturbDate success");
1761    }
1762}
1763
1764let doNotDisturbDate: notificationManager.DoNotDisturbDate = {
1765    type: notificationManager.DoNotDisturbType.TYPE_ONCE,
1766    begin: new Date(),
1767    end: new Date(2021, 11, 15, 18, 0)
1768};
1769
1770notificationManager.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
1771```
1772
1773## notificationManager.setDoNotDisturbDate
1774
1775setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
1776
1777Sets the DND time. This API uses a promise to return the result.
1778
1779**System capability**: SystemCapability.Notification.Notification
1780
1781**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1782
1783**System API**: This is a system API.
1784
1785**Parameters**
1786
1787| Name| Type            | Mandatory| Description          |
1788| ---- | ---------------- | ---- | -------------- |
1789| date | [DoNotDisturbDate](#donotdisturbdate) | Yes  | DND time to set.|
1790
1791
1792**Return value**
1793
1794| Type     | Description       |
1795|---------|-----------|
1796| Promise\<void\> | Promise that returns no value.|
1797
1798**Error codes**
1799
1800For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1801
1802| ID| Error Message                           |
1803| -------- | ----------------------------------- |
1804| 201      | Permission denied.     |
1805| 202      | Not system application to call the interface.                                      |
1806| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1807| 1600001  | Internal error.                     |
1808| 1600002  | Marshalling or unmarshalling error. |
1809| 1600003  | Failed to connect to the service.          |
1810| 1600012  | No memory space.                          |
1811
1812**Example**
1813
1814```ts
1815import { BusinessError } from '@kit.BasicServicesKit';
1816
1817let doNotDisturbDate: notificationManager.DoNotDisturbDate = {
1818    type: notificationManager.DoNotDisturbType.TYPE_ONCE,
1819    begin: new Date(),
1820    end: new Date(2021, 11, 15, 18, 0)
1821};
1822notificationManager.setDoNotDisturbDate(doNotDisturbDate).then(() => {
1823	console.info("setDoNotDisturbDate success");
1824}).catch((err: BusinessError) => {
1825    console.error(`setDoNotDisturbDate fail: ${JSON.stringify(err)}`);
1826});
1827```
1828
1829
1830## notificationManager.setDoNotDisturbDate
1831
1832setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback\<void\>): void
1833
1834Sets the DND time for a specified user. This API uses an asynchronous callback to return the result.
1835
1836**System capability**: SystemCapability.Notification.Notification
1837
1838**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1839
1840**System API**: This is a system API.
1841
1842**Parameters**
1843
1844| Name    | Type                 | Mandatory| Description                  |
1845| -------- | --------------------- | ---- | ---------------------- |
1846| date     | [DoNotDisturbDate](#donotdisturbdate)      | Yes  | DND time to set.        |
1847| userId   | number                | Yes  | ID of the user for whom you want to set the DND time.|
1848| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
1849
1850**Error codes**
1851
1852For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1853
1854| ID| Error Message                           |
1855| -------- | ----------------------------------- |
1856| 201      | Permission denied.     |
1857| 202      | Not system application to call the interface.                                      |
1858| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1859| 1600001  | Internal error.                     |
1860| 1600002  | Marshalling or unmarshalling error. |
1861| 1600003  | Failed to connect to the service.          |
1862| 1600008  | The user does not exist.              |
1863| 1600012  | No memory space.                          |
1864
1865**Example**
1866
1867```ts
1868import { BusinessError } from '@kit.BasicServicesKit';
1869
1870let setDoNotDisturbDateCallback = (err: BusinessError): void => {
1871    if (err) {
1872        console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
1873    } else {
1874        console.info("setDoNotDisturbDate success");
1875    }
1876}
1877
1878let doNotDisturbDate: notificationManager.DoNotDisturbDate = {
1879    type: notificationManager.DoNotDisturbType.TYPE_ONCE,
1880    begin: new Date(),
1881    end: new Date(2021, 11, 15, 18, 0)
1882};
1883
1884// Use the actual user ID when calling the API.
1885let userId: number = 1;
1886
1887notificationManager.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback);
1888```
1889
1890## notificationManager.setDoNotDisturbDate
1891
1892setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
1893
1894Sets the DND time for a specified user. This API uses a promise to return the result.
1895
1896**System capability**: SystemCapability.Notification.Notification
1897
1898**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1899
1900**System API**: This is a system API.
1901
1902**Parameters**
1903
1904| Name  | Type            | Mandatory| Description          |
1905| ------ | ---------------- | ---- | -------------- |
1906| date   | [DoNotDisturbDate](#donotdisturbdate) | Yes  | DND time to set.|
1907| userId | number           | Yes  | ID of the user for whom you want to set the DND time.|
1908
1909**Return value**
1910
1911| Type     | Description       |
1912|---------|-----------|
1913| Promise\<void\> | Promise that returns no value.|
1914
1915**Error codes**
1916
1917For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1918
1919| ID| Error Message                           |
1920| -------- | ----------------------------------- |
1921| 201      | Permission denied.     |
1922| 202      | Not system application to call the interface.                                      |
1923| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1924| 1600001  | Internal error.                     |
1925| 1600002  | Marshalling or unmarshalling error. |
1926| 1600003  | Failed to connect to the service.          |
1927| 1600008  | The user does not exist.              |
1928| 1600012  | No memory space.                          |
1929
1930**Example**
1931
1932```ts
1933import { BusinessError } from '@kit.BasicServicesKit';
1934
1935let doNotDisturbDate: notificationManager.DoNotDisturbDate = {
1936    type: notificationManager.DoNotDisturbType.TYPE_ONCE,
1937    begin: new Date(),
1938    end: new Date(2021, 11, 15, 18, 0)
1939};
1940
1941// Use the actual user ID when calling the API.
1942let userId: number = 1;
1943
1944notificationManager.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
1945	console.info("setDoNotDisturbDate success");
1946}).catch((err: BusinessError) => {
1947    console.error(`setDoNotDisturbDate fail: ${JSON.stringify(err)}`);
1948});
1949```
1950
1951
1952## notificationManager.getDoNotDisturbDate
1953
1954getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
1955
1956Obtains the DND time. This API uses an asynchronous callback to return the result.
1957
1958**System capability**: SystemCapability.Notification.Notification
1959
1960**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
1961
1962**System API**: This is a system API.
1963
1964**Parameters**
1965
1966| Name    | Type                             | Mandatory| Description                  |
1967| -------- | --------------------------------- | ---- | ---------------------- |
1968| callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | Yes  | Callback used to return the result.|
1969
1970**Error codes**
1971
1972For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
1973
1974| ID| Error Message                           |
1975| -------- | ----------------------------------- |
1976| 201      | Permission denied.     |
1977| 202      | Not system application to call the interface.                                      |
1978| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
1979| 1600001  | Internal error.                     |
1980| 1600002  | Marshalling or unmarshalling error. |
1981| 1600003  | Failed to connect to the service.          |
1982| 1600012  | No memory space.                          |
1983
1984**Example**
1985
1986```ts
1987import { BusinessError } from '@kit.BasicServicesKit';
1988
1989let getDoNotDisturbDateCallback = (err: BusinessError, data: notificationManager.DoNotDisturbDate): void => {
1990    if (err) {
1991        console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
1992    } else {
1993        console.info(`getDoNotDisturbDate success, data is ${JSON.stringify(data)}`);
1994    }
1995}
1996
1997notificationManager.getDoNotDisturbDate(getDoNotDisturbDateCallback);
1998```
1999
2000## notificationManager.getDoNotDisturbDate
2001
2002getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
2003
2004Obtains the DND time. This API uses a promise to return the result.
2005
2006**System capability**: SystemCapability.Notification.Notification
2007
2008**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2009
2010**System API**: This is a system API.
2011
2012**Return value**
2013
2014| Type                                            | Description                                     |
2015| ------------------------------------------------ | ----------------------------------------- |
2016| Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | Promise used to return the result.|
2017
2018**Error codes**
2019
2020For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2021
2022| ID| Error Message                           |
2023| -------- | ----------------------------------- |
2024| 201      | Permission denied.     |
2025| 202      | Not system application to call the interface.                                      |
2026| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2027| 1600001  | Internal error.                     |
2028| 1600002  | Marshalling or unmarshalling error. |
2029| 1600003  | Failed to connect to the service.          |
2030| 1600012  | No memory space.                          |
2031
2032**Example**
2033
2034```ts
2035import { BusinessError } from '@kit.BasicServicesKit';
2036
2037notificationManager.getDoNotDisturbDate().then((data: notificationManager.DoNotDisturbDate) => {
2038  console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data));
2039}).catch((err: BusinessError) => {
2040    console.error(`getDoNotDisturbDate fail: ${JSON.stringify(err)}`);
2041});
2042```
2043
2044
2045## notificationManager.getDoNotDisturbDate
2046
2047getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>): void
2048
2049Obtains the DND time of a specified user. This API uses an asynchronous callback to return the result.
2050
2051**System capability**: SystemCapability.Notification.Notification
2052
2053**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2054
2055**System API**: This is a system API.
2056
2057**Parameters**
2058
2059| Name    | Type                             | Mandatory| Description                  |
2060| -------- | --------------------------------- | ---- | ---------------------- |
2061| callback | AsyncCallback\<[DoNotDisturbDate](#donotdisturbdate)\> | Yes  | Callback used to return the result.|
2062| userId   | number                            | Yes  | User ID.|
2063
2064**Error codes**
2065
2066For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2067
2068| ID| Error Message                           |
2069| -------- | ----------------------------------- |
2070| 201      | Permission denied.     |
2071| 202      | Not system application to call the interface.                                      |
2072| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2073| 1600001  | Internal error.                     |
2074| 1600002  | Marshalling or unmarshalling error. |
2075| 1600003  | Failed to connect to the service.          |
2076| 1600008  | The user does not exist.              |
2077| 1600012  | No memory space.                          |
2078
2079**Example**
2080
2081```ts
2082import { BusinessError } from '@kit.BasicServicesKit';
2083
2084let getDoNotDisturbDateCallback = (err: BusinessError, data: notificationManager.DoNotDisturbDate): void => {
2085    if (err) {
2086        console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
2087    } else {
2088        console.info(`getDoNotDisturbDate success, data is ${JSON.stringify(data)}`);
2089    }
2090}
2091
2092// Use the actual user ID when calling the API.
2093let userId: number = 1;
2094
2095notificationManager.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
2096```
2097
2098## notificationManager.getDoNotDisturbDate
2099
2100getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
2101
2102Obtains the DND time of a specified user. This API uses a promise to return the result.
2103
2104**System capability**: SystemCapability.Notification.Notification
2105
2106**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2107
2108**System API**: This is a system API.
2109
2110**Parameters**
2111
2112| Name    | Type                             | Mandatory| Description                  |
2113| -------- | --------------------------------- | ---- | ---------------------- |
2114| userId   | number                            | Yes  | User ID.|
2115
2116**Return value**
2117
2118| Type                                            | Description                                     |
2119| ------------------------------------------------ | ----------------------------------------- |
2120| Promise\<[DoNotDisturbDate](#donotdisturbdate)\> | Promise used to return the result.|
2121
2122**Error codes**
2123
2124For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2125
2126| ID| Error Message                           |
2127| -------- | ----------------------------------- |
2128| 201      | Permission denied.     |
2129| 202      | Not system application to call the interface.                                      |
2130| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2131| 1600001  | Internal error.                     |
2132| 1600002  | Marshalling or unmarshalling error. |
2133| 1600003  | Failed to connect to the service.          |
2134| 1600008  | The user does not exist.              |
2135| 1600012  | No memory space.                          |
2136
2137**Example**
2138
2139```ts
2140import { BusinessError } from '@kit.BasicServicesKit';
2141
2142// Use the actual user ID when calling the API.
2143let userId: number = 1;
2144
2145notificationManager.getDoNotDisturbDate(userId).then((data: notificationManager.DoNotDisturbDate) => {
2146	console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data));
2147}).catch((err: BusinessError) => {
2148    console.error(`getDoNotDisturbDate fail: ${JSON.stringify(err)}`);
2149});
2150```
2151
2152
2153## notificationManager.isSupportDoNotDisturbMode
2154
2155 isSupportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
2156
2157Checks whether DND mode is supported. This API uses an asynchronous callback to return the result.
2158
2159**System capability**: SystemCapability.Notification.Notification
2160
2161**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2162
2163**System API**: This is a system API.
2164
2165**Parameters**
2166
2167| Name    | Type                    | Mandatory| Description                            |
2168| -------- | ------------------------ | ---- | -------------------------------- |
2169| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result. The value **true** means that DND mode is supported, and **false** means the opposite.|
2170
2171**Error codes**
2172
2173For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2174
2175| ID| Error Message                            |
2176| -------- | ----------------------------------- |
2177| 201      | Permission denied.     |
2178| 202      | Not system application to call the interface.                                      |
2179| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2180| 1600001  | Internal error.                     |
2181| 1600002  | Marshalling or unmarshalling error. |
2182| 1600003  | Failed to connect to the service.          |
2183
2184**Example**
2185
2186```ts
2187import { BusinessError } from '@kit.BasicServicesKit';
2188
2189let isSupportDoNotDisturbModeCallback = (err: BusinessError, data: boolean): void => {
2190    if (err) {
2191        console.error(`isSupportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`);
2192    } else {
2193        console.info("isSupportDoNotDisturbMode success, data: " + JSON.stringify(data));
2194    }
2195}
2196
2197notificationManager.isSupportDoNotDisturbMode(isSupportDoNotDisturbModeCallback);
2198```
2199
2200## notificationManager.isSupportDoNotDisturbMode
2201
2202isSupportDoNotDisturbMode(): Promise\<boolean\>
2203
2204Checks whether DND mode is supported. This API uses a promise to return the result.
2205
2206**System capability**: SystemCapability.Notification.Notification
2207
2208**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2209
2210**System API**: This is a system API.
2211
2212**Return value**
2213
2214| Type                                                       | Description                                                        |
2215| ----------------------------------------------------------- | ------------------------------------------------------------ |
2216| Promise\<boolean\> | Promise used to return the result. The value **true** means that DND mode is supported, and **false** means the opposite.|
2217
2218**Error codes**
2219
2220For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2221
2222| ID| Error Message                           |
2223| -------- | ----------------------------------- |
2224| 201      | Permission denied.     |
2225| 202      | Not system application to call the interface.                                      |
2226| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2227| 1600001  | Internal error.                     |
2228| 1600002  | Marshalling or unmarshalling error. |
2229| 1600003  | Failed to connect to the service.          |
2230
2231**Example**
2232
2233```ts
2234import { BusinessError } from '@kit.BasicServicesKit';
2235
2236notificationManager.isSupportDoNotDisturbMode().then((data: boolean) => {
2237	console.info("isSupportDoNotDisturbMode success, data: " + JSON.stringify(data));
2238}).catch((err: BusinessError) => {
2239    console.error(`isSupportDoNotDisturbMode fail: ${JSON.stringify(err)}`);
2240});
2241```
2242
2243## notificationManager.setDistributedEnable
2244
2245setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void
2246
2247Sets whether to enable distributed notification on this device. This API uses an asynchronous callback to return the result.
2248
2249**System capability**: SystemCapability.Notification.Notification
2250
2251**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2252
2253**System API**: This is a system API.
2254
2255**Parameters**
2256
2257| Name  | Type                    | Mandatory| Description                      |
2258| -------- | ------------------------ | ---- | -------------------------- |
2259| enable   | boolean                  | Yes  | Whether to enable distributed notification. The value **true** means to enable distributed notification, and **false** means the opposite.|
2260| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
2261
2262**Error codes**
2263
2264For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2265
2266| ID| Error Message                           |
2267| -------- | ----------------------------------- |
2268| 201      | Permission denied.     |
2269| 202      | Not system application to call the interface.                                      |
2270| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2271| 1600001  | Internal error.                     |
2272| 1600002  | Marshalling or unmarshalling error. |
2273| 1600003  | Failed to connect to the service.          |
2274| 1600010  | Distributed operation failed.       |
2275
2276**Example**
2277
2278```ts
2279import { BusinessError } from '@kit.BasicServicesKit';
2280
2281let setDistributedEnableCallback = (err: BusinessError): void => {
2282    if (err) {
2283        console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`);
2284    } else {
2285        console.info("setDistributedEnable success");
2286    }
2287};
2288let enable: boolean = true;
2289notificationManager.setDistributedEnable(enable, setDistributedEnableCallback);
2290```
2291
2292## notificationManager.setDistributedEnable
2293
2294setDistributedEnable(enable: boolean): Promise\<void>
2295
2296Sets whether to enable distributed notification on this device. This API uses a promise to return the result.
2297
2298**System capability**: SystemCapability.Notification.Notification
2299
2300**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2301
2302**System API**: This is a system API.
2303
2304**Parameters**
2305
2306| Name  | Type                    | Mandatory| Description                      |
2307| -------- | ------------------------ | ---- | -------------------------- |
2308| enable   | boolean                  | Yes  | Whether to enable distributed notification. The value **true** means to enable distributed notification, and **false** means the opposite.|
2309
2310**Return value**
2311
2312| Type             | Description       |
2313|-----------------|-----------|
2314| Promise\<void\> | Promise that returns no value.|
2315
2316**Error codes**
2317
2318For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2319
2320| ID| Error Message                           |
2321| -------- | ----------------------------------- |
2322| 201      | Permission denied.     |
2323| 202      | Not system application to call the interface.                                      |
2324| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2325| 1600001  | Internal error.                     |
2326| 1600002  | Marshalling or unmarshalling error. |
2327| 1600003  | Failed to connect to the service.          |
2328| 1600010  | Distributed operation failed.       |
2329
2330**Example**
2331
2332```ts
2333import { BusinessError } from '@kit.BasicServicesKit';
2334
2335let enable: boolean = true;
2336notificationManager.setDistributedEnable(enable).then(() => {
2337    console.info("setDistributedEnable success");
2338}).catch((err: BusinessError) => {
2339    console.error(`setDistributedEnable fail: ${JSON.stringify(err)}`);
2340});
2341```
2342
2343## notificationManager.setDistributedEnableByBundle
2344
2345setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void
2346
2347Sets whether to enable distributed notification for a specified application. This API uses an asynchronous callback to return the result.
2348
2349**System capability**: SystemCapability.Notification.Notification
2350
2351**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2352
2353**System API**: This is a system API.
2354
2355**Parameters**
2356
2357| Name  | Type                    | Mandatory| Description                      |
2358| -------- | ------------------------ | ---- | -------------------------- |
2359| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle information of the application.                  |
2360| enable   | boolean                  | Yes  | Whether to enable distributed notification. The value **true** means to enable distributed notification, and **false** means the opposite.|
2361| callback | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
2362
2363**Error codes**
2364
2365For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2366
2367| ID| Error Message                                |
2368| -------- | ---------------------------------------- |
2369| 201      | Permission denied.     |
2370| 202      | Not system application to call the interface.                                      |
2371| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2372| 1600001  | Internal error.                          |
2373| 1600002  | Marshalling or unmarshalling error.      |
2374| 1600003  | Failed to connect to the service.               |
2375| 1600010  | Distributed operation failed.            |
2376| 17700001 | The specified bundle name was not found. |
2377
2378**Example**
2379
2380```ts
2381import { BusinessError } from '@kit.BasicServicesKit';
2382
2383let setDistributedEnableByBundleCallback = (err: BusinessError): void => {
2384    if (err) {
2385        console.error(`setDistributedEnableByBundle failed, code is ${err.code}, message is ${err.message}`);
2386    } else {
2387        console.info("setDistributedEnableByBundle success");
2388    }
2389};
2390let bundle: notificationManager.BundleOption = {
2391    bundle: "bundleName1",
2392};
2393let enable: boolean = true;
2394notificationManager.setDistributedEnableByBundle(bundle, enable, setDistributedEnableByBundleCallback);
2395```
2396
2397
2398
2399## notificationManager.setDistributedEnableByBundle
2400
2401setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<void>
2402
2403Sets whether to enable distributed notification for a specified application. This API uses a promise to return the result.
2404
2405**System capability**: SystemCapability.Notification.Notification
2406
2407**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2408
2409**System API**: This is a system API.
2410
2411**Parameters**
2412
2413| Name  | Type                    | Mandatory| Description                      |
2414| -------- | ------------------------ | ---- | -------------------------- |
2415| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle of the application.               |
2416| enable   | boolean                  | Yes  | Whether to enable distributed notification. The value **true** means to enable distributed notification, and **false** means the opposite.                 |
2417
2418**Return value**
2419
2420| Type             | Description       |
2421|-----------------|-----------|
2422| Promise\<void\> | Promise that returns no value.|
2423
2424**Error codes**
2425
2426For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2427
2428| ID| Error Message                                |
2429| -------- | ---------------------------------------- |
2430| 201      | Permission denied.     |
2431| 202      | Not system application to call the interface.                                      |
2432| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2433| 1600001  | Internal error.                          |
2434| 1600002  | Marshalling or unmarshalling error.      |
2435| 1600003  | Failed to connect to the service.               |
2436| 1600010  | Distributed operation failed.            |
2437| 17700001 | The specified bundle name was not found. |
2438
2439**Example**
2440
2441```ts
2442import { BusinessError } from '@kit.BasicServicesKit';
2443
2444let bundle: notificationManager.BundleOption = {
2445    bundle: "bundleName1",
2446};
2447let enable: boolean = true;
2448notificationManager.setDistributedEnableByBundle(bundle, enable).then(() => {
2449    console.info("setDistributedEnableByBundle success");
2450}).catch((err: BusinessError) => {
2451    console.error(`setDistributedEnableByBundle fail: ${JSON.stringify(err)}`);
2452});
2453```
2454
2455## notificationManager.isDistributedEnabledByBundle
2456
2457isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<boolean>): void
2458
2459Checks whether distributed notification is enabled for a specified application. This API uses an asynchronous callback to return the result.
2460
2461**System capability**: SystemCapability.Notification.Notification
2462
2463**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2464
2465**System API**: This is a system API.
2466
2467**Parameters**
2468
2469| Name  | Type                    | Mandatory| Description                      |
2470| -------- | ------------------------ | ---- | -------------------------- |
2471| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle of the application.                    |
2472| callback | AsyncCallback\<boolean\> | Yes  | Callback used to return the result. The value **true** means that distributed notification is enabled, and **false** means the opposite.|
2473
2474**Error codes**
2475
2476For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2477
2478| ID| Error Message                                |
2479| -------- | ---------------------------------------- |
2480| 201      | Permission denied.     |
2481| 202      | Not system application to call the interface.                                      |
2482| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2483| 1600001  | Internal error.                          |
2484| 1600002  | Marshalling or unmarshalling error.      |
2485| 1600003  | Failed to connect to the service.               |
2486| 1600010  | Distributed operation failed.            |
2487| 17700001 | The specified bundle name was not found. |
2488
2489**Example**
2490
2491```ts
2492import { BusinessError } from '@kit.BasicServicesKit';
2493
2494let isDistributedEnabledByBundleCallback = (err: BusinessError, data: boolean): void => {
2495    if (err) {
2496        console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`);
2497    } else {
2498        console.info("isDistributedEnabledByBundle success" + JSON.stringify(data));
2499    }
2500};
2501let bundle: notificationManager.BundleOption = {
2502    bundle: "bundleName1",
2503};
2504notificationManager.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback);
2505```
2506
2507## notificationManager.isDistributedEnabledByBundle
2508
2509isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
2510
2511Checks whether distributed notification is enabled for a specified application. This API uses a promise to return the result.
2512
2513**System capability**: SystemCapability.Notification.Notification
2514
2515**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2516
2517**System API**: This is a system API.
2518
2519**Parameters**
2520
2521| Name  | Type                    | Mandatory| Description                      |
2522| -------- | ------------------------ | ---- | -------------------------- |
2523| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle of the application.               |
2524
2525**Return value**
2526
2527| Type              | Description                                             |
2528| ------------------ | ------------------------------------------------- |
2529| Promise\<boolean\> | Promise used to return the result. The value **true** means that distributed notification is enabled, and **false** means the opposite.|
2530
2531**Error codes**
2532
2533For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2534
2535| ID| Error Message                                |
2536| -------- | ---------------------------------------- |
2537| 201      | Permission denied.     |
2538| 202      | Not system application to call the interface.                                      |
2539| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2540| 1600001  | Internal error.                          |
2541| 1600002  | Marshalling or unmarshalling error.      |
2542| 1600003  | Failed to connect to the service.               |
2543| 1600010  | Distributed operation failed.            |
2544| 17700001 | The specified bundle name was not found. |
2545
2546**Example**
2547
2548```ts
2549import { BusinessError } from '@kit.BasicServicesKit';
2550
2551let bundle: notificationManager.BundleOption = {
2552    bundle: "bundleName1",
2553};
2554notificationManager.isDistributedEnabledByBundle(bundle).then((data: boolean) => {
2555    console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data));
2556}).catch((err: BusinessError) => {
2557    console.error(`isDistributedEnabledByBundle fail: ${JSON.stringify(err)}`);
2558});
2559```
2560
2561
2562## notificationManager.getDeviceRemindType
2563
2564getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
2565
2566Obtains the notification reminder type. This API uses an asynchronous callback to return the result.
2567
2568**System capability**: SystemCapability.Notification.Notification
2569
2570**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2571
2572**System API**: This is a system API.
2573
2574**Parameters**
2575
2576| Name  | Type                              | Mandatory| Description                      |
2577| -------- | --------------------------------- | ---- | -------------------------- |
2578| callback | AsyncCallback\<[DeviceRemindType](#deviceremindtype)\> | Yes  | Callback used to return the result.|
2579
2580**Error codes**
2581
2582For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2583
2584| ID| Error Message                           |
2585| -------- | ----------------------------------- |
2586| 201      | Permission denied.     |
2587| 202      | Not system application to call the interface.                                      |
2588| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2589| 1600001  | Internal error.                     |
2590| 1600002  | Marshalling or unmarshalling error. |
2591| 1600003  | Failed to connect to the service.          |
2592
2593**Example**
2594
2595```ts
2596import { BusinessError } from '@kit.BasicServicesKit';
2597
2598let getDeviceRemindTypeCallback = (err: BusinessError, data: notificationManager.DeviceRemindType): void => {
2599    if (err) {
2600        console.error(`getDeviceRemindType failed, code is ${err.code}, message is ${err.message}`);
2601    } else {
2602        console.info(`getDeviceRemindType success, data is ${JSON.stringify(data)}`);
2603    }
2604};
2605notificationManager.getDeviceRemindType(getDeviceRemindTypeCallback);
2606```
2607
2608## notificationManager.getDeviceRemindType
2609
2610getDeviceRemindType(): Promise\<DeviceRemindType\>
2611
2612Obtains the notification reminder type. This API uses a promise to return the result.
2613
2614**System capability**: SystemCapability.Notification.Notification
2615
2616**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
2617
2618**System API**: This is a system API.
2619
2620**Return value**
2621
2622| Type              | Description           |
2623| ------------------ | --------------- |
2624| Promise\<[DeviceRemindType](#deviceremindtype)\> | Promise used to return the result.|
2625
2626**Error codes**
2627
2628For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2629
2630| ID| Error Message                           |
2631| -------- | ----------------------------------- |
2632| 201      | Permission denied.     |
2633| 202      | Not system application to call the interface.                                      |
2634| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2635| 1600001  | Internal error.                     |
2636| 1600002  | Marshalling or unmarshalling error. |
2637| 1600003  | Failed to connect to the service.          |
2638
2639**Example**
2640
2641```ts
2642import { BusinessError } from '@kit.BasicServicesKit';
2643
2644notificationManager.getDeviceRemindType().then((data: notificationManager.DeviceRemindType) => {
2645    console.info("getDeviceRemindType success, data: " + JSON.stringify(data));
2646}).catch((err: BusinessError) => {
2647    console.error(`getDeviceRemindType fail: ${JSON.stringify(err)}`);
2648});
2649```
2650
2651
2652## notificationManager.publishAsBundle
2653
2654publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\<void\>): void
2655
2656Publishes a notification through the reminder agent. This API uses an asynchronous callback to return the result.
2657
2658**System capability**: SystemCapability.Notification.Notification
2659
2660**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
2661
2662**System API**: This is a system API.
2663
2664**Parameters**
2665
2666| Name              | Type                                       | Mandatory| Description                                    |
2667| -------------------- | ------------------------------------------- | ---- | ---------------------------------------- |
2668| request              | [NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest) | Yes  | Content and related configuration of the notification to publish.|
2669| representativeBundle | string                                      | Yes  | Bundle name of the application whose notification function is taken over by the reminder agent.                      |
2670| userId               | number                                      | Yes  | User ID.                                |
2671| callback             | AsyncCallback\<void\>                        | Yes  | Callback used to return the result.                |
2672
2673**Error codes**
2674
2675For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2676
2677| ID| Error Message                                 |
2678| -------- | ----------------------------------------- |
2679| 201      | Permission denied.     |
2680| 202      | Not system application to call the interface.                                      |
2681| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2682| 1600001  | Internal error.                           |
2683| 1600002  | Marshalling or unmarshalling error.       |
2684| 1600003  | Failed to connect to the service.                |
2685| 1600004  | Notification disabled.              |
2686| 1600005  | Notification slot disabled.         |
2687| 1600007  | The notification does not exist.      |
2688| 1600008  | The user does not exist.                    |
2689| 1600009  | Over max number notifications per second. |
2690| 1600012  | No memory space.                          |
2691| 1600015  | The current notification status does not support duplicate configurations. |
2692| 1600016  | The notification version for this update is too low. |
2693| 2300007  | Network unreachable.                              |
2694
2695**Example**
2696
2697```ts
2698import { BusinessError } from '@kit.BasicServicesKit';
2699
2700// publishAsBundle callback
2701let callback = (err: BusinessError): void => {
2702    if (err) {
2703        console.error(`publishAsBundle failed, code is ${err.code}, message is ${err.message}`);
2704    } else {
2705        console.info("publishAsBundle success");
2706    }
2707}
2708// Bundle name of the application whose notification function is taken over by the reminder agent
2709let representativeBundle: string = "com.example.demo";
2710// Use the actual user ID when calling the API.
2711let userId: number = 100;
2712// NotificationRequest object
2713let request: notificationManager.NotificationRequest = {
2714    id: 1,
2715    content: {
2716        notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
2717        normal: {
2718            title: "test_title",
2719            text: "test_text",
2720            additionalText: "test_additionalText"
2721        }
2722    }
2723};
2724notificationManager.publishAsBundle(request, representativeBundle, userId, callback);
2725```
2726
2727## notificationManager.publishAsBundle
2728
2729publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise\<void\>
2730
2731Publishes a notification through the reminder agent. This API uses a promise to return the result.
2732
2733**System capability**: SystemCapability.Notification.Notification
2734
2735**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
2736
2737**System API**: This is a system API.
2738
2739**Parameters**
2740
2741
2742| Name              | Type                                       | Mandatory| Description                                         |
2743| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
2744| request              | [NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest) | Yes  | Content and related configuration of the notification to publish.|
2745| representativeBundle | string                                      | Yes  | Bundle name of the application whose notification function is taken over by the reminder agent.                           |
2746| userId               | number                                      | Yes  | User ID.                           |
2747
2748**Return value**
2749
2750| Type             | Description       |
2751|-----------------|-----------|
2752| Promise\<void\> | Promise that returns no value.|
2753
2754**Error codes**
2755
2756For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2757
2758| ID| Error Message                                 |
2759| -------- | ----------------------------------------- |
2760| 201      | Permission denied.     |
2761| 202      | Not system application to call the interface.                                      |
2762| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2763| 1600001  | Internal error.                           |
2764| 1600002  | Marshalling or unmarshalling error.       |
2765| 1600003  | Failed to connect to the service.                |
2766| 1600004  | Notification disabled.                    |
2767| 1600005  | Notification slot disabled.         |
2768| 1600007  | The notification does not exist.      |
2769| 1600008  | The user does not exist.                    |
2770| 1600009  | Over max number notifications per second. |
2771| 1600012  | No memory space.                          |
2772| 1600015  | The current notification status does not support duplicate configurations. |
2773| 1600016  | The notification version for this update is too low. |
2774| 2300007  | Network unreachable.                              |
2775
2776**Example**
2777
2778```ts
2779import { BusinessError } from '@kit.BasicServicesKit';
2780
2781// Bundle name of the application whose notification function is taken over by the reminder agent
2782let representativeBundle: string = "com.example.demo";
2783// Use the actual user ID when calling the API.
2784let userId: number = 100;
2785// NotificationRequest object
2786let request: notificationManager.NotificationRequest = {
2787    id: 1,
2788    content: {
2789        notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
2790        normal: {
2791            title: "test_title",
2792            text: "test_text",
2793            additionalText: "test_additionalText"
2794        }
2795    }
2796};
2797notificationManager.publishAsBundle(request, representativeBundle, userId).then(() => {
2798	console.info("publishAsBundle success");
2799}).catch((err: BusinessError) => {
2800    console.error(`publishAsBundle fail: ${JSON.stringify(err)}`);
2801});
2802```
2803
2804## notificationManager.publishAsBundle<sup>12+</sup>
2805
2806publishAsBundle(representativeBundle: BundleOption, request: NotificationRequest): Promise\<void\>
2807
2808Publishes a notification through the reminder agent. This API uses a promise to return the result.
2809
2810**System capability**: SystemCapability.Notification.Notification
2811
2812**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
2813
2814**System API**: This is a system API.
2815
2816**Parameters**
2817
2818
2819| Name              | Type                                       | Mandatory| Description                                         |
2820|----------------------|--------------------------------------------|------|-----------------------------------------------|
2821| representativeBundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)  | Yes  | Bundle information of the application whose notification function is taken over by the reminder agent.                           |
2822| request              | [NotificationRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationrequest) | Yes  | Content and related configuration of the notification to publish.|
2823
2824**Return value**
2825
2826| Type             | Description       |
2827|-----------------|-----------|
2828| Promise\<void\> | Promise that returns no value.|
2829
2830**Error codes**
2831
2832For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2833
2834| ID| Error Message                                 |
2835| -------- | ----------------------------------------- |
2836| 201      | Permission denied.     |
2837| 202      | Not system application to call the interface.                                      |
2838| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2839| 1600001  | Internal error.                           |
2840| 1600002  | Marshalling or unmarshalling error.       |
2841| 1600003  | Failed to connect to the service.                |
2842| 1600004  | Notification is not enabled.              |
2843| 1600005  | Notification slot disabled.         |
2844| 1600007  | The notification does not exist.      |
2845| 1600008  | The user does not exist.                    |
2846| 1600009  | Over max number notifications per second. |
2847| 1600012  | No memory space.                          |
2848| 1600015  | The current notification status does not support duplicate configurations. |
2849| 1600016  | The notification version for this update is too low. |
2850| 2300007  | Network unreachable.                              |
2851
2852**Example**
2853
2854```ts
2855import { BusinessError } from '@kit.BasicServicesKit';
2856
2857// Bundle information of the application whose notification function is taken over by the reminder agent.
2858let representativeBundle: notificationManager.BundleOption = {
2859  bundle: "bundleName1",
2860};
2861// NotificationRequest object
2862let request: notificationManager.NotificationRequest = {
2863    id: 1,
2864    content: {
2865        notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
2866        normal: {
2867            title: "test_title",
2868            text: "test_text",
2869            additionalText: "test_additionalText"
2870        }
2871    }
2872};
2873notificationManager.publishAsBundle(representativeBundle, request).then(() => {
2874	console.info("publishAsBundle success");
2875}).catch((err: BusinessError) => {
2876    console.error(`publishAsBundle fail: ${JSON.stringify(err)}`);
2877});
2878```
2879
2880## notificationManager.cancelAsBundle
2881
2882cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback\<void\>): void
2883
2884Cancels a notification published through the reminder agent. This API uses an asynchronous callback to return the result.
2885
2886**System capability**: SystemCapability.Notification.Notification
2887
2888**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
2889
2890**System API**: This is a system API.
2891
2892**Parameters**
2893
2894| Name              | Type         | Mandatory| Description                    |
2895| -------------------- | ------------- | ---- | ------------------------ |
2896| id                   | number        | Yes  | Notification ID.                |
2897| representativeBundle | string        | Yes  | Bundle name of the application whose notification function is taken over by the reminder agent.      |
2898| userId               | number        | Yes  | User ID.      |
2899| callback             | AsyncCallback\<void\> | Yes  | Callback used to return the result.|
2900
2901**Error codes**
2902
2903For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2904
2905| ID| Error Message                           |
2906| -------- | ----------------------------------- |
2907| 201      | Permission denied.     |
2908| 202      | Not system application to call the interface.                                      |
2909| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2910| 1600001  | Internal error.                     |
2911| 1600002  | Marshalling or unmarshalling error. |
2912| 1600003  | Failed to connect to the service.          |
2913| 1600007  | The notification does not exist.      |
2914| 1600008  | The user does not exist.              |
2915| 17700001 | The specified bundle name was not found. |
2916
2917**Example**
2918
2919```ts
2920import { BusinessError } from '@kit.BasicServicesKit';
2921
2922// cancelAsBundle
2923let cancelAsBundleCallback = (err: BusinessError): void => {
2924    if (err) {
2925        console.error(`cancelAsBundle failed, code is ${err.code}, message is ${err.message}`);
2926    } else {
2927        console.info("cancelAsBundle success");
2928    }
2929}
2930// Bundle name of the application whose notification function is taken over by the reminder agent
2931let representativeBundle: string = "com.example.demo";
2932// Use the actual user ID when calling the API.
2933let userId: number = 100;
2934notificationManager.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback);
2935```
2936
2937## notificationManager.cancelAsBundle
2938
2939cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void\>
2940
2941Cancels a notification published through the reminder agent. This API uses a promise to return the result.
2942
2943**System capability**: SystemCapability.Notification.Notification
2944
2945**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
2946
2947**System API**: This is a system API.
2948
2949**Parameters**
2950
2951| Name              | Type  | Mandatory| Description              |
2952| -------------------- | ------ | ---- | ------------------ |
2953| id                   | number | Yes  | Notification ID.          |
2954| representativeBundle | string | Yes  | Bundle name of the application whose notification function is taken over by the reminder agent.|
2955| userId               | number | Yes  | User ID.|
2956
2957**Return value**
2958
2959| Type             | Description       |
2960|-----------------|-----------|
2961| Promise\<void\> | Promise that returns no value.|
2962
2963**Error codes**
2964
2965For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
2966
2967| ID| Error Message                           |
2968| -------- | ----------------------------------- |
2969| 201      | Permission denied.     |
2970| 202      | Not system application to call the interface.                                      |
2971| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
2972| 1600001  | Internal error.                     |
2973| 1600002  | Marshalling or unmarshalling error. |
2974| 1600003  | Failed to connect to the service.          |
2975| 1600007  | The notification does not exist.      |
2976| 1600008  | The user does not exist.              |
2977| 17700001 | The specified bundle name was not found. |
2978
2979**Example**
2980
2981```ts
2982import { BusinessError } from '@kit.BasicServicesKit';
2983
2984// Bundle name of the application whose notification function is taken over by the reminder agent
2985let representativeBundle: string = "com.example.demo";
2986// Use the actual user ID when calling the API.
2987let userId: number = 100;
2988notificationManager.cancelAsBundle(0, representativeBundle, userId).then(() => {
2989	console.info("cancelAsBundle success");
2990}).catch((err: BusinessError) => {
2991    console.error(`cancelAsBundle fail: ${JSON.stringify(err)}`);
2992});
2993```
2994
2995
2996## notificationManager.cancelAsBundle<sup>12+</sup>
2997
2998cancelAsBundle(representativeBundle: BundleOption, id: number): Promise\<void\>
2999
3000Cancels a notification published through the reminder agent. This API uses a promise to return the result.
3001
3002**System capability**: SystemCapability.Notification.Notification
3003
3004**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
3005
3006**System API**: This is a system API.
3007
3008**Parameters**
3009
3010
3011| Name              | Type                                       | Mandatory| Description                                         |
3012| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
3013| representativeBundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)  |Yes  | Bundle information of the application whose notification function is taken over by the reminder agent.|
3014| id                   | number                                     | Yes  | Notification ID.          |
3015
3016**Return value**
3017
3018| Type             | Description       |
3019|-----------------|-----------|
3020| Promise\<void\> | Promise that returns no value.|
3021
3022**Error codes**
3023
3024For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3025
3026| ID| Error Message                                 |
3027| -------- | ----------------------------------------- |
3028| 201      | Permission denied.     |
3029| 202      | Not system application to call the interface.                                      |
3030| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3031| 1600001  | Internal error.                           |
3032| 1600002  | Marshalling or unmarshalling error.       |
3033| 1600003  | Failed to connect to the service.                |
3034| 1600007  | The notification does not exist.            |
3035| 1600008  | The user does not exist.                    |
3036| 1600012  | No memory space.                          |
3037| 17700001 | The specified bundle name was not found. |
3038
3039**Example**
3040
3041```ts
3042import { BusinessError } from '@kit.BasicServicesKit';
3043
3044let representativeBundle: notificationManager.BundleOption = {
3045  bundle: "bundleName1",
3046};
3047notificationManager.cancelAsBundle(representativeBundle, 1).then(() => {
3048	console.info("cancelAsBundle success");
3049}).catch((err: BusinessError) => {
3050    console.error(`cancelAsBundle fail: ${JSON.stringify(err)}`);
3051});
3052```
3053
3054## notificationManager.cancel<sup>12+</sup>
3055
3056cancel(representativeBundle: BundleOption, id: number): Promise\<void\>
3057
3058Cancels the notification of other applications of the user. This API uses a promise to return the result.
3059
3060The current application must have a proxy relationship with another application, or the **ohos.permission.NOTIFICATION_AGENT_CONTROLLER** permission is granted to the current application.
3061
3062**System capability**: SystemCapability.Notification.Notification
3063
3064**System API**: This is a system API.
3065
3066**Parameters**
3067
3068| Name              | Type  | Mandatory| Description              |
3069| -------------------- | ------ | ---- | ------------------ |
3070| representativeBundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.          |
3071|       id             | number | Yes  | Notification ID.|
3072
3073**Return value**
3074
3075| Type             | Description       |
3076|-----------------|-----------|
3077| Promise\<void\> | Promise that returns no value.|
3078
3079**Error codes**
3080
3081For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3082
3083| ID| Error Message                           |
3084| -------- | ----------------------------------- |
3085| 202      | Not system application to call the interface.                                      |
3086| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3087| 1600001  | Internal error.                     |
3088| 1600002  | Marshalling or unmarshalling error. |
3089| 1600003  | Failed to connect to the service.          |
3090| 1600007  | The notification does not exist.      |
3091| 1600012  | No memory space.                    |
3092| 1600017  | There is no corresponding agent relationship configuration.    |
3093
3094**Example**
3095
3096```ts
3097import { BusinessError } from '@kit.BasicServicesKit';
3098
3099let bundle: notificationManager.BundleOption = {
3100  bundle: "bundleName"
3101};
3102let id: number = 1;
3103notificationManager.cancel(bundle, id).then(() => {
3104  console.info("cancel success");
3105}).catch((err: BusinessError) => {
3106  console.error(`cancel fail: ${JSON.stringify(err)}`);
3107});
3108```
3109
3110## notificationManager.setNotificationEnableSlot
3111
3112setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\<void>): void
3113
3114Sets the enabled status of a slot type for the specified application. This API uses an asynchronous callback to return the result.
3115
3116**System capability**: SystemCapability.Notification.Notification
3117
3118**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3119
3120**System API**: This is a system API.
3121
3122**Parameters**
3123
3124| Name  | Type                         | Mandatory| Description                  |
3125| -------- | ----------------------------- | ---- | ---------------------- |
3126| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.          |
3127| type     | [SlotType](./js-apis-notificationManager.md#slottype)         | Yes  | Notification slot type.        |
3128| enable   | boolean                       | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.            |
3129| callback | AsyncCallback\<void\>         | Yes  | Callback used to return the result.|
3130
3131**Error codes**
3132
3133For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3134
3135| ID| Error Message                                |
3136| -------- | ---------------------------------------- |
3137| 201      | Permission denied.     |
3138| 202      | Not system application to call the interface.                                      |
3139| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3140| 1600001  | Internal error.                          |
3141| 1600002  | Marshalling or unmarshalling error.      |
3142| 1600003  | Failed to connect to the service.               |
3143| 1600012  | No memory space.                         |
3144| 17700001 | The specified bundle name was not found. |
3145
3146**Example**
3147
3148```ts
3149import { BusinessError } from '@kit.BasicServicesKit';
3150
3151// setNotificationEnableSlot
3152let setNotificationEnableSlotCallback = (err: BusinessError): void => {
3153    if (err) {
3154        console.error(`setNotificationEnableSlot failed, code is ${err.code}, message is ${err.message}`);
3155    } else {
3156        console.info("setNotificationEnableSlot success");
3157    }
3158};
3159notificationManager.setNotificationEnableSlot(
3160    { bundle: "ohos.samples.notification", },
3161    notificationManager.SlotType.SOCIAL_COMMUNICATION,
3162    true,
3163    setNotificationEnableSlotCallback);
3164```
3165
3166## notificationManager.setNotificationEnableSlot<sup>11+</sup>
3167
3168setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, isForceControl: boolean, callback: AsyncCallback\<void>): void
3169
3170Sets the enabled status of a slot type for the specified application. This API uses an asynchronous callback to return the result.
3171
3172**System capability**: SystemCapability.Notification.Notification
3173
3174**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3175
3176**System API**: This is a system API.
3177
3178**Parameters**
3179
3180| Name  | Type                         | Mandatory| Description                    |
3181| -------- | ----------------------------- | ---- | ----------------------- |
3182| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
3183| type     | [SlotType](./js-apis-notificationManager.md#slottype)         | Yes  | Notification slot type.          |
3184| enable   | boolean                       | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.              |
3185| isForceControl<sup>11+</sup> | boolean                 | Yes  | Whether the slot is affected by the notification authorization. The value **true** means the slot is affected, and **false** means the opposite.|
3186| callback | AsyncCallback\<void\>         | Yes  | Callback used to return the result.   |
3187
3188**Error codes**
3189
3190For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3191
3192| ID| Error Message                                |
3193| -------- | ---------------------------------------- |
3194| 201      | Permission denied.     |
3195| 202      | Not system application to call the interface.                                      |
3196| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3197| 1600001  | Internal error.                          |
3198| 1600002  | Marshalling or unmarshalling error.      |
3199| 1600003  | Failed to connect to the service.               |
3200| 1600012  | No memory space.                         |
3201| 17700001 | The specified bundle name was not found. |
3202
3203**Example**
3204
3205```ts
3206import { BusinessError } from '@kit.BasicServicesKit';
3207
3208let setNotificationEnableSlotCallback = (err: BusinessError): void => {
3209    if (err) {
3210        console.error(`setNotificationEnableSlot failed, code is ${err.code}, message is ${err.message}`);
3211    } else {
3212        console.info("setNotificationEnableSlot success");
3213    }
3214};
3215
3216notificationManager.setNotificationEnableSlot(
3217    { bundle: "ohos.samples.notification", },
3218    notificationManager.SlotType.SOCIAL_COMMUNICATION,
3219    true,
3220    false,
3221    setNotificationEnableSlotCallback);
3222```
3223
3224## notificationManager.setNotificationEnableSlot
3225
3226setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, isForceControl?: boolean): Promise\<void>
3227
3228Sets the enabled status of a slot type for the specified application. This API uses a promise to return the result.
3229
3230**System capability**: SystemCapability.Notification.Notification
3231
3232**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3233
3234**System API**: This is a system API.
3235
3236**Parameters**
3237
3238| Name| Type                         | Mandatory| Description          |
3239| ------ | ----------------------------- | ---- | -------------- |
3240| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.  |
3241| type   | [SlotType](./js-apis-notificationManager.md#slottype)         | Yes  | Notification slot type.|
3242| enable | boolean                       | Yes  | Whether to enable the notification slot type. The value **true** means to enable the notification slot type, and **false** means the opposite.    |
3243| isForceControl<sup>11+</sup> | boolean               | No  | Whether the enabled status of the notification slot is subject to the enabled status of notification. The value **false** means that the enabled status of the notification slot is subject to the enabled status of notification, and **true** means the opposite. Default value: **false**    |
3244
3245**Error codes**
3246
3247For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3248
3249| ID| Error Message                                |
3250| -------- | ---------------------------------------- |
3251| 201      | Permission denied.     |
3252| 202      | Not system application to call the interface.                                      |
3253| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3254| 1600001  | Internal error.                          |
3255| 1600002  | Marshalling or unmarshalling error.      |
3256| 1600003  | Failed to connect to the service.               |
3257| 1600012  | No memory space.                         |
3258| 17700001 | The specified bundle name was not found. |
3259
3260**Example**
3261
3262```ts
3263import { BusinessError } from '@kit.BasicServicesKit';
3264
3265// setNotificationEnableSlot
3266notificationManager.setNotificationEnableSlot(
3267    { bundle: "ohos.samples.notification", },
3268    notificationManager.SlotType.SOCIAL_COMMUNICATION,
3269    true).then(() => {
3270        console.info("setNotificationEnableSlot success");
3271    }).catch((err: BusinessError) => {
3272        console.error(`setNotificationEnableSlot fail: ${JSON.stringify(err)}`);
3273    });
3274```
3275
3276## notificationManager.isNotificationSlotEnabled
3277
3278isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\<boolean\>): void
3279
3280Checks whether a specified notification slot type is enabled for a specified application. This API uses an asynchronous callback to return the result.
3281
3282**System capability**: SystemCapability.Notification.Notification
3283
3284**System API**: This is a system API.
3285
3286**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3287
3288**Parameters**
3289
3290| Name  | Type                         | Mandatory| Description                  |
3291| -------- | ----------------------------- | ---- | ---------------------- |
3292| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.          |
3293| type     | [SlotType](./js-apis-notificationManager.md#slottype)         | Yes  | Notification slot type.        |
3294| callback | AsyncCallback\<boolean\>         | Yes  | Callback used to return the result. The value **true** means that the notification slot type is enabled, and **false** means the opposite.|
3295
3296**Error codes**
3297
3298For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3299
3300| ID| Error Message                                |
3301| -------- | ---------------------------------------- |
3302| 201      | Permission denied.     |
3303| 202      | Not system application to call the interface.                                      |
3304| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3305| 1600001  | Internal error.                          |
3306| 1600002  | Marshalling or unmarshalling error.      |
3307| 1600003  | Failed to connect to the service.               |
3308| 17700001 | The specified bundle name was not found. |
3309
3310**Example**
3311
3312```ts
3313import { BusinessError } from '@kit.BasicServicesKit';
3314
3315// isNotificationSlotEnabledCallback
3316let isNotificationSlotEnabledCallback = (err: BusinessError, data: boolean): void => {
3317    if (err) {
3318        console.error(`isNotificationSlotEnabled failed, code is ${err.code}, message is ${err.message}`);
3319    } else {
3320        console.info(`isNotificationSlotEnabled success, data is ${JSON.stringify(data)}`);
3321    }
3322};
3323
3324notificationManager.isNotificationSlotEnabled(
3325    { bundle: "ohos.samples.notification", },
3326    notificationManager.SlotType.SOCIAL_COMMUNICATION,
3327    isNotificationSlotEnabledCallback);
3328```
3329
3330## notificationManager.isNotificationSlotEnabled
3331
3332isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolean\>
3333
3334Checks whether a specified notification slot type is enabled for a specified application. This API uses a promise to return the result.
3335
3336**System capability**: SystemCapability.Notification.Notification
3337
3338**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3339
3340**System API**: This is a system API.
3341
3342**Parameters**
3343
3344| Name| Type                         | Mandatory| Description          |
3345| ------ | ----------------------------- | ---- | -------------- |
3346| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.  |
3347| type   | [SlotType](./js-apis-notificationManager.md#slottype)         | Yes  | Notification slot type.|
3348
3349**Return value**
3350
3351| Type                                                       | Description                                                        |
3352| ----------------------------------------------------------- | ------------------------------------------------------------ |
3353| Promise\<boolean\> | Promise used to return the result. The value **true** means that the notification slot type is enabled, and **false** means the opposite.|
3354
3355**Error codes**
3356
3357For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3358
3359| ID| Error Message                                |
3360| -------- | ---------------------------------------- |
3361| 201      | Permission denied.     |
3362| 202      | Not system application to call the interface.                                      |
3363| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3364| 1600001  | Internal error.                          |
3365| 1600002  | Marshalling or unmarshalling error.      |
3366| 1600003  | Failed to connect to the service.               |
3367| 17700001 | The specified bundle name was not found. |
3368
3369**Example**
3370
3371```ts
3372import { BusinessError } from '@kit.BasicServicesKit';
3373
3374// isNotificationSlotEnabled
3375notificationManager.isNotificationSlotEnabled({ bundle: "ohos.samples.notification", },
3376    notificationManager.SlotType.SOCIAL_COMMUNICATION).then((data: boolean) => {
3377    console.info("isNotificationSlotEnabled success, data: " + JSON.stringify(data));
3378}).catch((err: BusinessError) => {
3379    console.error(`isNotificationSlotEnabled fail: ${JSON.stringify(err)}`);
3380});
3381```
3382
3383
3384## notificationManager.setSyncNotificationEnabledWithoutApp
3385
3386setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: AsyncCallback\<void\>): void
3387
3388Sets whether to enable the notification sync feature for devices where the application is not installed. This API uses an asynchronous callback to return the result.
3389
3390**System capability**: SystemCapability.Notification.Notification
3391
3392**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3393
3394**System API**: This is a system API.
3395
3396**Parameters**
3397
3398| Name| Type                         | Mandatory| Description          |
3399| ------ | ----------------------------- | ---- | -------------- |
3400| userId | number | Yes  | User ID.  |
3401| enable | boolean | Yes  | Whether to enable the notification sync feature. The value **true** means to enable the feature, and **false** means the opposite.  |
3402| callback | AsyncCallback\<void\>    | Yes  | Callback used to return the result.|
3403
3404**Error codes**
3405
3406For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3407
3408| ID| Error Message                           |
3409| -------- | ----------------------------------- |
3410| 201      | Permission denied.     |
3411| 202      | Not system application to call the interface.                                      |
3412| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3413| 1600001  | Internal error.                     |
3414| 1600002  | Marshalling or unmarshalling error. |
3415| 1600003  | Failed to connect to the service.          |
3416| 1600008  | The user does not exist.              |
3417
3418**Example**
3419
3420```ts
3421import { BusinessError } from '@kit.BasicServicesKit';
3422
3423// Use the actual user ID when calling the API.
3424let userId: number = 100;
3425let enable: boolean = true;
3426let setSyncNotificationEnabledWithoutAppCallback = (err: BusinessError): void => {
3427    if (err) {
3428        console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
3429    } else {
3430        console.info("setSyncNotificationEnabledWithoutApp success");
3431    }
3432}
3433notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable, setSyncNotificationEnabledWithoutAppCallback);
3434```
3435
3436
3437## notificationManager.setSyncNotificationEnabledWithoutApp
3438
3439setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<void>
3440
3441Sets whether to enable the notification sync feature for devices where the application is not installed. This API uses a promise to return the result.
3442
3443**System capability**: SystemCapability.Notification.Notification
3444
3445**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3446
3447**System API**: This is a system API.
3448
3449**Parameters**
3450
3451| Name| Type                         | Mandatory| Description          |
3452| ------ | ----------------------------- | ---- | -------------- |
3453| userId | number | Yes  | User ID.  |
3454| enable | boolean | Yes  | Whether to enable the notification sync feature. The value **true** means to enable the feature, and **false** means the opposite.  |
3455
3456**Return value**
3457
3458| Type                                                       | Description                                                        |
3459| ----------------------------------------------------------- | ------------------------------------------------------------ |
3460| Promise\<void\> | Promise used to return the result.|
3461
3462**Error codes**
3463
3464For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3465
3466| ID| Error Message                           |
3467| -------- | ----------------------------------- |
3468| 201      | Permission denied.     |
3469| 202      | Not system application to call the interface.                                      |
3470| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3471| 1600001  | Internal error.                     |
3472| 1600002  | Marshalling or unmarshalling error. |
3473| 1600003  | Failed to connect to the service.          |
3474| 1600008  | The user does not exist.              |
3475
3476**Example**
3477
3478```ts
3479import { BusinessError } from '@kit.BasicServicesKit';
3480
3481// Use the actual user ID when calling the API.
3482let userId: number = 100;
3483let enable: boolean = true;
3484notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
3485    console.info('setSyncNotificationEnabledWithoutApp success');
3486}).catch((err: BusinessError) => {
3487    console.error(`setSyncNotificationEnabledWithoutApp fail: ${JSON.stringify(err)}`);
3488});
3489```
3490
3491
3492## notificationManager.getSyncNotificationEnabledWithoutApp
3493
3494getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<boolean>): void
3495
3496Obtains whether the notification sync feature is enabled for devices where the application is not installed. This API uses an asynchronous callback to return the result.
3497
3498**System capability**: SystemCapability.Notification.Notification
3499
3500**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3501
3502**System API**: This is a system API.
3503
3504**Parameters**
3505
3506| Name| Type                         | Mandatory| Description          |
3507| ------ | ----------------------------- | ---- | -------------- |
3508| userId | number | Yes  | User ID.  |
3509| callback | AsyncCallback\<boolean\>         | Yes  | Callback used to return the result. The value **true** means that the notification sync feature is enabled, and **false** means the opposite.|
3510
3511**Error codes**
3512
3513For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3514
3515| ID| Error Message                           |
3516| -------- | ----------------------------------- |
3517| 201      | Permission denied.     |
3518| 202      | Not system application to call the interface.                                      |
3519| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3520| 1600001  | Internal error.                     |
3521| 1600002  | Marshalling or unmarshalling error. |
3522| 1600003  | Failed to connect to the service.          |
3523| 1600008  | The user does not exist.              |
3524
3525**Example**
3526
3527```ts
3528import { BusinessError } from '@kit.BasicServicesKit';
3529
3530// Use the actual user ID when calling the API.
3531let userId: number = 100;
3532let getSyncNotificationEnabledWithoutAppCallback = (err: BusinessError, data: boolean): void => {
3533    if (err) {
3534        console.error(`getSyncNotificationEnabledWithoutAppCallback failed, code is ${err.code}, message is ${err.message}`);
3535    } else {
3536        console.info("getSyncNotificationEnabledWithoutAppCallback success, data: " + JSON.stringify(data));
3537    }
3538}
3539notificationManager.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEnabledWithoutAppCallback);
3540```
3541
3542
3543## notificationManager.getSyncNotificationEnabledWithoutApp
3544
3545getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
3546
3547Obtains whether the notification sync feature is enabled for devices where the application is not installed. This API uses a promise to return the result.
3548
3549**System capability**: SystemCapability.Notification.Notification
3550
3551**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3552
3553**System API**: This is a system API.
3554
3555**Parameters**
3556
3557| Name| Type                         | Mandatory| Description          |
3558| ------ | ----------------------------- | ---- | -------------- |
3559| userId | number | Yes  | User ID.  |
3560
3561**Return value**
3562
3563| Type              | Description                                                        |
3564| ------------------ | ------------------------------------------------------------ |
3565| Promise\<boolean\> | Promise used to return the result. The value **true** means that the notification sync feature is enabled, and **false** means the opposite.|
3566
3567**Error codes**
3568
3569For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3570
3571| ID| Error Message                           |
3572| -------- | ----------------------------------- |
3573| 201      | Permission denied.     |
3574| 202      | Not system application to call the interface.                                      |
3575| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3576| 1600001  | Internal error.                     |
3577| 1600002  | Marshalling or unmarshalling error. |
3578| 1600003  | Failed to connect to the service.          |
3579| 1600008  | The user does not exist.              |
3580
3581**Example**
3582
3583```ts
3584import { BusinessError } from '@kit.BasicServicesKit';
3585
3586// Use the actual user ID when calling the API.
3587let userId: number = 100;
3588notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data: boolean) => {
3589  console.info('getSyncNotificationEnabledWithoutApp, data: ' + JSON.stringify(data));
3590}).catch((err: BusinessError) => {
3591    console.error(`getSyncNotificationEnabledWithoutApp fail: ${JSON.stringify(err)}`);
3592});
3593```
3594
3595## notificationManager.on<sup>10+</sup>
3596
3597on(type: 'checkNotification', callback: (checkInfo: NotificationCheckInfo) => NotificationCheckResult): void
3598
3599Subscribes to notification events. The notification service sends the notification information in the callback to the verification program. The verification program returns the verification result to determine whether to publish the notification, for example, controlling the publish frequency of marketing notifications.
3600
3601Each [SlotType](./js-apis-notificationManager.md#slottype) in the system can have only one registrant.
3602
3603**System capability**: SystemCapability.Notification.Notification
3604
3605**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
3606
3607**System API**: This is a system API.
3608
3609**Parameters**
3610
3611| Name| Type                                                                                                                     | Mandatory| Description          |
3612| ------ |-------------------------------------------------------------------------------------------------------------------------| ---- | -------------- |
3613| type | string                                                                                                                  | Yes  | Event type. The value is fixed to **'checkNotification'**.|
3614| callback | (checkInfo: [NotificationCheckInfo](#notificationcheckinfo10)) =>  [NotificationCheckResult](#notificationcheckresult10) | Yes  | Pointer to the notification verification function.|
3615
3616**Error codes**
3617
3618For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3619
3620| ID| Error Message                           |
3621| -------- | ----------------------------------- |
3622| 202      | Not system application.                                      |
3623| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3624| 1600001  | Internal error.                     |
3625
3626**Example**
3627
3628```ts
3629import { BusinessError } from '@kit.BasicServicesKit';
3630
3631let onCheckNotification = (info : notificationManager.NotificationCheckInfo): notificationManager.NotificationCheckResult => {
3632    console.info(`====>OnCheckNotification info: ${JSON.stringify(info)}`);
3633    if(info.notificationId == 1){
3634        let result: notificationManager.NotificationCheckResult =  { code: 1, message: "testMsg1"};
3635        return result;
3636    } else {
3637        let result: notificationManager.NotificationCheckResult =   { code: 0, message: "testMsg0"};
3638        return result;
3639    }
3640}
3641try{
3642    notificationManager.on("checkNotification", onCheckNotification);
3643} catch (error){
3644    console.error(`notificationManager.on error: ${JSON.stringify(error as BusinessError)}`);
3645}
3646```
3647
3648## notificationManager.on<sup>11+</sup>
3649
3650on(type: 'checkNotification', checkRequest: NotificationCheckRequest, callback: (checkInfo: NotificationCheckInfo) => Promise\<NotificationCheckResult\>): void
3651
3652Subscribes to notification events. The notification service sends the notification information in the callback to the verification program. The verification program returns the verification result to determine whether to publish the notification, for example, controlling the publish frequency of marketing notifications. This API uses a promise to return the result.
3653
3654Each [SlotType](./js-apis-notificationManager.md#slottype) in the system can have only one registrant.
3655
3656**System capability**: SystemCapability.Notification.Notification
3657
3658**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
3659
3660**System API**: This is a system API.
3661
3662**Parameters**
3663
3664| Name| Type                                                                                                            | Mandatory| Description          |
3665| ------ |-----------------------------------------------------------------------------------------------------------------| ---- | -------------- |
3666| type | string                                                                                                            | Yes  | Event type. The value is fixed to **'checkNotification'**.|
3667| checkRequest | [NotificationCheckRequest](js-apis-inner-notification-notificationRequest-sys.md#notificationcheckrequest11)    | Yes  | Notification verification content.|
3668| callback | (checkInfo: [NotificationCheckInfo](#notificationcheckinfo10)) =>  Promise\<[NotificationCheckResult](#notificationcheckresult10)\> | Yes  | Pointer to the notification verification function.|
3669
3670**Error codes**
3671
3672For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3673
3674| ID| Error Message                           |
3675| -------- | ----------------------------------- |
3676| 201      | Permission denied.     |
3677| 202      | Not system application.                                      |
3678| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3679| 1600001  | Internal error.                     |
3680| 1600002  | Marshalling or unmarshalling error.      |
3681| 1600003  | Failed to connect to the service.               |
3682
3683**Example**
3684
3685```ts
3686import { BusinessError } from '@kit.BasicServicesKit';
3687
3688try{
3689  notificationManager.on('checkNotification',{
3690    contentType: notificationManager.ContentType.NOTIFICATION_CONTENT_LIVE_VIEW,
3691    slotType: notificationManager.SlotType.LIVE_VIEW ,
3692    extraInfoKeys: ["event"],
3693  },
3694    async (checkInfo)=>{
3695      return { code: 1, message: "INVALID_PARAMETERS"};
3696  },);
3697} catch (error) {
3698  console.error(`notificationManager.on error: ${JSON.stringify(error as BusinessError)}`);
3699}
3700```
3701
3702## notificationManager.off<sup>10+</sup>
3703
3704off(type: 'checkNotification', callback?: (checkInfo: NotificationCheckInfo) => NotificationCheckResult): void
3705
3706Unsubscribes from notification events.
3707
3708**System capability**: SystemCapability.Notification.Notification
3709
3710**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
3711
3712**System API**: This is a system API.
3713
3714**Parameters**
3715
3716| Name| Type                                                                                                                     | Mandatory| Description          |
3717| ------ |-------------------------------------------------------------------------------------------------------------------------| ---- | -------------- |
3718| type | string                                                                                                                  | Yes  | Event type. The value is fixed to **'checkNotification'**.|
3719| callback | (checkInfo: [NotificationCheckInfo](#notificationcheckinfo10)) =>  [NotificationCheckResult](#notificationcheckresult10) | No  | Pointer to the notification verification function.|
3720
3721**Error codes**
3722
3723For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3724
3725| ID| Error Message                           |
3726| -------- | ----------------------------------- |
3727| 201      | The application does not have permission to call the interface.    |
3728| 202      | Not system application.                                      |
3729| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3730| 1600001  | Internal error.                     |
3731
3732**Example**
3733
3734```ts
3735import { BusinessError } from '@kit.BasicServicesKit';
3736
3737try{
3738    notificationManager.off("checkNotification");
3739} catch (error){
3740    console.error(`notificationManager.off error: ${JSON.stringify(error as BusinessError)}`);
3741}
3742```
3743
3744## notificationManager.triggerSystemLiveView<sup>11+</sup>
3745
3746triggerSystemLiveView(bundle: BundleOption, notificationId: number, buttonOptions: ButtonOptions): Promise\<void>
3747
3748Triggers a system live view notification. This API uses a promise to return the result.
3749
3750**System capability**: SystemCapability.Notification.Notification
3751
3752**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3753
3754**System API**: This is a system API.
3755
3756**Parameters**
3757
3758| Name| Type                  | Mandatory| Description          |
3759| -------------- | ------------- | ---- | -------------- |
3760| bundle         | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)  | Yes  |Bundle information of the application.|
3761| notificationId | number        | Yes  | Notification ID.|
3762| buttonOptions  | [ButtonOptions](#buttonoptions11) | Yes  | Button information.|
3763
3764**Return value**
3765
3766| Type| Description|
3767| ---- | ----|
3768| Promise\<void> | Promise that returns no value.|
3769
3770**Error codes**
3771
3772For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3773
3774| ID| Error Message                           |
3775| -------- | ----------------------------------- |
3776| 201      | Permission denied.     |
3777| 202      | Not system application to call the interface.                                      |
3778| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3779| 1600001  | Internal error.                     |
3780| 1600002  | Marshalling or unmarshalling error. |
3781| 1600003  | Failed to connect to the service.          |
3782| 1600007  | The notification does not exist.      |
3783| 17700001 | The specified bundle name was not found. |
3784
3785**Example**
3786
3787```ts
3788import { BusinessError } from '@kit.BasicServicesKit';
3789
3790// Bundle information
3791let bundle: notificationManager.BundleOption = {
3792    bundle: "bundleName1",
3793};
3794// Notification ID
3795let notificationId = 1;
3796// Button information
3797let buttonOptions: notificationManager.ButtonOptions = {
3798    buttonName: "buttonName1",
3799}
3800notificationManager.triggerSystemLiveView(bundle, notificationId, buttonOptions).then(() => {
3801  console.info("triggerSystemLiveView success");
3802}).catch((error: BusinessError) => {
3803  console.error(`triggerSystemLiveView fail: ${JSON.stringify(error)}`);
3804});
3805```
3806
3807
3808## notificationManager.subscribeSystemLiveView<sup>11+</sup>
3809
3810subscribeSystemLiveView(subscriber: SystemLiveViewSubscriber): Promise\<void>
3811
3812Subscribes to the system live view notification. This API uses a promise to return the result.
3813
3814**System capability**: SystemCapability.Notification.Notification
3815
3816**System API**: This is a system API.
3817
3818**Parameters**
3819
3820| Name| Type                  | Mandatory| Description          |
3821| -------------- | ------------- | ---- | -------------- |
3822| subscriber | [SystemLiveViewSubscriber](#systemliveviewsubscriber11)  | Yes  | Subscriber of the system live view notification.|
3823
3824**Return value**
3825
3826| Type| Description|
3827| ---- | ----|
3828| Promise\<void> | Promise that returns no value.|
3829
3830**Error codes**
3831
3832For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3833
3834| ID| Error Message                           |
3835| -------- | ----------------------------------- |
3836| 202      | Not system application to call the interface.                                      |
3837| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3838| 1600001  | Internal error.                     |
3839| 1600002  | Marshalling or unmarshalling error. |
3840| 1600003  | Failed to connect to the service.          |
3841| 1600012  | No memory space.                    |
3842
3843**Example**
3844
3845```ts
3846import { BusinessError } from '@kit.BasicServicesKit';
3847
3848let onResponseCallback = (id:number, option:notificationManager.ButtonOptions) => {
3849    console.info("onResponseCallback: " + JSON.stringify(option) + "notificationId" + id);
3850}
3851let subscriber: notificationManager.SystemLiveViewSubscriber  = {
3852    onResponse: onResponseCallback,
3853};
3854notificationManager.subscribeSystemLiveView(subscriber).then(() => {
3855	console.info("subscribeSystemLiveView success");
3856}).catch((error: BusinessError) => {
3857    console.error(`subscribeSystemLiveView fail: ${JSON.stringify(error)}`);
3858});
3859```
3860
3861## notificationManager.setDistributedEnabledByBundle<sup>12+</sup>
3862
3863setDistributedEnabledByBundle(bundle: BundleOption, deviceType: string, enable: boolean): Promise<void\>
3864
3865Sets whether a specified application supports cross-device collaboration. This API uses a promise to return the result.
3866
3867**System capability**: SystemCapability.Notification.Notification
3868
3869**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3870
3871**System API**: This is a system API.
3872
3873**Parameters**
3874
3875| Name  | Type                    | Mandatory| Description                      |
3876| -------- | ------------------------ | ---- | -------------------------- |
3877| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle information of the application.                  |
3878| deviceType | string | Yes  | Device type.|
3879| enable   | boolean                  | Yes  | Whether to enable cross-device collaboration. The value **true** means to enable distributed notification, and **false** means the opposite.|
3880
3881**Return value**
3882
3883| Type| Description|
3884| ---- | ----|
3885| Promise\<void> | Promise that returns no value.|
3886
3887**Error codes**
3888
3889For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3890
3891| ID| Error Message                                |
3892| -------- | ---------------------------------------- |
3893| 201      | Permission denied.     |
3894| 202      | Not system application to call the interface.                                      |
3895| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3896| 1600001  | Internal error.                          |
3897| 1600002  | Marshalling or unmarshalling error.      |
3898| 1600003  | Failed to connect to the service.               |
3899| 1600010  | Distributed operation failed.            |
3900| 1600012  | No memory space.                    |
3901| 17700001 | The specified bundle name was not found. |
3902
3903**Example**
3904
3905```ts
3906import { BusinessError } from '@kit.BasicServicesKit';
3907
3908let bundle: notificationManager.BundleOption = {
3909    bundle: "bundleName1",
3910    uid: 1
3911};
3912let enable: boolean = true;
3913let deviceType: string = "phone";
3914notificationManager.setDistributedEnabledByBundle(bundle, deviceType, enable).then(() => {
3915    console.info("setDistributedEnabledByBundle success");
3916}).catch((err: BusinessError) => {
3917    console.error(`setDistributedEnabledByBundle fail: ${JSON.stringify(err)}`);
3918});
3919```
3920
3921## notificationManager.isDistributedEnabledByBundle<sup>12+</sup>
3922
3923isDistributedEnabledByBundle(bundle: BundleOption, deviceType: string): Promise<boolean\>
3924
3925Obtains whether a specified application supports cross-device collaboration. This API uses a promise to return the result.
3926
3927**System capability**: SystemCapability.Notification.Notification
3928
3929**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3930
3931**System API**: This is a system API.
3932
3933**Parameters**
3934
3935| Name  | Type                    | Mandatory| Description                      |
3936| -------- | ------------------------ | ---- | -------------------------- |
3937| bundle   | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)             | Yes  | Bundle information of the application.                  |
3938| deviceType | string | Yes  | Device type.|
3939
3940**Return value**
3941
3942| Type| Description|
3943| ---- | ----|
3944| Promise\<boolean\> | Promise used to return the result (true: enabled; false: disabled).|
3945
3946**Error codes**
3947
3948For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
3949
3950| ID| Error Message                                |
3951| -------- | ---------------------------------------- |
3952| 201      | Permission denied.     |
3953| 202      | Not system application to call the interface.                                      |
3954| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
3955| 1600001  | Internal error.                          |
3956| 1600002  | Marshalling or unmarshalling error.      |
3957| 1600003  | Failed to connect to the service.               |
3958| 1600010  | Distributed operation failed.            |
3959| 1600012  | No memory space.                    |
3960| 17700001 | The specified bundle name was not found. |
3961
3962**Example**
3963
3964```ts
3965import { BusinessError } from '@kit.BasicServicesKit';
3966
3967let bundle: notificationManager.BundleOption = {
3968    bundle: "bundleName1",
3969    uid: 1
3970};
3971let deviceType: string = "phone";
3972notificationManager.isDistributedEnabledByBundle(bundle, deviceType).then((data: boolean) => {
3973    console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data));
3974}).catch((err: BusinessError) => {
3975    console.error(`isDistributedEnabledByBundle fail: ${JSON.stringify(err)}`);
3976});
3977```
3978
3979## notificationManager.setSmartReminderEnabled<sup>12+</sup>
3980
3981setSmartReminderEnabled(deviceType: string, enable: boolean): Promise<void\>
3982
3983Sets a smart reminder for cross-device collaboration. This API uses a promise to return the result.
3984
3985**System capability**: SystemCapability.Notification.Notification
3986
3987**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
3988
3989**System API**: This is a system API.
3990
3991**Parameters**
3992
3993| Name  | Type                    | Mandatory| Description                      |
3994| -------- | ------------------------ | ---- | -------------------------- |
3995| deviceType | string | Yes  | Device type.|
3996| enable   | boolean                  | Yes  | Indicates whether the specified application supports a smart reminder for cross-device collaboration (**true**: enabled; **false**: disabled).|
3997
3998**Return value**
3999
4000| Type| Description|
4001| ---- | ----|
4002| Promise\<void> | Promise that returns no value.|
4003
4004**Error codes**
4005
4006For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4007
4008| ID| Error Message                                |
4009| -------- | ---------------------------------------- |
4010| 201      | Permission denied.     |
4011| 202      | Not system application to call the interface.                                      |
4012| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4013| 1600001  | Internal error.                          |
4014| 1600002  | Marshalling or unmarshalling error.      |
4015| 1600003  | Failed to connect to the service.               |
4016| 1600010  | Distributed operation failed.            |
4017| 1600012  | No memory space.                    |
4018| 17700001 | The specified bundle name was not found. |
4019
4020**Example**
4021
4022```ts
4023import { BusinessError } from '@kit.BasicServicesKit';
4024
4025let deviceType: string = "phone";
4026let enable: boolean = true;
4027notificationManager.setSmartReminderEnabled(deviceType, enable).then(() => {
4028    console.info("setSmartReminderEnabled success");
4029}).catch((err: BusinessError) => {
4030    console.error(`setSmartReminderEnabled fail: ${JSON.stringify(err)}`);
4031});
4032```
4033
4034## notificationManager.isSmartReminderEnabled<sup>12+</sup>
4035
4036isSmartReminderEnabled(deviceType: string): Promise<boolean\>
4037
4038Obtains a smart reminder for cross-device collaboration. This API uses a promise to return the result.
4039
4040**System capability**: SystemCapability.Notification.Notification
4041
4042**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
4043
4044**System API**: This is a system API.
4045
4046**Parameters**
4047
4048| Name  | Type                    | Mandatory| Description                      |
4049| -------- | ------------------------ | ---- | -------------------------- |
4050| deviceType | string | Yes  | Device type.|
4051
4052**Return value**
4053
4054| Type| Description|
4055| ---- | ----|
4056| Promise\<boolean\> | Promise used to return the result (**true**: enabled; **false**: disabled).|
4057
4058**Error codes**
4059
4060For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4061
4062| ID| Error Message                                |
4063| -------- | ---------------------------------------- |
4064| 201      | Permission denied.     |
4065| 202      | Not system application to call the interface.                                      |
4066| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4067| 1600001  | Internal error.                          |
4068| 1600002  | Marshalling or unmarshalling error.      |
4069| 1600003  | Failed to connect to the service.               |
4070| 1600010  | Distributed operation failed.            |
4071| 1600012  | No memory space.                    |
4072| 17700001 | The specified bundle name was not found. |
4073
4074**Example**
4075
4076```ts
4077import { BusinessError } from '@kit.BasicServicesKit';
4078
4079let deviceType: string = "phone";
4080notificationManager.isSmartReminderEnabled(deviceType).then((data: boolean) => {
4081    console.info("isSmartReminderEnabled success, data:" + data);
4082}).catch((err: BusinessError) => {
4083    console.error(`isSmartReminderEnabled fail: ${JSON.stringify(err)}`);
4084});
4085```
4086
4087## notificationManager.setBadgeNumberByBundle<sup>12+</sup>
4088
4089setBadgeNumberByBundle(bundle: BundleOption, badgeNumber: number): Promise\<void\>
4090
4091Sets the badge count for other applications. This API uses a promise to return the result.
4092
4093**System capability**: SystemCapability.Notification.Notification
4094
4095**System API**: This is a system API.
4096
4097**Parameters**
4098
4099| Name     | Type  | Mandatory| Description      |
4100| ----------- | ------ | ---- | ---------- |
4101| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
4102| badgeNumber | number | Yes  | Notification badge number to set.|
4103
4104**Return value**
4105
4106| Type           | Description                     |
4107| --------------- | ------------------------- |
4108| Promise\<void\> | Promise that returns no value.|
4109
4110**Error codes**
4111
4112For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4113
4114| ID| Error Message                           |
4115| -------- | ----------------------------------- |
4116| 202      | Not system application to call the interface.                                      |
4117| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4118| 1600001  | Internal error.                     |
4119| 1600002  | Marshalling or unmarshalling error. |
4120| 1600003  | Failed to connect to the service.          |
4121| 1600012  | No memory space.                    |
4122| 1600017  | There is no corresponding agent relationship configuration.     |
4123| 17700001 | The specified bundle name was not found.   |
4124
4125**Example**
4126
4127```ts
4128import { BusinessError } from '@kit.BasicServicesKit';
4129
4130let bundle: notificationManager.BundleOption = {
4131    bundle: 'com.example.bundleName',
4132};
4133let badgeNumber: number = 10;
4134
4135notificationManager.setBadgeNumberByBundle(bundle, badgeNumber).then(() => {
4136    console.info('setBadgeNumberByBundle success');
4137}).catch((err: BusinessError) => {
4138    console.error(`setBadgeNumberByBundle fail: ${JSON.stringify(err)}`);
4139});
4140```
4141
4142## notificationManager.getSlotByBundle<sup>12+</sup>
4143
4144getSlotByBundle(bundle: BundleOption, slotType: SlotType): Promise\<NotificationSlot>
4145
4146Obtains a notification slot of a specified application. This API uses a promise to return the result.
4147
4148Before obtaining the notification slot, create a slot through [addSlot](#notificationmanageraddslot).
4149
4150**System capability**: SystemCapability.Notification.Notification
4151
4152**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
4153
4154**System API**: This is a system API.
4155
4156**Parameters**
4157
4158| Name  | Type        | Mandatory| Description      |
4159| ------ | ------------ | ---- | ---------- |
4160| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes  | Bundle information of the application.|
4161| slotType | [SlotType](././js-apis-notificationManager.md#slottype) | Yes  | Notification slot type.|
4162
4163**Return value**
4164
4165| Type                                                       | Description                                                        |
4166| ----------------------------------------------------------- | ------------------------------------------------------------ |
4167| Promise\<[NotificationSlot](js-apis-inner-notification-notificationSlot-sys.md)> | Promise used to return the result.|
4168
4169**Error codes**
4170
4171For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4172
4173| ID| Error Message                                |
4174| -------- | ---------------------------------------- |
4175| 201      | Permission denied.     |
4176| 202      | Not system application to call the interface.                                      |
4177| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4178| 1600001  | Internal error.                          |
4179| 1600002  | Marshalling or unmarshalling error.      |
4180| 1600003  | Failed to connect to the service.               |
4181| 1600012  | No memory space.                         |
4182| 17700001 | The specified bundle name was not found. |
4183
4184**Example**
4185
4186```ts
4187import { BusinessError } from '@kit.BasicServicesKit';
4188
4189let bundle: notificationManager.BundleOption = {
4190    bundle: "bundleName1",
4191};
4192
4193let slotType = notificationManager.SlotType.LIVE_VIEW;
4194
4195notificationManager.getSlotByBundle(bundle, slotType).then((data: notificationManager.NotificationSlot) => {
4196	console.info("getSlotByBundle success, data: " + JSON.stringify(data));
4197}).catch((err: BusinessError) => {
4198    console.error(`getSlotByBundle fail: ${JSON.stringify(err)}`);
4199});
4200```
4201
4202## notificationManager.addDoNotDisturbProfile<sup>12+</sup>
4203
4204addDoNotDisturbProfile(templates: Array\<DoNotDisturbProfile>): Promise\<void\>
4205
4206Adds the Do Not Disturb profile configuration information. This API uses a promise to return the result.
4207
4208**System capability**: SystemCapability.Notification.Notification
4209
4210**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
4211
4212**System API**: This is a system API.
4213
4214**Parameters**
4215
4216| Name  | Type            | Mandatory| Description          |
4217| ------ | ---------------- | ---- | -------------- |
4218| templates   | Array\<[DoNotDisturbProfile](#donotdisturbprofile12)> | Yes| Configuration information about the Do Not Disturb profile.|
4219
4220**Return value**
4221
4222| Type     | Description       |
4223|---------|-----------|
4224| Promise\<void\> | Promise that returns no value.|
4225
4226**Error codes**
4227
4228For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4229
4230| ID| Error Message                           |
4231| -------- | ----------------------------------- |
4232| 201      | Permission denied.     |
4233| 202      | Not system application to call the interface.                                      |
4234| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4235| 1600001  | Internal error.                     |
4236| 1600002  | Marshalling or unmarshalling error. |
4237| 1600003  | Failed to connect to the service.          |
4238| 1600012  | No memory space.                    |
4239
4240**Example**
4241
4242```ts
4243import { BusinessError } from '@kit.BasicServicesKit';
4244
4245let trustlist: Array<notificationManager.BundleOption> = [
4246  {
4247    bundle: 'com.example.bundleName',
4248    uid: 0
4249  },
4250  {
4251    bundle: 'com.example.bundleName1',
4252    uid: 1
4253  }
4254]
4255let templates: Array<notificationManager.DoNotDisturbProfile> = [
4256  {
4257    id: 3,
4258    name: 'working mode',
4259    trustlist: trustlist
4260  }
4261]
4262
4263notificationManager.addDoNotDisturbProfile(templates).then(() => {
4264  console.info("addDoNotDisturbProfile success.");
4265}).catch((error: BusinessError) => {
4266  console.error(`addDoNotDisturbProfile fail: ${JSON.stringify(error)}`);
4267});
4268```
4269
4270## notificationManager.removeDoNotDisturbProfile<sup>12+</sup>
4271
4272removeDoNotDisturbProfile(templates: Array\<DoNotDisturbProfile>): Promise\<void\>
4273
4274Deletes the Do Not Disturb profile configuration. This API uses a promise to return the result.
4275
4276**System capability**: SystemCapability.Notification.Notification
4277
4278**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
4279
4280**System API**: This is a system API.
4281
4282**Parameters**
4283
4284| Name  | Type            | Mandatory| Description          |
4285| ------ | ---------------- | ---- | -------------- |
4286| templates   | Array\<[DoNotDisturbProfile](#donotdisturbprofile12)> | Yes | Configuration information about the Do Not Disturb profile.|
4287
4288**Return value**
4289
4290| Type     | Description       |
4291|---------|-----------|
4292| Promise\<void\> | Promise that returns no value.|
4293
4294**Error codes**
4295
4296For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4297
4298| ID| Error Message                           |
4299| -------- | ----------------------------------- |
4300| 201      | Permission denied.     |
4301| 202      | Not system application to call the interface.                                      |
4302| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4303| 1600001  | Internal error.                     |
4304| 1600002  | Marshalling or unmarshalling error. |
4305| 1600003  | Failed to connect to the service.          |
4306| 1600012  | No memory space.                    |
4307
4308**Example**
4309
4310```ts
4311import { BusinessError } from '@kit.BasicServicesKit';
4312
4313let templates: Array<notificationManager.DoNotDisturbProfile> = [
4314  {
4315    id: 3,
4316    name: 'working mode'
4317  }
4318]
4319notificationManager.removeDoNotDisturbProfile(templates).then(() => {
4320  console.info("removeDoNotDisturbProfile success.");
4321}).catch((error: BusinessError) => {
4322  console.error(`removeDoNotDisturbProfile fail: ${JSON.stringify(error)}`);
4323});
4324```
4325
4326## notificationManager.setAdditionalConfig<sup>12+</sup>
4327
4328setAdditionalConfig(key: string, value: string): Promise\<number\>
4329
4330Sets the additional system configuration information of the notification. This API uses a promise to return the result.
4331
4332**System capability**: SystemCapability.Notification.Notification
4333
4334**Required permissions**: ohos.permission.NOTIFICATION_AGENT_CONTROLLER
4335
4336**System API**: This is a system API.
4337
4338**Parameters**
4339
4340| Name  | Type            | Mandatory| Description          |
4341| ------ | ---------------- | ---- | -------------- |
4342| key   | string | Yes | Additional configuration key. Currently, only **RING_TRUSTLIST_PKG** is supported, indicating that the application supports [customized ring tone](./js-apis-inner-notification-notificationRequest.md#notificationrequest-1).|
4343| value   | string | Yes | Additional configuration value. Example: [bundleName1,bundleName2].|
4344
4345**Return value**
4346
4347| Type     | Description       |
4348|---------|-----------|
4349| Promise\<number\> | Promise used to return the result. **0** indicates successful; other values indicate failed.|
4350
4351**Error codes**
4352
4353For details about the error codes, see [Notification Error Codes](./errorcode-notification.md).
4354
4355| ID| Error Message                           |
4356| -------- | ----------------------------------- |
4357| 201      | Permission denied.     |
4358| 202      | Not system application to call the interface.                                      |
4359| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4360| 1600001  | Internal error.                     |
4361| 1600002  | Marshalling or unmarshalling error. |
4362| 1600003  | Failed to connect to the service.          |
4363
4364**Example**
4365
4366```ts
4367import { BusinessError } from '@kit.BasicServicesKit';
4368
4369notificationManager.setAdditionalConfig('RING_TRUSTLIST_PKG','[bundleName1,bundleName2]').then((data: number) => {
4370  console.info("setAdditionalConfig success, data: " + JSON.stringify(data));
4371}).catch((error: BusinessError) => {
4372  console.error(`setAdditionalConfig fail: ${JSON.stringify(error)}`);
4373});
4374```
4375
4376## notificationManager.getDoNotDisturbProfile<sup>13+</sup>
4377
4378getDoNotDisturbProfile(id: number): Promise\<DoNotDisturbProfile\>
4379
4380Queries the configuration information about the Do Not Disturb profile. This API uses a promise to return the result.
4381
4382**System capability**: SystemCapability.Notification.Notification
4383
4384**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER
4385
4386**System API**: This is a system API.
4387
4388**Parameters**
4389
4390| Name  | Type            | Mandatory| Description          |
4391| ------ | ---------------- | ---- | -------------- |
4392| id   | number | Yes | ID of the Do Not Disturb profile.|
4393
4394**Return value**
4395
4396| Type     | Description       |
4397|---------|-----------|
4398| Promise\<[DoNotDisturbProfile](#donotdisturbprofile12)\> | Promise used to return the result.|
4399
4400**Error codes**
4401
4402For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Notification Error Codes](./errorcode-notification.md).
4403
4404| ID| Error Message                           |
4405| -------- | ----------------------------------- |
4406| 201      | Permission denied.     |
4407| 202      | Not system application to call the interface.                                      |
4408| 401     | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 2. Incorrect parameter types. 3.Parameter verification failed.      |
4409| 1600001  | Internal error.                     |
4410| 1600002  | Marshalling or unmarshalling error. |
4411| 1600003  | Failed to connect to the service.          |
4412| 1600019  | The do-not-disturb profile does not exist.                    |
4413
4414**Example**
4415
4416```ts
4417import { BusinessError } from '@kit.BasicServicesKit';
4418
4419notificationManager.getDoNotDisturbProfile(1).then((data: notificationManager.DoNotDisturbProfile) => {
4420  console.info("getDoNotDisturbProfile success: " + JSON.stringify(data));
4421}).catch((error: BusinessError) => {
4422  console.error(`getDoNotDisturbProfile fail: ${JSON.stringify(error)}`);
4423});
4424```
4425
4426## DoNotDisturbDate
4427
4428**System capability**: SystemCapability.Notification.Notification
4429
4430**System API**: This is a system API.
4431
4432| Name | Type                                 | Mandatory| Description                  |
4433| ----- | ------------------------------------- | ---- | ---------------------- |
4434| type  | [DoNotDisturbType](#donotdisturbtype) | Yes  | DND time type.|
4435| begin | Date                                  | Yes  | DND start time.|
4436| end   | Date                                  | Yes  | DND end time.|
4437
4438## DoNotDisturbType
4439
4440**System capability**: SystemCapability.Notification.Notification
4441
4442**System API**: This is a system API.
4443
4444| Name        | Value              | Description                                      |
4445| ------------ | ---------------- | ------------------------------------------ |
4446| TYPE_NONE    | 0 | Non-DND.                          |
4447| TYPE_ONCE    | 1 | One-shot DND at the specified time segment (only considering the hour and minute).|
4448| TYPE_DAILY   | 2 | Daily DND at the specified time segment (only considering the hour and minute).|
4449| TYPE_CLEARLY | 3 | DND at the specified time segment (with the hour, day, and month specified).    |
4450
4451
4452## DeviceRemindType
4453
4454**System capability**: SystemCapability.Notification.Notification
4455
4456**System API**: This is a system API.
4457
4458| Name                | Value | Description                              |
4459| -------------------- | --- | --------------------------------- |
4460| IDLE_DONOT_REMIND    | 0   | The device is not in use. No notification is required.           |
4461| IDLE_REMIND          | 1   | The device is not in use.                |
4462| ACTIVE_DONOT_REMIND  | 2   | The device is in use. No notification is required.           |
4463| ACTIVE_REMIND        | 3   | The device is in use.                |
4464
4465
4466## SourceType
4467
4468**System capability**: SystemCapability.Notification.Notification
4469
4470**System API**: This is a system API.
4471
4472| Name                | Value | Description                 |
4473| -------------------- | --- | -------------------- |
4474| TYPE_NORMAL          | 0   | Normal notification.           |
4475| TYPE_CONTINUOUS      | 1   | Continuous notification.           |
4476| TYPE_TIMER           | 2   | Timed notification.           |
4477
4478## NotificationCheckInfo<sup>10+</sup>
4479
4480**System capability**: SystemCapability.Notification.Notification
4481
4482**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
4483
4484**System API**: This is a system API.
4485
4486| Name                        | Type                        | Mandatory| Description           |
4487| ---------------------------- | ---------------------------- | --- | --------------- |
4488| bundleName                   | string                       | Yes  | Bundle name.   |
4489| notificationId               | number                       | Yes  | Notification ID.       |
4490| label<sup>11+</sup>          | string                       | No  | Notification label.     |
4491| contentType                  | [ContentType](./js-apis-notificationManager.md#contenttype)  | Yes  | Notification type.     |
4492| creatorUserId<sup>11+</sup>  | number                       | Yes  | User ID of the notification.|
4493| slotType<sup>11+</sup>       | [SlotType](./js-apis-notificationManager.md#slottype)        | Yes  | Notification slot type.     |
4494| extraInfos<sup>11+</sup>     | [key: string]: object        | No  | Extra information about the live view.|
4495
4496## NotificationCheckResult<sup>10+</sup>
4497
4498**System capability**: SystemCapability.Notification.Notification
4499
4500**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
4501
4502**System API**: This is a system API.
4503
4504| Name   | Type                                 | Mandatory| Description                  |
4505| ------- | ------------------------------------ | ---- | ---------------------- |
4506| code    | number                               | Yes  | Result code.<br>**0**: display.<br>**1**: no display.|
4507| message | string                               | Yes  | Result.   |
4508
4509
4510## ButtonOptions<sup>11+</sup>
4511
4512Provides the button information of the notification.
4513
4514**System capability**: SystemCapability.Notification.Notification
4515
4516**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER
4517
4518**System API**: This is a system API.
4519
4520| Name   | Type                                 | Mandatory| Description                  |
4521| ------- | ------------------------------------ | ---- | ---------------------- |
4522| buttonName    | string                         | Yes  | Button name.|
4523
4524
4525## SystemLiveViewSubscriber<sup>11+</sup>
4526
4527Subscriber of the system live view notification.
4528
4529**System capability**: SystemCapability.Notification.Notification
4530
4531**System API**: This is a system API.
4532
4533
4534| Name   | Type                                 | Mandatory| Description                  |
4535| ------- | ------------------------------------ | ---- | ---------------------- |
4536| onResponse    | (notificationId: number, buttonOptions: [ButtonOptions](#buttonoptions11)) => void                         | No  | Callback when the button is touched.|
4537
4538
4539## SlotType
4540
4541**System capability**: SystemCapability.Notification.Notification
4542
4543| Name                               | Value    | Description                                                        |
4544| ----------------------------------- | ------ | ------------------------------------------------------------ |
4545| EMERGENCY_INFORMATION<sup>12+</sup> | 10     | Emergency event. **System API**: This is a system API.                              |
4546
4547
4548## NotificationControlFlagStatus<sup>12+</sup>
4549Each bit can control the notification mode. When the bitwise OR operation is performed on **notificationControlFlags** and the enumerated values in the following table, the notification mode is disabled.
4550
4551**System capability**: SystemCapability.Notification.Notification
4552
4553**System API**: This is a system API.
4554
4555| Name                                | Value  | Description    |
4556| ------------------------------------ | ---- | -------- |
4557| NOTIFICATION_STATUS_CLOSE_SOUND      | 1<<0 | Disables the sound notification function.|
4558| NOTIFICATION_STATUS_CLOSE_LOCKSCREEN |  1<<1    |     Disables the screen lock notification function.    |
4559| NOTIFICATION_STATUS_CLOSE_BANNER     |    1<<2   |     Disables the banner notification function.    |
4560| NOTIFICATION_STATUS_CLOSE_LIGHT_SCREEN     |   1<<3   |     Disables the screen-on notification function.    |
4561| NOTIFICATION_STATUS_CLOSE_VIBRATION     |   1<<4   |     Disables the vibration notification function.    |
4562| NOTIFICATION_STATUS_CLOSE_STATUSBAR_ICON     |  1<<5    |     Disables the icon notification function in the status bar.    |
4563
4564## DoNotDisturbProfile<sup>12+</sup>
4565
4566**System capability**: SystemCapability.Notification.Notification
4567
4568**System API**: This is a system API.
4569
4570| Name | Type                                 | Mandatory| Description                  |
4571| ----- | ------------------------------------- | ---- | ---------------------- |
4572| id | number | Yes| ID of the Do Not Disturb profile.|
4573| name | string  | Yes| Name of the Do Not Disturb profile.|
4574| trustlist | Array\<[BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption)> | No| Trustlist in Do Not Disturb profile.|
4575