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