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