1# @ohos.reminderAgentManager (后台代理提醒) 2 3本模块提供后台代理提醒的能力,即当应用被冻结或应用退出时,计时和提醒的功能将被系统服务代理。在开发过程中,开发者可以调用本模块接口创建定时提醒,提醒类型支持倒计时、日历、闹钟三种。 4 5> **说明:** 6> 7> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 8 9 10## 导入模块 11 12```ts 13import reminderAgentManager from'@ohos.reminderAgentManager'; 14``` 15 16## reminderAgentManager.publishReminder 17 18publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void 19 20发布后台代理提醒。使用callback异步回调。 21 22> **说明:** 23> 24> 该接口需要申请通知弹窗权限[Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8)后调用。 25 26**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER 27 28**系统能力**: SystemCapability.Notification.ReminderAgent 29 30**参数**: 31 32 | 参数名 | 类型 | 必填 | 说明 | 33 | -------- | -------- | -------- | -------- | 34 | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的代理提醒实例。 | 35 | callback | AsyncCallback\<number> | 是 | 回调函数,返回当前发布提醒的id。 | 36 37**错误码:** 38 39以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 40 41| 错误码ID | 错误信息 | 42| --------- | ------- | 43| 1700001 | Notification is not enabled. | 44| 1700002 | The number of reminders exceeds the limit. | 45 46**示例**: 47```ts 48import { BusinessError } from '@ohos.base'; 49 50let timer: reminderAgentManager.ReminderRequestTimer = { 51 reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, 52 triggerTimeInSeconds: 10 53} 54 55reminderAgentManager.publishReminder(timer, (err: BusinessError, reminderId: number) => { 56 if (err) { 57 console.log("callback err code:" + err.code + " message:" + err.message); 58 } else { 59 console.log("callback, reminderId = " + reminderId); 60 } 61}); 62``` 63 64## reminderAgentManager.publishReminder 65 66publishReminder(reminderReq: ReminderRequest): Promise\<number> 67 68发布后台代理提醒。使用promisek异步回调。 69 70> **说明:** 71> 72> 该接口需要申请通知弹窗权限[Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8)后调用。 73 74**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER 75 76**系统能力**: SystemCapability.Notification.ReminderAgent 77 78**参数**: 79 | 参数名 | 类型 | 必填 | 说明 | 80 | -------- | -------- | -------- | -------- | 81 | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的代理提醒实例。 | 82 83**返回值**: 84 | 类型 | 说明 | 85 | -------- | -------- | 86 | Promise\<number> | Promise对象,返回提醒的id。 | 87 88**错误码:** 89 90以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 91 92| 错误码ID | 错误信息 | 93| --------- | ------- | 94| 1700001 | Notification is not enabled. | 95| 1700002 | The number of reminders exceeds the limit. | 96 97**示例**: 98```ts 99import { BusinessError } from '@ohos.base'; 100 101let timer: reminderAgentManager.ReminderRequestTimer = { 102 reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, 103 triggerTimeInSeconds: 10 104} 105 106reminderAgentManager.publishReminder(timer).then((reminderId: number) => { 107 console.log("promise, reminderId = " + reminderId); 108}).catch((err: BusinessError) => { 109 console.log("promise err code:" + err.code + " message:" + err.message); 110}); 111``` 112 113 114## reminderAgentManager.cancelReminder 115 116cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void 117 118取消指定Id的代理提醒。使用callback异步回调。 119 120**系统能力**: SystemCapability.Notification.ReminderAgent 121 122**参数**: 123 124| 参数名 | 类型 | 必填 | 说明 | 125| -------- | -------- | -------- | -------- | 126| reminderId | number | 是 | 需要取消的代理提醒的Id。 | 127| callback | AsyncCallback\<void> | 是 | 回调函数,取消代理提醒成功,err为undefined,否则返回err信息。 | 128 129**错误码:** 130 131以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 132 133| 错误码ID | 错误信息 | 134| --------- | ------- | 135| 1700003 | The reminder does not exist. | 136| 1700004 | The bundle name does not exist. | 137 138**示例**: 139 140```ts 141import { BusinessError } from '@ohos.base'; 142 143let reminderId: number = 1; 144reminderAgentManager.cancelReminder(reminderId, (err: BusinessError, data: void) => { 145 if (err) { 146 console.log("callback err code:" + err.code + " message:" + err.message); 147 } else { 148 console.log("cancelReminder callback"); 149 } 150}); 151``` 152 153## reminderAgentManager.cancelReminder 154 155cancelReminder(reminderId: number): Promise\<void> 156 157取消指定Id的代理提醒。使用Promise异步回调。 158 159**系统能力**: SystemCapability.Notification.ReminderAgent 160 161**参数**: 162 163| 参数名 | 类型 | 必填 | 说明 | 164| -------- | -------- | -------- | -------- | 165| reminderId | number | 是 | 需要取消的代理提醒的Id。 | 166 167**返回值**: 168 169| 类型 | 说明 | 170| -------- | -------- | 171| Promise\<void> | 无返回结果的Promise对象。 | 172 173**错误码:** 174 175以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 176 177| 错误码ID | 错误信息 | 178| --------- | ------- | 179| 1700003 | The reminder does not exist. | 180| 1700004 | The bundle name does not exist. | 181 182**示例**: 183 184```ts 185import { BusinessError } from '@ohos.base'; 186 187let reminderId: number = 1; 188reminderAgentManager.cancelReminder(reminderId).then(() => { 189 console.log("cancelReminder promise"); 190}).catch((err: BusinessError) => { 191 console.log("promise err code:" + err.code + " message:" + err.message); 192}); 193``` 194 195## reminderAgentManager.getValidReminders 196 197getValidReminders(callback: AsyncCallback<Array\<ReminderRequest>>): void 198 199获取当前应用设置的所有有效(未过期)的代理提醒。使用callback异步回调。 200 201**系统能力**: SystemCapability.Notification.ReminderAgent 202 203**参数**: 204 205| 参数名 | 类型 | 必填 | 说明 | 206| -------- | -------- | -------- | -------- | 207| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)>> | 是 | 回调函数,返回当前应用设置的所有有效的代理提醒。 | 208 209**错误码:** 210 211以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 212 213| 错误码ID | 错误信息 | 214| --------- | ------- | 215| 1700004 | The bundle name does not exist. | 216 217**示例**: 218 219```ts 220import { BusinessError } from '@ohos.base'; 221 222reminderAgentManager.getValidReminders((err: BusinessError, reminders: Array<reminderAgentManager.ReminderRequest>) => { 223 if (err) { 224 console.log("callback err code:" + err.code + " message:" + err.message); 225 } else { 226 console.log("callback, getValidReminders length = " + reminders.length); 227 for (let i = 0; i < reminders.length; i++) { 228 console.log("getValidReminders = " + reminders[i]); 229 console.log("getValidReminders, reminderType = " + reminders[i].reminderType); 230 const actionButton = reminders[i].actionButton || []; 231 for (let j = 0; j < actionButton.length; j++) { 232 console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title); 233 console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type); 234 } 235 console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName); 236 console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName); 237 console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName); 238 console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName); 239 console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); 240 console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes); 241 console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval); 242 console.log("getValidReminders, title = " + reminders[i].title); 243 console.log("getValidReminders, content = " + reminders[i].content); 244 console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent); 245 console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent); 246 console.log("getValidReminders, notificationId = " + reminders[i].notificationId); 247 console.log("getValidReminders, slotType = " + reminders[i].slotType); 248 } 249 } 250}); 251``` 252 253## reminderAgentManager.getValidReminders 254 255getValidReminders(): Promise\<Array\<ReminderRequest>> 256 257获取当前应用设置的所有有效(未过期)的代理提醒。使用promise异步回调。 258 259**系统能力**: SystemCapability.Notification.ReminderAgent 260 261**返回值**: 262 263| 类型 | 说明 | 264| -------- | -------- | 265| Promise\<Array\<[ReminderRequest](#reminderrequest)>> | Promise对象,返回当前应用设置的所有有效的代理提醒。 | 266 267**错误码:** 268 269以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 270 271| 错误码ID | 错误信息 | 272| --------- | ------- | 273| 1700004 | The bundle name does not exist. | 274 275**示例**: 276 277```ts 278import { BusinessError } from '@ohos.base'; 279 280reminderAgentManager.getValidReminders().then((reminders: Array<reminderAgentManager.ReminderRequest>) => { 281 console.log("promise, getValidReminders length = " + reminders.length); 282 for (let i = 0; i < reminders.length; i++) { 283 console.log("getValidReminders = " + reminders[i]); 284 console.log("getValidReminders, reminderType = " + reminders[i].reminderType); 285 const actionButton = reminders[i].actionButton || []; 286 for (let j = 0; j < actionButton.length; j++) { 287 console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title); 288 console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type); 289 } 290 console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName); 291 console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName); 292 console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName); 293 console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName); 294 console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration); 295 console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes); 296 console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval); 297 console.log("getValidReminders, title = " + reminders[i].title); 298 console.log("getValidReminders, content = " + reminders[i].content); 299 console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent); 300 console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent); 301 console.log("getValidReminders, notificationId = " + reminders[i].notificationId); 302 console.log("getValidReminders, slotType = " + reminders[i].slotType); 303 } 304}).catch((err: BusinessError) => { 305 console.log("promise err code:" + err.code + " message:" + err.message); 306}); 307``` 308 309## reminderAgentManager.cancelAllReminders 310 311cancelAllReminders(callback: AsyncCallback\<void>): void 312 313取消当前应用设置的所有代理提醒。使用callback异步回调。 314 315**系统能力**: SystemCapability.Notification.ReminderAgent 316 317**参数**: 318 319| 参数名 | 类型 | 必填 | 说明 | 320| -------- | -------- | -------- | -------- | 321| callback | AsyncCallback\<void> | 是 | 回调函数,取消代理提醒成功,err为undefined,否则为错误对象。 | 322 323**错误码:** 324 325以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 326 327| 错误码ID | 错误信息 | 328| --------- | ------- | 329| 1700004 | The bundle name does not exist. | 330 331**示例**: 332 333```ts 334import { BusinessError } from '@ohos.base'; 335 336reminderAgentManager.cancelAllReminders((err: BusinessError, data: void) =>{ 337 if (err) { 338 console.log("callback err code:" + err.code + " message:" + err.message); 339 } else { 340 console.log("cancelAllReminders callback") 341 } 342}); 343``` 344 345## reminderAgentManager.cancelAllReminders 346 347cancelAllReminders(): Promise\<void> 348 349取消当前应用设置的所有代理提醒。使用Promise异步回调。 350 351**系统能力**: SystemCapability.Notification.ReminderAgent 352 353**返回值**: 354 355| 类型 | 说明 | 356| -------- | -------- | 357| Promise\<void> | 无返回结果的Promise对象。 | 358 359**错误码:** 360 361以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。 362 363| 错误码ID | 错误信息 | 364| --------- | ------- | 365| 1700004 | The bundle name does not exist. | 366 367**示例**: 368 369```ts 370import { BusinessError } from '@ohos.base'; 371 372reminderAgentManager.cancelAllReminders().then(() => { 373 console.log("cancelAllReminders promise") 374}).catch((err: BusinessError) => { 375 console.log("promise err code:" + err.code + " message:" + err.message); 376}); 377``` 378 379 380## reminderAgentManager.addNotificationSlot 381 382addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void 383 384添加NotificationSlot(通知槽)。使用callback异步回调。 385 386**系统能力**: SystemCapability.Notification.ReminderAgent 387 388**参数**: 389 390| 参数名 | 类型 | 必填 | 说明 | 391| -------- | -------- | -------- | -------- | 392| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification\.slot实例,仅支持设置其type属性。 | 393| callback | AsyncCallback\<void> | 是 | 回调函数,添加NotificationSlot成功时,err为undefined,否则err为错误对象。 | 394 395**示例**: 396 397```ts 398import notification from '@ohos.notificationManager' 399import { BusinessError } from '@ohos.base'; 400 401let mySlot: notification.NotificationSlot = { 402 type: notification.SlotType.SOCIAL_COMMUNICATION 403} 404 405reminderAgentManager.addNotificationSlot(mySlot, (err: BusinessError, data: void) => { 406 if (err) { 407 console.log("callback err code:" + err.code + " message:" + err.message); 408 } else { 409 console.log("addNotificationSlot callback"); 410 } 411}); 412``` 413 414 415## reminderAgentManager.addNotificationSlot 416 417addNotificationSlot(slot: NotificationSlot): Promise\<void> 418 419添加NotificationSlot(通知槽)。使用promise异步回调。 420 421**系统能力**: SystemCapability.Notification.ReminderAgent 422 423**参数**: 424 425| 参数名 | 类型 | 必填 | 说明 | 426| -------- | -------- | -------- | -------- | 427| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification\.slot实例,仅支持设置其type属性。 | 428 429**返回值**: 430 431| 类型 | 说明 | 432| -------- | -------- | 433| Promise\<void> | 无返回结果的Promise对象。 | 434 435**示例**: 436 437```ts 438import notification from '@ohos.notificationManager' 439import { BusinessError } from '@ohos.base'; 440 441let mySlot: notification.NotificationSlot = { 442 type: notification.SlotType.SOCIAL_COMMUNICATION 443} 444reminderAgentManager.addNotificationSlot(mySlot).then(() => { 445 console.log("addNotificationSlot promise"); 446}).catch((err: BusinessError) => { 447 console.log("promise err code:" + err.code + " message:" + err.message); 448}); 449``` 450 451 452## reminderAgentManager.removeNotificationSlot 453 454removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void 455 456删除目标NotificationSlot(通知槽),使用callback异步回调。 457 458**系统能力**: SystemCapability.Notification.ReminderAgent 459 460**参数**: 461 462| 参数名 | 类型 | 必填 | 说明 | 463| -------- | -------- | -------- | -------- | 464| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 | 465| callback | AsyncCallback\<void> | 是 | 回调函数,当删除成功时,err为undefined,否则为错误对象。 | 466 467**示例**: 468 469```ts 470import notification from '@ohos.notificationManager' 471import { BusinessError } from '@ohos.base'; 472 473reminderAgentManager.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, 474 (err: BusinessError, data: void) => { 475 if (err) { 476 console.log("callback err code:" + err.code + " message:" + err.message); 477 } else { 478 console.log("removeNotificationSlot callback"); 479 } 480}); 481``` 482 483 484## reminderAgentManager.removeNotificationSlot 485 486removeNotificationSlot(slotType: notification.SlotType): Promise\<void> 487 488删除目标NotificationSlot(通知槽)。使用Promise异步回调。 489 490**系统能力**: SystemCapability.Notification.ReminderAgent 491 492**参数**: 493 494| 参数名 | 类型 | 必填 | 说明 | 495| -------- | -------- | -------- | -------- | 496| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 | 497 498**返回值**: 499 500| 类型 | 说明 | 501| -------- | -------- | 502| Promise\<void> | 无返回结果的Promise对象。 | 503 504**示例**: 505 506```ts 507import notification from '@ohos.notificationManager' 508import { BusinessError } from '@ohos.base'; 509 510reminderAgentManager.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => { 511 console.log("removeNotificationSlot promise"); 512}).catch((err: BusinessError) => { 513 console.log("promise err code:" + err.code + " message:" + err.message); 514}); 515``` 516 517## ActionButtonType 518 519按钮的类型。 520 521**系统能力**:SystemCapability.Notification.ReminderAgent 522 523| 名称 | 值 | 说明 | 524| -------- | -------- | -------- | 525| ACTION_BUTTON_TYPE_CLOSE | 0 | 表示关闭提醒的按钮。 | 526| ACTION_BUTTON_TYPE_SNOOZE | 1 | 表示延迟提醒的按钮。 | 527| ACTION_BUTTON_TYPE_CUSTOM<sup>10+</sup> | 2 | 表示自定义的按钮。<br>**系统接口**: 系统接口,三方应用不支持调用。 | 528 529 530## ReminderType 531 532提醒的类型。 533 534**系统能力**:SystemCapability.Notification.ReminderAgent 535 536| 名称 | 值 | 说明 | 537| -------- | -------- | -------- | 538| REMINDER_TYPE_TIMER | 0 | 表示提醒类型:倒计时。 | 539| REMINDER_TYPE_CALENDAR | 1 | 表示提醒类型:日历。 | 540| REMINDER_TYPE_ALARM | 2 | 表示提醒类型:闹钟。 | 541 542 543## ActionButton 544 545弹出的提醒通知中按钮的类型和标题。 546 547**系统能力**:SystemCapability.Notification.ReminderAgent 548 549| 名称 | 类型 | 必填 | 说明 | 550| -------- | -------- | -------- | -------- | 551| title | string | 是 | 按钮显示的标题。 | 552| type | [ActionButtonType](#actionbuttontype) | 是 | 按钮的类型。 | 553| wantAgent<sup>10+</sup> | [WantAgent](#wantagent) | 否 | 点击按钮跳转的ability信息。<br>**系统接口**: 系统接口,三方应用不支持调用。 | 554 555 556## WantAgent 557 558跳转目标的ability信息。 559 560**系统能力**:SystemCapability.Notification.ReminderAgent 561 562 563| 名称 | 类型 | 必填 | 说明 | 564| -------- | -------- | -------- | -------- | 565| pkgName | string | 是 | 指明跳转目标的包名。 | 566| abilityName | string | 是 | 指明跳转目标的ability名称。 | 567| uri<sup>10+</sup> | string | 否 | 指明跳转目标的uri信息。<br>**系统接口**: 系统接口,三方应用不支持调用。 | 568 569 570## MaxScreenWantAgent 571 572提醒到达时,全屏显示自动拉起目标的ability信息。该接口为预留接口,暂不支持使用。 573 574**系统能力**:SystemCapability.Notification.ReminderAgent 575 576| 名称 | 类型 | 必填 | 说明 | 577| -------- | -------- | -------- | -------- | 578| pkgName | string | 是 | 指明提醒到达时自动拉起的目标包名(如果设备在使用中,则只弹出通知横幅框)。 | 579| abilityName | string | 是 | 指明提醒到达时自动拉起的目标ability名(如果设备在使用中,则只弹出通知横幅框)。 | 580 581 582## ReminderRequest 583 584代理提醒对象,用于设置提醒类型、响铃时长等具体信息。 585 586**系统能力**:SystemCapability.Notification.ReminderAgent 587 588| 名称 | 类型 | 必填 | 说明 | 589| -------- | -------- | -------- | -------- | 590| reminderType | [ReminderType](#remindertype) | 是 | 指明代理提醒类型。 | 591| actionButton<sup></sup> | [ActionButton](#actionbutton) | 否 | 弹出的提醒通知栏中显示的按钮。<br>-普通应用:最多支持两个按钮。<br>-系统应用:API9最多支持两个按钮,在API10开始最多支持三个按钮。 | 592| wantAgent | [WantAgent](#wantagent) | 否 | 点击通知后需要跳转的目标ability信息。 | 593| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | 否 | 提醒到达时,全屏显示自动拉起目标的ability信息。如果设备正在使用中,则弹出一个通知框。 <br> 说明:该接口为预留接口,暂不支持使用。| 594| ringDuration | number | 否 | 指明响铃时长(单位:秒),默认1秒。 | 595| snoozeTimes | number | 否 | 指明延迟提醒次数,默认0次。 | 596| timeInterval | number | 否 | 执行延迟提醒间隔(单位:秒),最少5分钟。 | 597| title | string | 否 | 指明提醒标题。 | 598| content | string | 否 | 指明提醒内容。 | 599| expiredContent | string | 否 | 指明提醒过期后需要显示的内容。 | 600| snoozeContent | string | 否 | 指明延迟提醒时需要显示的内容。 | 601| notificationId | number | 否 | 指明提醒使用的通知的id号,相同id号的提醒会覆盖。 | 602| slotType | [notification.SlotType](js-apis-notificationManager.md#slottype) | 否 | 指明提醒的slot类型。 | 603| tapDismissed<sup>10+</sup> | boolean | 否 | 通知是否自动清除,具体请参考[NotificationRequest.tapDismissed](js-apis-inner-notification-notificationRequest.md#notificationrequest)。 | 604| autoDeletedTime<sup>10+</sup> | number | 否 | 自动清除的时间,具体请参考[NotificationRequest.autoDeletedTime](js-apis-inner-notification-notificationRequest.md#notificationrequest)。 | 605 606 607## ReminderRequestCalendar 608 609ReminderRequestCalendar extends ReminderRequest 610 611日历实例对象,用于设置提醒的时间。 612 613**系统能力**:SystemCapability.Notification.ReminderAgent 614 615| 名称 | 类型 | 必填 | 说明 | 616| -------- | -------- | -------- | -------- | 617| dateTime | [LocalDateTime](#localdatetime) | 是 | 指明提醒的目标时间。 | 618| repeatMonths | Array\<number> | 否 | 指明重复提醒的月份。 | 619| repeatDays | Array\<number> | 否 | 指明重复提醒的日期。 | 620 621 622## ReminderRequestAlarm 623 624ReminderRequestAlarm extends ReminderRequest 625 626闹钟实例对象,用于设置提醒的时间。 627 628**系统能力**:SystemCapability.Notification.ReminderAgent 629 630| 名称 | 类型 | 必填 | 说明 | 631| -------- | -------- | -------- | -------- | 632| hour | number | 是 | 指明提醒的目标时刻。 | 633| minute | number | 是 | 指明提醒的目标分钟。 | 634| daysOfWeek | Array\<number> | 否 | 指明每周哪几天需要重复提醒。范围为周一到周末,对应数字为1到7。 | 635 636 637## ReminderRequestTimer 638 639ReminderRequestTimer extends ReminderRequest 640 641倒计时实例对象,用于设置提醒的时间。 642 643**系统能力**:SystemCapability.Notification.ReminderAgent 644 645| 名称 | 类型 | 必填 | 说明 | 646| -------- | -------- | -------- | -------- | 647| triggerTimeInSeconds | number | 是 | 指明倒计时的秒数。 | 648 649 650## LocalDateTime 651 652用于日历类提醒设置时指定时间信息。 653 654**系统能力**:SystemCapability.Notification.ReminderAgent 655 656| 名称 | 类型 | 必填 | 说明 | 657| -------- | -------- | -------- | -------- | 658| year | number | 是 | 年 | 659| month | number | 是 | 月,取值范围是[1, 12]。 | 660| day | number | 是 | 日,取值范围是[1, 31]。 | 661| hour | number | 是 | 时,取值范围是[0, 23]。 | 662| minute | number | 是 | 分,取值范围是[0, 59]。 | 663| second | number | 否 | 秒,取值范围是[0, 59]。 | 664