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