1# @ohos.reminderAgentManager (后台代理提醒)
2
3本模块提供后台代理提醒的能力,即当应用被冻结或应用退出时,计时和提醒的功能将被系统服务代理。在开发过程中,开发者可以调用本模块接口创建定时提醒,提醒类型支持倒计时、日历、闹钟三种。
4
5> **说明:**
6>
7> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8
9
10## 导入模块
11
12```ts
13import { reminderAgentManager } from '@kit.BackgroundTasksKit';
14```
15
16## reminderAgentManager.publishReminder
17
18publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void
19
20发布后台代理提醒。使用callback异步回调。
21
22> **说明:**
23>
24> 该接口需要申请通知弹窗权限[NotificationManager.requestEnableNotification](../apis-notification-kit/js-apis-notificationManager.md#notificationmanagerrequestenablenotification10)后调用。
25>
26> <!--RP1--><!--RP1End-->
27
28**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER
29
30**系统能力**: SystemCapability.Notification.ReminderAgent
31
32**参数**:
33
34  | 参数名 | 类型 | 必填 | 说明 |
35  | -------- | -------- | -------- | -------- |
36  | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的代理提醒实例。 |
37  | callback | AsyncCallback\<number> | 是 | 回调函数,返回当前发布提醒的id。 |
38
39**错误码:**
40
41以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
42
43| 错误码ID   | 错误信息 |
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**示例**:
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
71发布后台代理提醒。使用promise异步回调。
72
73> **说明:**
74>
75> 该接口需要申请通知弹窗权限[NotificationManager.requestEnableNotification](../apis-notification-kit/js-apis-notificationManager.md#notificationmanagerrequestenablenotification10)后调用。
76>
77> <!--RP1--><!--RP1End-->
78
79**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER
80
81**系统能力**: SystemCapability.Notification.ReminderAgent
82
83**参数**:
84  | 参数名 | 类型 | 必填 | 说明 |
85  | -------- | -------- | -------- | -------- |
86  | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的代理提醒实例。 |
87
88**返回值**:
89  | 类型 | 说明 |
90  | -------- | -------- |
91  | Promise\<number> | Promise对象,返回提醒的id。 |
92
93**错误码:**
94
95以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
96
97| 错误码ID   | 错误信息 |
98| --------- | ------- |
99| 401 | If the input parameter is not valid parameter. |
100| 1700001    | Notification is not enabled. |
101| 1700002    | The number of reminders exceeds the limit. |
102
103**示例**:
104```ts
105import { BusinessError } from '@kit.BasicServicesKit';
106
107let timer: reminderAgentManager.ReminderRequestTimer = {
108  reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER,
109  triggerTimeInSeconds: 10
110}
111
112reminderAgentManager.publishReminder(timer).then((reminderId: number) => {
113  console.log("promise, reminderId = " + reminderId);
114}).catch((err: BusinessError) => {
115  console.error("promise err code:" + err.code + " message:" + err.message);
116});
117```
118
119
120## reminderAgentManager.cancelReminder
121
122cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void
123
124取消指定Id的代理提醒。使用callback异步回调。
125
126**系统能力**: SystemCapability.Notification.ReminderAgent
127
128**参数**:
129
130| 参数名 | 类型 | 必填 | 说明 |
131| -------- | -------- | -------- | -------- |
132| reminderId | number | 是 | 需要取消的代理提醒的Id。 |
133| callback | AsyncCallback\<void> | 是 | 回调函数,取消代理提醒成功,err为undefined,否则返回err信息。 |
134
135**错误码:**
136
137以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
138
139| 错误码ID   | 错误信息 |
140| --------- | ------- |
141| 401 | If the input parameter is not valid parameter. |
142| 1700003    | The reminder does not exist. |
143| 1700004    | The bundle name does not exist. |
144
145**示例**:
146
147```ts
148import { BusinessError } from '@kit.BasicServicesKit';
149
150let reminderId: number = 1;
151reminderAgentManager.cancelReminder(reminderId, (err: BusinessError) => {
152  if (err.code) {
153    console.error("callback err code:" + err.code + " message:" + err.message);
154  } else {
155    console.log("cancelReminder callback");
156  }
157});
158```
159
160## reminderAgentManager.cancelReminder
161
162cancelReminder(reminderId: number): Promise\<void>
163
164取消指定Id的代理提醒。使用Promise异步回调。
165
166**系统能力**: SystemCapability.Notification.ReminderAgent
167
168**参数**:
169
170| 参数名 | 类型 | 必填 | 说明 |
171| -------- | -------- | -------- | -------- |
172| reminderId | number | 是 | 需要取消的代理提醒的Id。 |
173
174**返回值**:
175
176| 类型 | 说明 |
177| -------- | -------- |
178| Promise\<void> | 无返回结果的Promise对象。 |
179
180**错误码:**
181
182以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
183
184| 错误码ID   | 错误信息 |
185| --------- | ------- |
186| 401 | If the input parameter is not valid parameter. |
187| 1700003    | The reminder does not exist. |
188| 1700004    | The bundle name does not exist. |
189
190**示例**:
191
192```ts
193import { BusinessError } from '@kit.BasicServicesKit';
194
195let reminderId: number = 1;
196reminderAgentManager.cancelReminder(reminderId).then(() => {
197  console.log("cancelReminder promise");
198}).catch((err: BusinessError) => {
199  console.error("promise err code:" + err.code + " message:" + err.message);
200});
201```
202
203## reminderAgentManager.getValidReminders
204
205getValidReminders(callback: AsyncCallback<Array\<ReminderRequest>>): void
206
207获取当前应用设置的所有有效(未过期)的代理提醒。使用callback异步回调。
208
209> **说明:**
210>
211> 当到达设置的提醒时间点时,通知中心会弹出相应提醒的通知卡片(通知栏消息)。若未点击通知卡片上的关闭/CLOSE按钮,则代理提醒是有效/未过期的;若点击了关闭/CLOSE按钮,则代理提醒过期。
212>
213> 当代理提醒类型是闹钟时,若设置每天提醒,无论是否点击关闭/CLOSE按钮,代理提醒都是有效的。
214
215**系统能力**: SystemCapability.Notification.ReminderAgent
216
217**参数**:
218
219| 参数名 | 类型 | 必填 | 说明 |
220| -------- | -------- | -------- | -------- |
221| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)>> | 是 | 回调函数,返回当前应用设置的所有有效(未过期)的代理提醒。 |
222
223**错误码:**
224
225以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
226
227| 错误码ID   | 错误信息 |
228| --------- | ------- |
229| 401 | If the input parameter is not valid parameter. |
230| 1700004    | The bundle name does not exist. |
231
232**示例**:
233
234```ts
235import { BusinessError } from '@kit.BasicServicesKit';
236
237reminderAgentManager.getValidReminders((err: BusinessError, reminders: Array<reminderAgentManager.ReminderRequest>) => {
238  if (err.code) {
239    console.error("callback err code:" + err.code + " message:" + err.message);
240  } else {
241    console.log("callback, getValidReminders length = " + reminders.length);
242    for (let i = 0; i < reminders.length; i++) {
243      console.log("getValidReminders = " + reminders[i]);
244      console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
245      const actionButton = reminders[i].actionButton || [];
246      for (let j = 0; j < actionButton.length; j++) {
247        console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title);
248        console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type);
249      }
250      console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName);
251      console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName);
252      console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName);
253      console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName);
254      console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
255      console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
256      console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
257      console.log("getValidReminders, title = " + reminders[i].title);
258      console.log("getValidReminders, content = " + reminders[i].content);
259      console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
260      console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
261      console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
262      console.log("getValidReminders, slotType = " + reminders[i].slotType);
263    }
264  }
265});
266```
267
268## reminderAgentManager.getValidReminders
269
270getValidReminders(): Promise\<Array\<ReminderRequest>>
271
272获取当前应用设置的所有有效(未过期)的代理提醒。使用promise异步回调。
273
274> **说明:**
275>
276> 当到达设置的提醒时间点时,通知中心会弹出相应提醒的通知卡片(通知栏消息)。若未点击通知卡片上的关闭/CLOSE按钮,则代理提醒是有效/未过期的;若点击了关闭/CLOSE按钮,则代理提醒过期。
277>
278> 当代理提醒类型是闹钟时,若设置每天提醒,无论是否点击关闭/CLOSE按钮,代理提醒都是有效的。
279
280**系统能力**: SystemCapability.Notification.ReminderAgent
281
282**返回值**:
283
284| 类型 | 说明 |
285| -------- | -------- |
286| Promise\<Array\<[ReminderRequest](#reminderrequest)>> | Promise对象,返回当前应用设置的所有有效(未过期)的代理提醒。 |
287
288**错误码:**
289
290以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
291
292| 错误码ID   | 错误信息 |
293| --------- | ------- |
294| 401 | If the input parameter is not valid parameter. |
295| 1700004    | The bundle name does not exist. |
296
297**示例**:
298
299```ts
300import { BusinessError } from '@kit.BasicServicesKit';
301
302reminderAgentManager.getValidReminders().then((reminders: Array<reminderAgentManager.ReminderRequest>) => {
303  console.log("promise, getValidReminders length = " + reminders.length);
304  for (let i = 0; i < reminders.length; i++) {
305    console.log("getValidReminders = " + reminders[i]);
306    console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
307    const actionButton = reminders[i].actionButton || [];
308    for (let j = 0; j < actionButton.length; j++) {
309      console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title);
310      console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type);
311    }
312    console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName);
313    console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName);
314    console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName);
315    console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName);
316    console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
317    console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
318    console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
319    console.log("getValidReminders, title = " + reminders[i].title);
320    console.log("getValidReminders, content = " + reminders[i].content);
321    console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
322    console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
323    console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
324    console.log("getValidReminders, slotType = " + reminders[i].slotType);
325  }
326}).catch((err: BusinessError) => {
327  console.error("promise err code:" + err.code + " message:" + err.message);
328}); 
329```
330
331## reminderAgentManager.cancelAllReminders
332
333cancelAllReminders(callback: AsyncCallback\<void>): void
334
335取消当前应用设置的所有代理提醒。使用callback异步回调。
336
337**系统能力**: SystemCapability.Notification.ReminderAgent
338
339**参数**:
340
341| 参数名 | 类型 | 必填 | 说明 |
342| -------- | -------- | -------- | -------- |
343| callback | AsyncCallback\<void> | 是 | 回调函数,取消代理提醒成功,err为undefined,否则为错误对象。  |
344
345**错误码:**
346
347以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
348
349| 错误码ID   | 错误信息 |
350| --------- | ------- |
351| 401 | If the input parameter is not valid parameter. |
352| 1700004    | The bundle name does not exist. |
353
354**示例**:
355
356```ts
357import { BusinessError } from '@kit.BasicServicesKit';
358
359reminderAgentManager.cancelAllReminders((err: BusinessError) =>{
360  if (err.code) {
361    console.error("callback err code:" + err.code + " message:" + err.message);
362  } else {
363    console.log("cancelAllReminders callback")
364  }
365});
366```
367
368## reminderAgentManager.cancelAllReminders
369
370cancelAllReminders(): Promise\<void>
371
372取消当前应用设置的所有代理提醒。使用Promise异步回调。
373
374**系统能力**: SystemCapability.Notification.ReminderAgent
375
376**返回值**:
377
378| 类型 | 说明 |
379| -------- | -------- |
380| Promise\<void> | 无返回结果的Promise对象。 |
381
382**错误码:**
383
384以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)。
385
386| 错误码ID   | 错误信息 |
387| --------- | ------- |
388| 401 | If the input parameter is not valid parameter. |
389| 1700004    | The bundle name does not exist. |
390
391**示例**:
392
393```ts
394import { BusinessError } from '@kit.BasicServicesKit';
395
396reminderAgentManager.cancelAllReminders().then(() => {
397  console.log("cancelAllReminders promise")
398}).catch((err: BusinessError) => {
399  console.error("promise err code:" + err.code + " message:" + err.message);
400});
401```
402
403
404## reminderAgentManager.addNotificationSlot
405
406addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void
407
408添加NotificationSlot(通知槽)。使用callback异步回调。
409
410**系统能力**: SystemCapability.Notification.ReminderAgent
411
412**参数**:
413
414| 参数名 | 类型 | 必填 | 说明 |
415| -------- | -------- | -------- | -------- |
416| slot | [NotificationSlot](../apis-notification-kit/js-apis-inner-notification-notificationSlot.md#notificationslot) | 是 | notificationManager\.slot实例,仅支持设置其notificationType属性。 |
417| callback | AsyncCallback\<void> | 是 | 回调函数,添加NotificationSlot成功时,err为undefined,否则err为错误对象。 |
418
419**错误码:**
420
421以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
422
423| 错误码ID | 错误信息                                       |
424| -------- | ---------------------------------------------- |
425| 401      | If the input parameter is not valid parameter. |
426
427**示例**:
428
429```ts
430import { notificationManager } from '@kit.NotificationKit';
431import { BusinessError } from '@kit.BasicServicesKit';
432
433let mySlot: notificationManager.NotificationSlot = {
434  notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
435}
436
437reminderAgentManager.addNotificationSlot(mySlot, (err: BusinessError) => {
438  if (err.code) {
439    console.error("callback err code:" + err.code + " message:" + err.message);
440  } else {
441    console.log("addNotificationSlot callback");
442  }
443});
444```
445
446
447## reminderAgentManager.addNotificationSlot
448
449addNotificationSlot(slot: NotificationSlot): Promise\<void>
450
451添加NotificationSlot(通知槽)。使用promise异步回调。
452
453**系统能力**: SystemCapability.Notification.ReminderAgent
454
455**参数**:
456
457| 参数名 | 类型 | 必填 | 说明 |
458| -------- | -------- | -------- | -------- |
459| slot | [NotificationSlot](../apis-notification-kit/js-apis-inner-notification-notificationSlot.md#notificationslot) | 是 | notificationManager\.slot实例,仅支持设置其notificationType属性。 |
460
461**返回值**:
462
463| 类型 | 说明 |
464| -------- | -------- |
465| Promise\<void> | 无返回结果的Promise对象。 |
466
467**错误码:**
468
469以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
470
471| 错误码ID | 错误信息                                       |
472| -------- | ---------------------------------------------- |
473| 401      | If the input parameter is not valid parameter. |
474
475**示例**:
476
477```ts
478import { notificationManager } from '@kit.NotificationKit';
479import { BusinessError } from '@kit.BasicServicesKit';
480
481let mySlot: notificationManager.NotificationSlot = {
482  notificationType: notificationManager.SlotType.SOCIAL_COMMUNICATION
483}
484reminderAgentManager.addNotificationSlot(mySlot).then(() => {
485  console.log("addNotificationSlot promise");
486}).catch((err: BusinessError) => {
487  console.error("promise err code:" + err.code + " message:" + err.message);
488});
489```
490
491
492## reminderAgentManager.removeNotificationSlot
493
494removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void
495
496删除目标NotificationSlot(通知槽),使用callback异步回调。
497
498**系统能力**: SystemCapability.Notification.ReminderAgent
499
500**参数**:
501
502| 参数名 | 类型 | 必填 | 说明 |
503| -------- | -------- | -------- | -------- |
504| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 |
505| callback | AsyncCallback\<void> | 是 | 回调函数,当删除成功时,err为undefined,否则为错误对象。 |
506
507**错误码:**
508
509以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
510
511| 错误码ID | 错误信息                                       |
512| -------- | ---------------------------------------------- |
513| 401      | If the input parameter is not valid parameter. |
514
515**示例**:
516
517```ts
518import { notificationManager } from '@kit.NotificationKit';
519import { BusinessError } from '@kit.BasicServicesKit';
520
521reminderAgentManager.removeNotificationSlot(notificationManager.SlotType.CONTENT_INFORMATION,
522  (err: BusinessError) => {
523  if (err.code) {
524    console.error("callback err code:" + err.code + " message:" + err.message);
525  } else {
526    console.log("removeNotificationSlot callback");
527  }
528});
529```
530
531
532## reminderAgentManager.removeNotificationSlot
533
534removeNotificationSlot(slotType: notification.SlotType): Promise\<void>
535
536删除目标NotificationSlot(通知槽),使用Promise异步回调。
537
538**系统能力**: SystemCapability.Notification.ReminderAgent
539
540**参数**:
541
542| 参数名 | 类型 | 必填 | 说明 |
543| -------- | -------- | -------- | -------- |
544| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 |
545
546**返回值**:
547
548| 类型 | 说明 |
549| -------- | -------- |
550| Promise\<void> | 无返回结果的Promise对象。 |
551
552**错误码:**
553
554以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)。
555
556| 错误码ID | 错误信息                                       |
557| -------- | ---------------------------------------------- |
558| 401      | If the input parameter is not valid parameter. |
559
560**示例**:
561
562```ts
563import { notificationManager } from '@kit.NotificationKit';
564import { BusinessError } from '@kit.BasicServicesKit';
565
566reminderAgentManager.removeNotificationSlot(notificationManager.SlotType.CONTENT_INFORMATION).then(() => {
567  console.log("removeNotificationSlot promise");
568}).catch((err: BusinessError) => {
569  console.error("promise err code:" + err.code + " message:" + err.message);
570});
571```
572
573## reminderAgentManager.getAllValidReminders<sup>12+</sup>
574
575getAllValidReminders(): Promise\<Array\<ReminderInfo>>
576
577获取当前应用设置的所有有效(未过期)的代理提醒。使用promise异步回调。
578
579> **说明:**
580>
581> 当到达设置的提醒时间点时,通知中心会弹出相应提醒的通知卡片(通知栏消息)。若未点击通知卡片上的关闭/CLOSE按钮,则代理提醒是有效/未过期的;若点击了关闭/CLOSE按钮,则代理提醒过期。
582>
583> 当代理提醒类型是闹钟时,若设置每天提醒,无论是否点击关闭/CLOSE按钮,代理提醒都是有效的。
584
585**系统能力**: SystemCapability.Notification.ReminderAgent
586
587**返回值**:
588
589| 类型                                              | 说明                                                         |
590| ------------------------------------------------- | ------------------------------------------------------------ |
591| Promise\<Array\<[ReminderInfo](#reminderinfo12)>> | Promise对象,返回当前应用设置的所有有效(未过期)的代理提醒。 |
592
593**错误码:**
594
595以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)和[通用错误码](../errorcode-universal.md)。
596
597| 错误码ID | 错误信息           |
598| -------- | ------------------ |
599| 201      | Permission denied. |
600
601**示例**:
602
603```ts
604import { BusinessError } from '@kit.BasicServicesKit';
605
606reminderAgentManager.getAllValidReminders().then((reminders: Array<reminderAgentManager.ReminderInfo>) => {
607  console.log("promise, getAllValidReminders length = " + reminders.length);
608  for (let i = 0; i < reminders.length; i++) {
609    console.log("getAllValidReminders, reminderId = " + reminders[i].reminderId);
610    console.log("getAllValidReminders, reminderType = " + reminders[i].reminderReq.reminderType);
611    const actionButton = reminders[i].reminderReq.actionButton || [];
612    for (let j = 0; j < actionButton.length; j++) {
613      console.log("getAllValidReminders, actionButton.title = " + actionButton[j]?.title);
614      console.log("getAllValidReminders, actionButton.type = " + actionButton[j]?.type);
615    }
616    console.log("getAllValidReminders, wantAgent.pkgName = " + reminders[i].reminderReq.wantAgent?.pkgName);
617    console.log("getAllValidReminders, wantAgent.abilityName = " + reminders[i].reminderReq.wantAgent?.abilityName);
618    console.log("getAllValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].reminderReq.maxScreenWantAgent?.pkgName);
619    console.log("getAllValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].reminderReq.maxScreenWantAgent?.abilityName);
620    console.log("getAllValidReminders, ringDuration = " + reminders[i].reminderReq.ringDuration);
621    console.log("getAllValidReminders, snoozeTimes = " + reminders[i].reminderReq.snoozeTimes);
622    console.log("getAllValidReminders, timeInterval = " + reminders[i].reminderReq.timeInterval);
623    console.log("getAllValidReminders, title = " + reminders[i].reminderReq.title);
624    console.log("getAllValidReminders, content = " + reminders[i].reminderReq.content);
625    console.log("getAllValidReminders, expiredContent = " + reminders[i].reminderReq.expiredContent);
626    console.log("getAllValidReminders, snoozeContent = " + reminders[i].reminderReq.snoozeContent);
627    console.log("getAllValidReminders, notificationId = " + reminders[i].reminderReq.notificationId);
628    console.log("getAllValidReminders, slotType = " + reminders[i].reminderReq.slotType);
629  }
630}).catch((err: BusinessError) => {
631  console.error("promise err code:" + err.code + " message:" + err.message);
632}); 
633```
634
635## reminderAgentManager.addExcludeDate<sup>12+</sup>
636
637addExcludeDate(reminderId: number, date: Date): Promise\<void>
638
639为指定id的重复日历添加不提醒日期,即在设定的日期范围内不提醒。使用Promise异步回调。
640
641**系统能力**: SystemCapability.Notification.ReminderAgent
642
643**参数**:
644
645| 参数名     | 类型   | 必填 | 说明                             |
646| ---------- | ------ | ---- | -------------------------------- |
647| reminderId | number | 是   | 需要添加不提醒日期的重复日历Id。 |
648| date       | Date   | 是   | 不提醒的日期。                   |
649
650**返回值**:
651
652| 类型           | 说明                      |
653| -------------- | ------------------------- |
654| Promise\<void> | 无返回结果的Promise对象。 |
655
656**错误码:**
657
658以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)和[通用错误码](../errorcode-universal.md)。
659
660| 错误码ID | 错误信息                                       |
661| -------- | ---------------------------------------------- |
662| 201      | Permission denied.                             |
663| 401      | If the input parameter is not valid parameter. |
664| 1700003  | The reminder does not exist.                   |
665
666**示例**:
667
668```ts
669import { BusinessError } from '@kit.BasicServicesKit';
670
671let reminderId: number = 1;
672let date = new Date();
673reminderAgentManager.addExcludeDate(reminderId, date).then(() => {
674  console.log("addExcludeDate promise");
675}).catch((err: BusinessError) => {
676  console.error("promise err code:" + err.code + " message:" + err.message);
677});
678```
679
680## reminderAgentManager.deleteExcludeDates<sup>12+</sup>
681
682deleteExcludeDates(reminderId: number): Promise\<void>
683
684删除重复日历设置的所有不提醒日期,通过Id指定具体重复日历。使用Promise异步回调。
685
686**系统能力**: SystemCapability.Notification.ReminderAgent
687
688**参数**:
689
690| 参数名     | 类型   | 必填 | 说明                             |
691| ---------- | ------ | ---- | -------------------------------- |
692| reminderId | number | 是   | 需要删除不提醒日期的重复日历Id。 |
693
694**返回值**:
695
696| 类型           | 说明                      |
697| -------------- | ------------------------- |
698| Promise\<void> | 无返回结果的Promise对象。 |
699
700**错误码:**
701
702以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)和[通用错误码](../errorcode-universal.md)。
703
704| 错误码ID | 错误信息                     |
705| -------- | ---------------------------- |
706| 201      | Permission denied.           |
707| 1700003  | The reminder does not exist. |
708
709**示例**:
710
711```ts
712import { BusinessError } from '@kit.BasicServicesKit';
713
714let reminderId: number = 1;
715reminderAgentManager.deleteExcludeDates(reminderId).then(() => {
716  console.log("deleteExcludeDates promise");
717}).catch((err: BusinessError) => {
718  console.error("promise err code:" + err.code + " message:" + err.message);
719});
720```
721
722## reminderAgentManager.getExcludeDates<sup>12+</sup>
723
724getExcludeDates(reminderId: number): Promise\<Array\<Date>>
725
726查询重复日历设置的所有不提醒日期,通过Id指定具体重复日历。使用Promise异步回调。
727
728**系统能力**: SystemCapability.Notification.ReminderAgent
729
730**参数**:
731
732| 参数名     | 类型   | 必填 | 说明                             |
733| ---------- | ------ | ---- | -------------------------------- |
734| reminderId | number | 是   | 需要查询不提醒日期的重复日历Id。 |
735
736**返回值**:
737
738| 类型                   | 说明                              |
739| ---------------------- | --------------------------------- |
740| Promise\<Array\<Date>> | Promise对象。返回特定日历设置的所有不提醒日期。 |
741
742**错误码:**
743
744以下错误码的详细介绍请参见[reminderAgentManager错误码](errorcode-reminderAgentManager.md)和[通用错误码](../errorcode-universal.md)。
745
746| 错误码ID | 错误信息                     |
747| -------- | ---------------------------- |
748| 201      | Permission denied.           |
749| 1700003  | The reminder does not exist. |
750
751**示例**:
752
753```ts
754import { BusinessError } from '@kit.BasicServicesKit';
755
756let reminderId: number = 1;
757reminderAgentManager.getExcludeDates(reminderId).then((dates) => {
758  console.log("getExcludeDates promise length: " + dates.length);
759  for (let i = 0; i < dates.length; i++) {
760	console.log("getExcludeDates promise date is: " + dates[i].toString());
761  }
762}).catch((err: BusinessError) => {
763  console.error("promise err code:" + err.code + " message:" + err.message);
764});
765```
766
767## ActionButtonType
768
769按钮的类型。
770
771**系统能力**:SystemCapability.Notification.ReminderAgent
772
773| 名称 | 值 | 说明 |
774| -------- | -------- | -------- |
775| ACTION_BUTTON_TYPE_CLOSE | 0 | 表示关闭提醒的按钮。 |
776| ACTION_BUTTON_TYPE_SNOOZE | 1 | 表示延迟提醒的按钮。 |
777
778## ReminderType
779
780提醒的类型。
781
782**系统能力**:SystemCapability.Notification.ReminderAgent
783
784| 名称 | 值 | 说明 |
785| -------- | -------- | -------- |
786| REMINDER_TYPE_TIMER | 0 | 表示提醒类型:倒计时。 |
787| REMINDER_TYPE_CALENDAR | 1 | 表示提醒类型:日历。 |
788| REMINDER_TYPE_ALARM | 2 | 表示提醒类型:闹钟。 |
789
790
791## ActionButton
792
793弹出的提醒通知中按钮的类型和标题。
794
795**系统能力**:SystemCapability.Notification.ReminderAgent
796
797| 名称 | 类型 | 必填 | 说明 |
798| -------- | -------- | -------- | -------- |
799| title | string | 是 | 按钮显示的标题。 |
800| titleResource<sup>11+</sup> | string | 否 | 标题的资源ID,用于切换系统语言后读取对应标题信息。 |
801| type | [ActionButtonType](#actionbuttontype) | 是 | 按钮的类型。 |
802
803
804## WantAgent
805
806跳转目标的ability信息。
807
808**系统能力**:SystemCapability.Notification.ReminderAgent
809
810
811| 名称 | 类型 | 必填 | 说明 |
812| -------- | -------- | -------- | -------- |
813| pkgName | string | 是 | 指明跳转目标的包名。 |
814| abilityName | string | 是 | 指明跳转目标的ability名称。 |
815| parameters<sup>12+</sup> | Record\<string, Object> | 否 | 需要传递到目标的参数。 |
816| uri<sup>12+</sup> | string | 否 | 指明跳转目标的uri信息。 |
817
818
819## MaxScreenWantAgent
820
821提醒到达时,全屏显示自动拉起目标的ability信息。该接口为预留接口,暂不支持使用。
822
823**系统能力**:SystemCapability.Notification.ReminderAgent
824
825| 名称 | 类型 | 必填 | 说明 |
826| -------- | -------- | -------- | -------- |
827| pkgName | string | 是 | 指明提醒到达时自动拉起的目标包名(如果设备在使用中,则只弹出通知横幅框)。 |
828| abilityName | string | 是 | 指明提醒到达时自动拉起的目标ability名(如果设备在使用中,则只弹出通知横幅框)。 |
829
830
831## ReminderRequest
832
833代理提醒对象,用于设置提醒类型、响铃时长等具体信息。
834
835**系统能力**:SystemCapability.Notification.ReminderAgent
836
837| 名称 | 类型 | 必填 | 说明 |
838| -------- | -------- | -------- | -------- |
839| reminderType | [ReminderType](#remindertype) | 是 | 指明代理提醒类型。 |
840| actionButton | [[ActionButton?, ActionButton?, ActionButton?]](#actionbutton) | 否 | 弹出的提醒通知中显示的按钮。<br>-普通应用:最多支持两个按钮。<br>-系统应用:API9最多支持两个按钮,在API10开始最多支持三个按钮。 |
841| wantAgent | [WantAgent](#wantagent) | 否 | 点击通知后需要跳转的目标ability信息。 |
842| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | 否 | 提醒到达时,全屏显示自动拉起目标的ability信息。如果设备正在使用中,则弹出一个通知横幅框。 <br> 说明:该接口为预留接口,暂不支持使用。|
843| ringDuration | number | 否 | 指明响铃时长(单位:秒),默认1秒。 |
844| snoozeTimes | number | 否 | 指明延迟提醒次数,默认0次(不适用于倒计时提醒类型)。 |
845| timeInterval | number | 否 | 执行延迟提醒间隔(单位:秒),最少5分钟(不适用于倒计时提醒类型)。 |
846| title | string | 否 | 指明提醒标题。 |
847| content | string | 否 | 指明提醒内容。 |
848| expiredContent | string | 否 | 指明提醒过期后需要显示的内容。 |
849| snoozeContent | string | 否 | 指明延迟提醒时需要显示的内容(不适用于倒计时提醒类型)。 |
850| notificationId | number | 否 | 指明提醒使用的通知的id号,需开发者传入,相同id号的提醒会覆盖。 |
851| groupId<sup>11+</sup> | string | 否 | 指明提醒使用相同的组id。相同组id中,一个提醒被点击不在提醒后,组内其他提醒也会被取消。 |
852| slotType | [notification.SlotType](../apis-notification-kit/js-apis-notificationManager.md#slottype) | 否 | 指明提醒的slot类型。 |
853| tapDismissed<sup>10+</sup> | boolean | 否 | 通知是否自动清除,具体请参考[NotificationRequest.tapDismissed](../apis-notification-kit/js-apis-inner-notification-notificationRequest.md#notificationrequest)。  |
854| autoDeletedTime<sup>10+</sup> | number | 否 | 自动清除的时间,具体请参考[NotificationRequest.autoDeletedTime](../apis-notification-kit/js-apis-inner-notification-notificationRequest.md#notificationrequest)。 |
855| snoozeSlotType<sup>11+</sup> | [notification.SlotType](../apis-notification-kit/js-apis-notificationManager.md#slottype) | 否 | 指明延迟提醒的slot类型(不适用于倒计时提醒类型)。 |
856| customRingUri<sup>11+</sup> | string | 否 | 指明自定义提示音的uri。 |
857
858## ReminderRequestCalendar
859
860ReminderRequestCalendar extends ReminderRequest
861
862日历实例对象,用于设置提醒的时间。
863
864**系统能力**:SystemCapability.Notification.ReminderAgent
865
866| 名称 | 类型 | 必填 | 说明 |
867| -------- | -------- | -------- | -------- |
868| dateTime | [LocalDateTime](#localdatetime) | 是 | 指明提醒的目标时间。 |
869| repeatMonths | Array\<number> | 否 | 指明重复提醒的月份。 |
870| repeatDays | Array\<number> | 否 | 指明重复提醒的日期。 |
871| daysOfWeek<sup>11+</sup> | Array\<number> | 否 | 指明每周哪几天需要重复提醒。范围为周一到周日,对应数字为1到7。 |
872| endDateTime<sup>12+</sup> | [LocalDateTime](#localdatetime) | 否 | 指明提醒的结束时间。 |
873
874
875## ReminderRequestAlarm
876
877ReminderRequestAlarm extends ReminderRequest
878
879闹钟实例对象,用于设置提醒的时间。
880
881**系统能力**:SystemCapability.Notification.ReminderAgent
882
883| 名称 | 类型 | 必填 | 说明 |
884| -------- | -------- | -------- | -------- |
885| hour | number | 是 | 指明提醒的目标时刻。 |
886| minute | number | 是 | 指明提醒的目标分钟。 |
887| daysOfWeek | Array\<number> | 否 | 指明每周哪几天需要重复提醒。范围为周一到周日,对应数字为1到7。 |
888
889
890## ReminderRequestTimer
891
892ReminderRequestTimer extends ReminderRequest
893
894倒计时实例对象,用于设置提醒的时间。
895
896**系统能力**:SystemCapability.Notification.ReminderAgent
897
898| 名称 | 类型 | 必填 | 说明 |
899| -------- | -------- | -------- | -------- |
900| triggerTimeInSeconds | number | 是 | 指明倒计时的秒数。 |
901
902
903## LocalDateTime
904
905用于日历类提醒设置时指定时间信息。
906
907**系统能力**:SystemCapability.Notification.ReminderAgent
908
909| 名称 | 类型 | 必填 | 说明 |
910| -------- | -------- | -------- | -------- |
911| year | number | 是 | 年 |
912| month | number | 是 | 月,取值范围是[1, 12]。 |
913| day | number | 是 | 日,取值范围是[1, 31]。 |
914| hour | number | 是 | 时,取值范围是[0, 23]。 |
915| minute | number | 是 | 分,取值范围是[0, 59]。 |
916| second | number | 否 | 秒,取值范围是[0, 59]。 |
917
918## ReminderInfo<sup>12+</sup>
919
920代理提醒信息,包含 ReminderRequest 和 ReminderId。
921
922**系统能力**:SystemCapability.Notification.ReminderAgent
923
924| 名称        | 类型                                | 只读 | 可选 | 说明                  |
925| ----------- | ----------------------------------- | ---- | ---- | --------------------- |
926| reminderId  | number                              | 否   | 否   | 发布提醒后返回的 Id。 |
927| reminderReq | [ReminderRequest](#reminderrequest) | 否   | 否   | 代理提醒对象。        |
928
929