1# @ohos.reminderAgentManager (Agent-Powered Reminders) 2 3The reminderAgentManager module provides APIs related to agent-powered reminders. When your application is frozen or exits, the timing and notification functions of your application will be taken over by a system service running in the background. You can use the APIs to create scheduled reminders for countdown timers, calendar events, and alarm clocks. 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 10## Modules to Import 11 12```ts 13import { reminderAgentManager } from '@kit.BackgroundTasksKit'; 14``` 15 16## reminderAgentManager.publishReminder 17 18publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void 19 20Publishes a reminder. This API uses an asynchronous callback to return the result. 21 22> **NOTE** 23> 24> This API can be called only after the [NotificationManager.requestEnableNotification](../apis-notification-kit/js-apis-notificationManager.md#notificationmanagerrequestenablenotification10) permission is obtained. 25> 26> <!--RP1--><!--RP1End--> 27 28**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER 29 30**System capability**: SystemCapability.Notification.ReminderAgent 31 32**Parameters** 33 34 | Name| Type| Mandatory| Description| 35 | -------- | -------- | -------- | -------- | 36 | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Request used for publishing the reminder.| 37 | callback | AsyncCallback\<number> | Yes| Callback used to return the published reminder's ID.| 38 39**Error codes** 40 41For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 42 43| ID | Error Message| 44| --------- | ------- | 45| 401 | If the input parameter is not valid parameter. | 46| 1700001 | Notification is not enabled. | 47| 1700002 | The number of reminders exceeds the limit. | 48 49**Example** 50```ts 51import { BusinessError } from '@kit.BasicServicesKit'; 52 53let timer: reminderAgentManager.ReminderRequestTimer = { 54 reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, 55 triggerTimeInSeconds: 10 56} 57 58reminderAgentManager.publishReminder(timer, (err: BusinessError, reminderId: number) => { 59 if (err.code) { 60 console.error("callback err code:" + err.code + " message:" + err.message); 61 } else { 62 console.log("callback, reminderId = " + reminderId); 63 } 64}); 65``` 66 67## reminderAgentManager.publishReminder 68 69publishReminder(reminderReq: ReminderRequest): Promise\<number> 70 71Publishes a reminder. This API uses a promise to return the result. 72 73> **NOTE** 74> 75> This API can be called only after the [NotificationManager.requestEnableNotification](../apis-notification-kit/js-apis-notificationManager.md#notificationmanagerrequestenablenotification10) permission is obtained. 76> 77> <!--RP1--><!--RP1End--> 78 79**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER 80 81**System capability**: SystemCapability.Notification.ReminderAgent 82 83**Parameters** 84 85 | Name| Type| Mandatory| Description| 86 | -------- | -------- | -------- | -------- | 87 | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Request used for publishing the reminder.| 88 89**Return value** 90 91| Type| Description| 92| -------- | -------- | 93| Promise\<number> | Promise used to return the published reminder ID.| 94 95**Error codes** 96 97For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 98 99| ID | Error Message| 100| --------- | ------- | 101| 401 | If the input parameter is not valid parameter. | 102| 1700001 | Notification is not enabled. | 103| 1700002 | The number of reminders exceeds the limit. | 104 105**Example** 106```ts 107import { BusinessError } from '@kit.BasicServicesKit'; 108 109let timer: reminderAgentManager.ReminderRequestTimer = { 110 reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, 111 triggerTimeInSeconds: 10 112} 113 114reminderAgentManager.publishReminder(timer).then((reminderId: number) => { 115 console.log("promise, reminderId = " + reminderId); 116}).catch((err: BusinessError) => { 117 console.error("promise err code:" + err.code + " message:" + err.message); 118}); 119``` 120 121 122## reminderAgentManager.cancelReminder 123 124cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void 125 126Cancels a reminder published. This API uses an asynchronous callback to return the result. 127 128**System capability**: SystemCapability.Notification.ReminderAgent 129 130**Parameters** 131 132| Name| Type| Mandatory| Description| 133| -------- | -------- | -------- | -------- | 134| reminderId | number | Yes| ID of the reminder to cancel.| 135| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the reminder is canceled, **err** is **undefined**. Otherwise, **err** is an error object.| 136 137**Error codes** 138 139For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 140 141| ID | Error Message| 142| --------- | ------- | 143| 401 | If the input parameter is not valid parameter. | 144| 1700003 | The reminder does not exist. | 145| 1700004 | The bundle name does not exist. | 146 147**Example** 148 149```ts 150import { BusinessError } from '@kit.BasicServicesKit'; 151 152let reminderId: number = 1; 153reminderAgentManager.cancelReminder(reminderId, (err: BusinessError) => { 154 if (err.code) { 155 console.error("callback err code:" + err.code + " message:" + err.message); 156 } else { 157 console.log("cancelReminder callback"); 158 } 159}); 160``` 161 162## reminderAgentManager.cancelReminder 163 164cancelReminder(reminderId: number): Promise\<void> 165 166Cancels a reminder published. This API uses a promise to return the result. 167 168**System capability**: SystemCapability.Notification.ReminderAgent 169 170**Parameters** 171 172| Name| Type| Mandatory| Description| 173| -------- | -------- | -------- | -------- | 174| reminderId | number | Yes| ID of the reminder to cancel.| 175 176**Return value** 177 178| Type| Description| 179| -------- | -------- | 180| Promise\<void> | Promise that returns no value.| 181 182**Error codes** 183 184For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 185 186| ID | Error Message| 187| --------- | ------- | 188| 401 | If the input parameter is not valid parameter. | 189| 1700003 | The reminder does not exist. | 190| 1700004 | The bundle name does not exist. | 191 192**Example** 193 194```ts 195import { BusinessError } from '@kit.BasicServicesKit'; 196 197let reminderId: number = 1; 198reminderAgentManager.cancelReminder(reminderId).then(() => { 199 console.log("cancelReminder promise"); 200}).catch((err: BusinessError) => { 201 console.error("promise err code:" + err.code + " message:" + err.message); 202}); 203``` 204 205## reminderAgentManager.getValidReminders 206 207getValidReminders(callback: AsyncCallback<Array\<ReminderRequest>>): void 208 209Obtains all [valid (not yet expired) reminders](../../task-management/agent-powered-reminder.md#constraints) set by the current application. This API uses an asynchronous callback to return the result. 210 211**System capability**: SystemCapability.Notification.ReminderAgent 212 213**Parameters** 214 215| Name| Type| Mandatory| Description| 216| -------- | -------- | -------- | -------- | 217| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)>> | Yes| Callback used to return all the valid reminders.| 218 219**Error codes** 220 221For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 222 223| ID | Error Message| 224| --------- | ------- | 225| 401 | If the input parameter is not valid parameter. | 226| 1700004 | The bundle name does not exist. | 227 228**Example** 229 230```ts 231import { BusinessError } from '@kit.BasicServicesKit'; 232 233reminderAgentManager.getValidReminders((err: BusinessError, reminders: Array<reminderAgentManager.ReminderRequest>) => { 234 if (err.code) { 235 console.error("callback err code:" + err.code + " message:" + err.message); 236 } else { 237 console.log("callback, getValidReminders length = " + reminders.length); 238 for (let i = 0; i < reminders.length; i++) { 239 console.log("getValidReminders = " + reminders[i]); 240 console.log("getValidReminders, reminderType = " + reminders[i].reminderType); 241 const actionButton = reminders[i].actionButton || []; 242 for (let j = 0; j < actionButton.length; j++) { 243 console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title); 244 console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type); 245 } 246 console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName); 247 console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName); 248 console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); 249 console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes); 250 console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval); 251 console.log("getValidReminders, title = " + reminders[i].title); 252 console.log("getValidReminders, content = " + reminders[i].content); 253 console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent); 254 console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent); 255 console.log("getValidReminders, notificationId = " + reminders[i].notificationId); 256 console.log("getValidReminders, slotType = " + reminders[i].slotType); 257 } 258 } 259}); 260``` 261 262## reminderAgentManager.getValidReminders 263 264getValidReminders(): Promise\<Array\<ReminderRequest>> 265 266Obtains all [valid (not yet expired) reminders](../../task-management/agent-powered-reminder.md#constraints) set by the current application. This API uses a promise to return the result. 267 268**System capability**: SystemCapability.Notification.ReminderAgent 269 270**Return value** 271 272| Type| Description| 273| -------- | -------- | 274| Promise\<Array\<[ReminderRequest](#reminderrequest)>> | Promise used to return all the valid reminders.| 275 276**Error codes** 277 278For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 279 280| ID | Error Message| 281| --------- | ------- | 282| 401 | If the input parameter is not valid parameter. | 283| 1700004 | The bundle name does not exist. | 284 285**Example** 286 287```ts 288import { BusinessError } from '@kit.BasicServicesKit'; 289 290reminderAgentManager.getValidReminders().then((reminders: Array<reminderAgentManager.ReminderRequest>) => { 291 console.log("promise, getValidReminders length = " + reminders.length); 292 for (let i = 0; i < reminders.length; i++) { 293 console.log("getValidReminders = " + reminders[i]); 294 console.log("getValidReminders, reminderType = " + reminders[i].reminderType); 295 const actionButton = reminders[i].actionButton || []; 296 for (let j = 0; j < actionButton.length; j++) { 297 console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title); 298 console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type); 299 } 300 console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName); 301 console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName); 302 console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); 303 console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes); 304 console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval); 305 console.log("getValidReminders, title = " + reminders[i].title); 306 console.log("getValidReminders, content = " + reminders[i].content); 307 console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent); 308 console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent); 309 console.log("getValidReminders, notificationId = " + reminders[i].notificationId); 310 console.log("getValidReminders, slotType = " + reminders[i].slotType); 311 } 312}).catch((err: BusinessError) => { 313 console.error("promise err code:" + err.code + " message:" + err.message); 314}); 315``` 316 317## reminderAgentManager.cancelAllReminders 318 319cancelAllReminders(callback: AsyncCallback\<void>): void 320 321Cancels all reminders set by the current application. This API uses an asynchronous callback to return the result. 322 323**System capability**: SystemCapability.Notification.ReminderAgent 324 325**Parameters** 326 327| Name| Type| Mandatory| Description| 328| -------- | -------- | -------- | -------- | 329| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If all the reminders are canceled, **err** is **undefined**. Otherwise, **err** is an error object. | 330 331**Error codes** 332 333For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 334 335| ID | Error Message| 336| --------- | ------- | 337| 401 | If the input parameter is not valid parameter. | 338| 1700004 | The bundle name does not exist. | 339 340**Example** 341 342```ts 343import { BusinessError } from '@kit.BasicServicesKit'; 344 345reminderAgentManager.cancelAllReminders((err: BusinessError) =>{ 346 if (err.code) { 347 console.error("callback err code:" + err.code + " message:" + err.message); 348 } else { 349 console.log("cancelAllReminders callback") 350 } 351}); 352``` 353 354## reminderAgentManager.cancelAllReminders 355 356cancelAllReminders(): Promise\<void> 357 358Cancels all reminders set by the current application. This API uses a promise to return the result. 359 360**System capability**: SystemCapability.Notification.ReminderAgent 361 362**Return value** 363 364| Type| Description| 365| -------- | -------- | 366| Promise\<void> | Promise that returns no value.| 367 368**Error codes** 369 370For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 371 372| ID | Error Message| 373| --------- | ------- | 374| 401 | If the input parameter is not valid parameter. | 375| 1700004 | The bundle name does not exist. | 376 377**Example** 378 379```ts 380import { BusinessError } from '@kit.BasicServicesKit'; 381 382reminderAgentManager.cancelAllReminders().then(() => { 383 console.log("cancelAllReminders promise") 384}).catch((err: BusinessError) => { 385 console.error("promise err code:" + err.code + " message:" + err.message); 386}); 387``` 388 389 390## reminderAgentManager.addNotificationSlot 391 392addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void 393 394Adds a notification slot. This API uses an asynchronous callback to return the result. 395 396**System capability**: SystemCapability.Notification.ReminderAgent 397 398**Parameters** 399 400| Name| Type| Mandatory| Description| 401| -------- | -------- | -------- | -------- | 402| slot | [NotificationSlot](../apis-notification-kit/js-apis-inner-notification-notificationSlot.md#notificationslot) | Yes| notificationManager\.slot instance. Only **notificationType** can be set.| 403| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the notification slot is added, **err** is **undefined**. Otherwise, **err** is an error object.| 404 405**Error codes** 406 407For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 408 409| ID| Error Message | 410| -------- | ---------------------------------------------- | 411| 401 | If the input parameter is not valid parameter. | 412 413**Example** 414 415```ts 416import { notificationManager } from '@kit.NotificationKit'; 417import { BusinessError } from '@kit.BasicServicesKit'; 418 419let mySlot: notificationManager.NotificationSlot = { 420 notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION 421} 422 423reminderAgentManager.addNotificationSlot(mySlot, (err: BusinessError) => { 424 if (err.code) { 425 console.error("callback err code:" + err.code + " message:" + err.message); 426 } else { 427 console.log("addNotificationSlot callback"); 428 } 429}); 430``` 431 432 433## reminderAgentManager.addNotificationSlot 434 435addNotificationSlot(slot: NotificationSlot): Promise\<void> 436 437Adds a notification slot. This API uses a promise to return the result. 438 439**System capability**: SystemCapability.Notification.ReminderAgent 440 441**Parameters** 442 443| Name| Type| Mandatory| Description| 444| -------- | -------- | -------- | -------- | 445| slot | [NotificationSlot](../apis-notification-kit/js-apis-inner-notification-notificationSlot.md#notificationslot) | Yes| notificationManager\.slot instance. Only **notificationType** can be set.| 446 447**Return value** 448 449| Type| Description| 450| -------- | -------- | 451| Promise\<void> | Promise that returns no value.| 452 453**Error codes** 454 455For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 456 457| ID| Error Message | 458| -------- | ---------------------------------------------- | 459| 401 | If the input parameter is not valid parameter. | 460 461**Example** 462 463```ts 464import { notificationManager } from '@kit.NotificationKit'; 465import { BusinessError } from '@kit.BasicServicesKit'; 466 467let mySlot: notificationManager.NotificationSlot = { 468 notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION 469} 470reminderAgentManager.addNotificationSlot(mySlot).then(() => { 471 console.log("addNotificationSlot promise"); 472}).catch((err: BusinessError) => { 473 console.error("promise err code:" + err.code + " message:" + err.message); 474}); 475``` 476 477 478## reminderAgentManager.removeNotificationSlot 479 480removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void 481 482Removes a notification slot. This API uses an asynchronous callback to return the result. 483 484**System capability**: SystemCapability.Notification.ReminderAgent 485 486**Parameters** 487 488| Name| Type| Mandatory| Description| 489| -------- | -------- | -------- | -------- | 490| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notification.md#slottype) | Yes| Type of the notification slot.| 491| callback | AsyncCallback\<void> | Yes| Callback used to return the result. If the notification slot is removed, **err** is **undefined**. Otherwise, **err** is an error object.| 492 493**Error codes** 494 495For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 496 497| ID| Error Message | 498| -------- | ---------------------------------------------- | 499| 401 | If the input parameter is not valid parameter. | 500 501**Example** 502 503```ts 504import { notificationManager } from '@kit.NotificationKit'; 505import { BusinessError } from '@kit.BasicServicesKit'; 506 507reminderAgentManager.removeNotificationSlot(notificationManager.SlotType.CONTENT_INFORMATION, 508 (err: BusinessError) => { 509 if (err.code) { 510 console.error("callback err code:" + err.code + " message:" + err.message); 511 } else { 512 console.log("removeNotificationSlot callback"); 513 } 514}); 515``` 516 517 518## reminderAgentManager.removeNotificationSlot 519 520removeNotificationSlot(slotType: notification.SlotType): Promise\<void> 521 522Removes a notification slot. This API uses a promise to return the result. 523 524**System capability**: SystemCapability.Notification.ReminderAgent 525 526**Parameters** 527 528| Name| Type| Mandatory| Description| 529| -------- | -------- | -------- | -------- | 530| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notification.md#slottype) | Yes| Type of the notification slot.| 531 532**Return value** 533 534| Type| Description| 535| -------- | -------- | 536| Promise\<void> | Promise that returns no value.| 537 538**Error codes** 539 540For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 541 542| ID| Error Message | 543| -------- | ---------------------------------------------- | 544| 401 | If the input parameter is not valid parameter. | 545 546**Example** 547 548```ts 549import { notificationManager } from '@kit.NotificationKit'; 550import { BusinessError } from '@kit.BasicServicesKit'; 551 552reminderAgentManager.removeNotificationSlot(notificationManager.SlotType.CONTENT_INFORMATION).then(() => { 553 console.log("removeNotificationSlot promise"); 554}).catch((err: BusinessError) => { 555 console.error("promise err code:" + err.code + " message:" + err.message); 556}); 557``` 558 559## reminderAgentManager.getAllValidReminders<sup>12+</sup> 560 561getAllValidReminders(): Promise\<Array\<ReminderInfo>> 562 563Obtains all [valid (not yet expired) reminders](../../task-management/agent-powered-reminder.md#constraints) set by the current application. This API uses a promise to return the result. 564 565**System capability**: SystemCapability.Notification.ReminderAgent 566 567**Return value** 568 569| Type | Description | 570| ------------------------------------------------- | ------------------------------------------------------------ | 571| Promise\<Array\<[ReminderInfo](#reminderinfo12)>> | Promise used to return all the valid reminders.| 572 573**Error codes** 574 575For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 576 577| ID| Error Message | 578| -------- | ------------------ | 579| 201 | Permission denied. | 580 581**Example** 582 583```ts 584import { BusinessError } from '@kit.BasicServicesKit'; 585 586reminderAgentManager.getAllValidReminders().then((reminders: Array<reminderAgentManager.ReminderInfo>) => { 587 console.log("promise, getAllValidReminders length = " + reminders.length); 588 for (let i = 0; i < reminders.length; i++) { 589 console.log("getAllValidReminders, reminderId = " + reminders[i].reminderId); 590 console.log("getAllValidReminders, reminderType = " + reminders[i].reminderReq.reminderType); 591 const actionButton = reminders[i].reminderReq.actionButton || []; 592 for (let j = 0; j < actionButton.length; j++) { 593 console.log("getAllValidReminders, actionButton.title = " + actionButton[j]?.title); 594 console.log("getAllValidReminders, actionButton.type = " + actionButton[j]?.type); 595 } 596 console.log("getAllValidReminders, wantAgent.pkgName = " + reminders[i].reminderReq.wantAgent?.pkgName); 597 console.log("getAllValidReminders, wantAgent.abilityName = " + reminders[i].reminderReq.wantAgent?.abilityName); 598 console.log("getAllValidReminders, ringDuration = " + reminders[i].reminderReq.ringDuration); 599 console.log("getAllValidReminders, snoozeTimes = " + reminders[i].reminderReq.snoozeTimes); 600 console.log("getAllValidReminders, timeInterval = " + reminders[i].reminderReq.timeInterval); 601 console.log("getAllValidReminders, title = " + reminders[i].reminderReq.title); 602 console.log("getAllValidReminders, content = " + reminders[i].reminderReq.content); 603 console.log("getAllValidReminders, expiredContent = " + reminders[i].reminderReq.expiredContent); 604 console.log("getAllValidReminders, snoozeContent = " + reminders[i].reminderReq.snoozeContent); 605 console.log("getAllValidReminders, notificationId = " + reminders[i].reminderReq.notificationId); 606 console.log("getAllValidReminders, slotType = " + reminders[i].reminderReq.slotType); 607 } 608}).catch((err: BusinessError) => { 609 console.error("promise err code:" + err.code + " message:" + err.message); 610}); 611``` 612 613## reminderAgentManager.addExcludeDate<sup>12+</sup> 614 615addExcludeDate(reminderId: number, date: Date): Promise\<void> 616 617Adds a non-reminder date for a recurring calendar reminder with a specific ID. For example, configure a daily reminder to skip notifications on Tuesdays. This API uses a promise to return the result. 618 619**System capability**: SystemCapability.Notification.ReminderAgent 620 621**Parameters** 622 623| Name | Type | Mandatory| Description | 624| ---------- | ------ | ---- | ---------------------------------- | 625| reminderId | number | Yes | ID of the recurring calendar reminder.| 626| date | Date | Yes | Non-reminder date. | 627 628**Return value** 629 630| Type | Description | 631| -------------- | ------------------------- | 632| Promise\<void> | Promise that returns no value.| 633 634**Error codes** 635 636For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 637 638| ID| Error Message | 639| -------- | ---------------------------------------------- | 640| 201 | Permission denied. | 641| 401 | If the input parameter is not valid parameter. | 642| 1700003 | The reminder does not exist. | 643 644**Example** 645 646```ts 647import { BusinessError } from '@kit.BasicServicesKit'; 648 649let reminderId: number = 1; 650let date = new Date(); 651reminderAgentManager.addExcludeDate(reminderId, date).then(() => { 652 console.log("addExcludeDate promise"); 653}).catch((err: BusinessError) => { 654 console.error("promise err code:" + err.code + " message:" + err.message); 655}); 656``` 657 658## reminderAgentManager.deleteExcludeDates<sup>12+</sup> 659 660deleteExcludeDates(reminderId: number): Promise\<void> 661 662Deletes all non-reminder dates for a recurring calendar reminder with a specific ID. This API uses a promise to return the result. 663 664**System capability**: SystemCapability.Notification.ReminderAgent 665 666**Parameters** 667 668| Name | Type | Mandatory| Description | 669| ---------- | ------ | ---- | ---------------------------------- | 670| reminderId | number | Yes | ID of the recurring calendar reminder.| 671 672**Return value** 673 674| Type | Description | 675| -------------- | ------------------------- | 676| Promise\<void> | Promise that returns no value.| 677 678**Error codes** 679 680For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 681 682| ID| Error Message | 683| -------- | ---------------------------- | 684| 201 | Permission denied. | 685| 1700003 | The reminder does not exist. | 686 687**Example** 688 689```ts 690import { BusinessError } from '@kit.BasicServicesKit'; 691 692let reminderId: number = 1; 693reminderAgentManager.deleteExcludeDates(reminderId).then(() => { 694 console.log("deleteExcludeDates promise"); 695}).catch((err: BusinessError) => { 696 console.error("promise err code:" + err.code + " message:" + err.message); 697}); 698``` 699 700## reminderAgentManager.getExcludeDates<sup>12+</sup> 701 702getExcludeDates(reminderId: number): Promise\<Array\<Date>> 703 704Obtains all non-reminder dates for a recurring calendar reminder with a specific ID. This API uses a promise to return the result. 705 706**System capability**: SystemCapability.Notification.ReminderAgent 707 708**Parameters** 709 710| Name | Type | Mandatory| Description | 711| ---------- | ------ | ---- | ---------------------------------- | 712| reminderId | number | Yes | ID of the recurring calendar reminder.| 713 714**Return value** 715 716| Type | Description | 717| ---------------------- | --------------------------------- | 718| Promise\<Array\<Date>> | Promise used to return all the non-reminder dates.| 719 720**Error codes** 721 722For details about the error codes, see [reminderAgentManager Error Codes](errorcode-reminderAgentManager.md) and [Universal Error Codes](../errorcode-universal.md). 723 724| ID| Error Message | 725| -------- | ---------------------------- | 726| 201 | Permission denied. | 727| 1700003 | The reminder does not exist. | 728 729**Example** 730 731```ts 732import { BusinessError } from '@kit.BasicServicesKit'; 733 734let reminderId: number = 1; 735reminderAgentManager.getExcludeDates(reminderId).then((dates) => { 736 console.log("getExcludeDates promise length: " + dates.length); 737 for (let i = 0; i < dates.length; i++) { 738 console.log("getExcludeDates promise date is: " + dates[i].toString()); 739 } 740}).catch((err: BusinessError) => { 741 console.error("promise err code:" + err.code + " message:" + err.message); 742}); 743``` 744 745## ActionButtonType 746 747Enumerates the types of buttons displayed for a reminder. 748 749**System capability**: SystemCapability.Notification.ReminderAgent 750 751| Name| Value| Description| 752| -------- | -------- | -------- | 753| ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.| 754| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder, with the frequency and timing configured via **snoozeTimes** and **timeInterval** in the **ReminderRequest** struct.| 755 756## ReminderType 757 758Enumerates the reminder types. 759 760**System capability**: SystemCapability.Notification.ReminderAgent 761 762| Name| Value| Description| 763| -------- | -------- | -------- | 764| REMINDER_TYPE_TIMER | 0 | Countdown reminder.| 765| REMINDER_TYPE_CALENDAR | 1 | Calendar reminder.| 766| REMINDER_TYPE_ALARM | 2 | Alarm reminder.| 767 768 769## ActionButton 770 771Describes the button displayed for a reminder. 772 773**System capability**: SystemCapability.Notification.ReminderAgent 774 775| Name| Type| Mandatory| Description| 776| -------- | -------- | -------- | -------- | 777| title | string | Yes| Text on the button.| 778| titleResource<sup>11+</sup> | string | No| Resource ID of the title. This parameter is used to read the title information after the system language is switched.| 779| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.| 780 781 782## WantAgent 783 784Defines the information about the redirected-to ability. 785 786**System capability**: SystemCapability.Notification.ReminderAgent 787 788 789| Name| Type| Mandatory| Description| 790| -------- | -------- | -------- | -------- | 791| pkgName | string | Yes| Name of the target package.| 792| abilityName | string | Yes| Name of the target ability.| 793| parameters<sup>12+</sup> | Record\<string, Object> | No| Parameters to be transferred to the target.| 794| uri<sup>12+</sup> | string | No| URI of the target ability.| 795 796 797## MaxScreenWantAgent 798 799Describes the information about the ability that is started automatically and displayed in full-screen mode when a reminder is displayed in the notification center. This API is reserved. 800 801**System capability**: SystemCapability.Notification.ReminderAgent 802 803| Name| Type| Mandatory| Description| 804| -------- | -------- | -------- | -------- | 805| pkgName | string | Yes| Name of the target package. (If the device is in use, only a notification banner is displayed.)| 806| abilityName | string | Yes| Name of the target ability. (If the device is in use, only a notification banner is displayed.)| 807 808 809## ReminderRequest 810 811Defines the request for publishing a reminder. 812 813**System capability**: SystemCapability.Notification.ReminderAgent 814 815| Name| Type| Mandatory| Description| 816| -------- | -------- | -------- | -------- | 817| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.| 818| actionButton | [[ActionButton?, ActionButton?, ActionButton?]](#actionbutton) | No| Buttons displayed for the reminder notification.<br>- For common applications, a maximum of two buttons are supported.<br>- For system applications, a maximum of two buttons are supported in API version 9, and a maximum of three buttons are supported in API version 10 and later versions.| 819| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the reminder is clicked.| 820| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | No| Information about the ability that is started automatically and displayed in full-screen mode when the reminder arrives. If the device is in use, only a notification banner is displayed.<br> This API is reserved.| 821| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.| 822| snoozeTimes | number | No| Number of reminder snooze times. The default value is **0**. (It is not applicable to countdown reminders.)| 823| timeInterval | number | No| Reminder snooze interval, in seconds. The minimum value is 5 minutes. (It is not applicable to countdown reminders.)| 824| title | string | No| Reminder title.| 825| titleResourceId<sup>18+</sup> | number | No| Resource ID of the reminder title.| 826| content | string | No| Reminder content.| 827| contentResourceId<sup>18+</sup> | number | No| Resource ID of the reminder content.| 828| expiredContent | string | No| Content to be displayed after the reminder expires.| 829| expiredContentResourceId<sup>18+</sup> | number | No| Resource ID of the content to be displayed after the reminder expires.| 830| snoozeContent | string | No| Content to be displayed when the reminder is snoozing. (It is not applicable to countdown reminders.)| 831| snoozeContentResourceId<sup>18+</sup> | number | No| Resource ID of the content to be displayed when the reminder is snoozing.| 832| notificationId | number | No| Notification ID used by the reminder. You must pass in a notification ID. If there are reminders with the same notification ID, the later one will overwrite the earlier one.| 833| groupId<sup>11+</sup> | string | No| Group ID used for the reminder. If "Don't ask again" or similar information is selected for the reminder, other reminders with the same group ID are also canceled.| 834| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notificationManager.md#slottype) | No| Type of the slot used by the reminder.| 835| tapDismissed<sup>10+</sup> | boolean | No| Whether the reminder is automatically cleared. For details, see [NotificationRequest.tapDismissed](../apis-notification-kit/js-apis-inner-notification-notificationRequest.md#notificationrequest). | 836| autoDeletedTime<sup>10+</sup> | number | No| Time when the reminder is automatically cleared. For details, see [NotificationRequest.autoDeletedTime](../apis-notification-kit/js-apis-inner-notification-notificationRequest.md#notificationrequest).| 837| snoozeSlotType<sup>11+</sup> | [notification.SlotType](../apis-notification-kit/js-apis-notificationManager.md#slottype) | No| Type of the slot used by the snoozed reminder. (It is not applicable to countdown reminders.)| 838| customRingUri<sup>11+</sup> | string | No| URI of the custom prompt tone. The prompt tone file must be stored in the **resources/rawfile** directory and supports formats such as M4A, AAC, MP3, OGG, WAV, FLAC, and AMR.| 839 840## ReminderRequestCalendar 841 842ReminderRequestCalendar extends ReminderRequest 843 844Defines a reminder for a calendar event. 845 846**System capability**: SystemCapability.Notification.ReminderAgent 847 848| Name| Type| Mandatory| Description| 849| -------- | -------- | -------- | -------- | 850| dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.| 851| repeatMonths | Array\<number> | No| Month in which the reminder repeats.| 852| repeatDays | Array\<number> | No| Date on which the reminder repeats.| 853| daysOfWeek<sup>11+</sup> | Array\<number> | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.| 854| endDateTime<sup>12+</sup> | [LocalDateTime](#localdatetime) | No| End time of the reminder.| 855 856 857## ReminderRequestAlarm 858 859ReminderRequestAlarm extends ReminderRequest 860 861Defines a reminder for an alarm. 862 863**System capability**: SystemCapability.Notification.ReminderAgent 864 865| Name| Type| Mandatory| Description| 866| -------- | -------- | -------- | -------- | 867| hour | number | Yes| Hour portion of the reminder time.| 868| minute | number | Yes| Minute portion of the reminder time.| 869| daysOfWeek | Array\<number> | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.| 870 871 872## ReminderRequestTimer 873 874ReminderRequestTimer extends ReminderRequest 875 876Defines a reminder for a scheduled timer. 877 878**System capability**: SystemCapability.Notification.ReminderAgent 879 880| Name| Type| Mandatory| Description| 881| -------- | -------- | -------- | -------- | 882| triggerTimeInSeconds | number | Yes| Number of seconds in the countdown timer.| 883 884 885## LocalDateTime 886 887Defines the time information for a calendar reminder. 888 889**System capability**: SystemCapability.Notification.ReminderAgent 890 891| Name| Type| Mandatory| Description| 892| -------- | -------- | -------- | -------- | 893| year | number | Yes| Year.| 894| month | number | Yes| Month. The value ranges from 1 to 12.| 895| day | number | Yes| Day. The value ranges from 1 to 31.| 896| hour | number | Yes| Hour. The value ranges from 0 to 23.| 897| minute | number | Yes| Minute. The value ranges from 0 to 59.| 898| second | number | No| Second. The value ranges from 0 to 59.| 899 900## ReminderInfo<sup>12+</sup> 901 902Defines the reminder information. 903 904**System capability**: SystemCapability.Notification.ReminderAgent 905 906| Name | Type | Read Only| Optional| Description | 907| ----------- | ----------------------------------- | ---- | ---- | -------------------- | 908| reminderId | number | No | No | ID of the reminder.| 909| reminderReq | [ReminderRequest](#reminderrequest) | No | No | Request used for publishing the reminder. | 910