• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.code) {
57    console.error("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发布后台代理提醒。使用promise异步回调。
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.error("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) => {
145  if (err.code) {
146    console.error("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.error("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> **说明:**
202>
203> 当到达设置的提醒时间点时,通知中心会弹出相应提醒的通知卡片(通知栏消息)。若未点击通知卡片上的关闭/CLOSE按钮,则代理提醒是有效/未过期的;若点击了关闭/CLOSE按钮,则代理提醒过期。
204>
205> 当代理提醒类型是闹钟时,若设置每天提醒,无论是否点击关闭/CLOSE按钮,代理提醒都是有效的。
206
207**系统能力**: SystemCapability.Notification.ReminderAgent
208
209**参数**:
210
211| 参数名 | 类型 | 必填 | 说明 |
212| -------- | -------- | -------- | -------- |
213| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)>> | 是 | 回调函数,返回当前应用设置的所有有效的代理提醒。 |
214
215**错误码:**
216
217以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。
218
219| 错误码ID   | 错误信息 |
220| --------- | ------- |
221| 1700004    | The bundle name does not exist. |
222
223**示例**:
224
225```ts
226import { BusinessError } from '@ohos.base';
227
228reminderAgentManager.getValidReminders((err: BusinessError, reminders: Array<reminderAgentManager.ReminderRequest>) => {
229  if (err.code) {
230    console.error("callback err code:" + err.code + " message:" + err.message);
231  } else {
232    console.log("callback, getValidReminders length = " + reminders.length);
233    for (let i = 0; i < reminders.length; i++) {
234      console.log("getValidReminders = " + reminders[i]);
235      console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
236      const actionButton = reminders[i].actionButton || [];
237      for (let j = 0; j < actionButton.length; j++) {
238        console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title);
239        console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type);
240      }
241      console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName);
242      console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName);
243      console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName);
244      console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName);
245      console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
246      console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
247      console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
248      console.log("getValidReminders, title = " + reminders[i].title);
249      console.log("getValidReminders, content = " + reminders[i].content);
250      console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
251      console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
252      console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
253      console.log("getValidReminders, slotType = " + reminders[i].slotType);
254    }
255  }
256});
257```
258
259## reminderAgentManager.getValidReminders
260
261getValidReminders(): Promise\<Array\<ReminderRequest>>
262
263获取当前应用设置的所有有效(未过期)的代理提醒。使用promise异步回调。
264
265> **说明:**
266>
267> 当到达设置的提醒时间点时,通知中心会弹出相应提醒的通知卡片(通知栏消息)。若未点击通知卡片上的关闭/CLOSE按钮,则代理提醒是有效/未过期的;若点击了关闭/CLOSE按钮,则代理提醒过期。
268>
269> 当代理提醒类型是闹钟时,若设置每天提醒,无论是否点击关闭/CLOSE按钮,代理提醒都是有效的。
270
271**系统能力**: SystemCapability.Notification.ReminderAgent
272
273**返回值**:
274
275| 类型 | 说明 |
276| -------- | -------- |
277| Promise\<Array\<[ReminderRequest](#reminderrequest)>> | Promise对象,返回当前应用设置的所有有效的代理提醒。 |
278
279**错误码:**
280
281以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。
282
283| 错误码ID   | 错误信息 |
284| --------- | ------- |
285| 1700004    | The bundle name does not exist. |
286
287**示例**:
288
289```ts
290import { BusinessError } from '@ohos.base';
291
292reminderAgentManager.getValidReminders().then((reminders: Array<reminderAgentManager.ReminderRequest>) => {
293  console.log("promise, getValidReminders length = " + reminders.length);
294  for (let i = 0; i < reminders.length; i++) {
295    console.log("getValidReminders = " + reminders[i]);
296    console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
297    const actionButton = reminders[i].actionButton || [];
298    for (let j = 0; j < actionButton.length; j++) {
299      console.log("getValidReminders, actionButton.title = " + actionButton[j]?.title);
300      console.log("getValidReminders, actionButton.type = " + actionButton[j]?.type);
301    }
302    console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent?.pkgName);
303    console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent?.abilityName);
304    console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent?.pkgName);
305    console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent?.abilityName);
306    console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
307    console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
308    console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
309    console.log("getValidReminders, title = " + reminders[i].title);
310    console.log("getValidReminders, content = " + reminders[i].content);
311    console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
312    console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
313    console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
314    console.log("getValidReminders, slotType = " + reminders[i].slotType);
315  }
316}).catch((err: BusinessError) => {
317  console.error("promise err code:" + err.code + " message:" + err.message);
318});
319```
320
321## reminderAgentManager.cancelAllReminders
322
323cancelAllReminders(callback: AsyncCallback\<void>): void
324
325取消当前应用设置的所有代理提醒。使用callback异步回调。
326
327**系统能力**: SystemCapability.Notification.ReminderAgent
328
329**参数**:
330
331| 参数名 | 类型 | 必填 | 说明 |
332| -------- | -------- | -------- | -------- |
333| callback | AsyncCallback\<void> | 是 | 回调函数,取消代理提醒成功,err为undefined,否则为错误对象。  |
334
335**错误码:**
336
337以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。
338
339| 错误码ID   | 错误信息 |
340| --------- | ------- |
341| 1700004    | The bundle name does not exist. |
342
343**示例**:
344
345```ts
346import { BusinessError } from '@ohos.base';
347
348reminderAgentManager.cancelAllReminders((err: BusinessError) =>{
349  if (err.code) {
350    console.error("callback err code:" + err.code + " message:" + err.message);
351  } else {
352    console.log("cancelAllReminders callback")
353  }
354});
355```
356
357## reminderAgentManager.cancelAllReminders
358
359cancelAllReminders(): Promise\<void>
360
361取消当前应用设置的所有代理提醒。使用Promise异步回调。
362
363**系统能力**: SystemCapability.Notification.ReminderAgent
364
365**返回值**:
366
367| 类型 | 说明 |
368| -------- | -------- |
369| Promise\<void> | 无返回结果的Promise对象。 |
370
371**错误码:**
372
373以下错误码的详细介绍请参见[reminderAgentManager错误码](../errorcodes/errorcode-reminderAgentManager.md)。
374
375| 错误码ID   | 错误信息 |
376| --------- | ------- |
377| 1700004    | The bundle name does not exist. |
378
379**示例**:
380
381```ts
382import { BusinessError } from '@ohos.base';
383
384reminderAgentManager.cancelAllReminders().then(() => {
385  console.log("cancelAllReminders promise")
386}).catch((err: BusinessError) => {
387  console.error("promise err code:" + err.code + " message:" + err.message);
388});
389```
390
391
392## reminderAgentManager.addNotificationSlot
393
394addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void
395
396添加NotificationSlot(通知槽)。使用callback异步回调。
397
398**系统能力**: SystemCapability.Notification.ReminderAgent
399
400**参数**:
401
402| 参数名 | 类型 | 必填 | 说明 |
403| -------- | -------- | -------- | -------- |
404| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification\.slot实例,仅支持设置其type属性。 |
405| callback | AsyncCallback\<void> | 是 | 回调函数,添加NotificationSlot成功时,err为undefined,否则err为错误对象。 |
406
407**示例**:
408
409```ts
410import notification from '@ohos.notificationManager'
411import { BusinessError } from '@ohos.base';
412
413let mySlot: notification.NotificationSlot = {
414  type: notification.SlotType.SOCIAL_COMMUNICATION
415}
416
417reminderAgentManager.addNotificationSlot(mySlot, (err: BusinessError) => {
418  if (err.code) {
419    console.error("callback err code:" + err.code + " message:" + err.message);
420  } else {
421    console.log("addNotificationSlot callback");
422  }
423});
424```
425
426
427## reminderAgentManager.addNotificationSlot
428
429addNotificationSlot(slot: NotificationSlot): Promise\<void>
430
431添加NotificationSlot(通知槽)。使用promise异步回调。
432
433**系统能力**: SystemCapability.Notification.ReminderAgent
434
435**参数**:
436
437| 参数名 | 类型 | 必填 | 说明 |
438| -------- | -------- | -------- | -------- |
439| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification\.slot实例,仅支持设置其type属性。 |
440
441**返回值**:
442
443| 类型 | 说明 |
444| -------- | -------- |
445| Promise\<void> | 无返回结果的Promise对象。 |
446
447**示例**:
448
449```ts
450import notification from '@ohos.notificationManager'
451import { BusinessError } from '@ohos.base';
452
453let mySlot: notification.NotificationSlot = {
454  type: notification.SlotType.SOCIAL_COMMUNICATION
455}
456reminderAgentManager.addNotificationSlot(mySlot).then(() => {
457  console.log("addNotificationSlot promise");
458}).catch((err: BusinessError) => {
459  console.error("promise err code:" + err.code + " message:" + err.message);
460});
461```
462
463
464## reminderAgentManager.removeNotificationSlot
465
466removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void
467
468删除目标NotificationSlot(通知槽),使用callback异步回调。
469
470**系统能力**: SystemCapability.Notification.ReminderAgent
471
472**参数**:
473
474| 参数名 | 类型 | 必填 | 说明 |
475| -------- | -------- | -------- | -------- |
476| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 |
477| callback | AsyncCallback\<void> | 是 | 回调函数,当删除成功时,err为undefined,否则为错误对象。 |
478
479**示例**:
480
481```ts
482import notification from '@ohos.notificationManager'
483import { BusinessError } from '@ohos.base';
484
485reminderAgentManager.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION,
486  (err: BusinessError) => {
487  if (err.code) {
488    console.error("callback err code:" + err.code + " message:" + err.message);
489  } else {
490    console.log("removeNotificationSlot callback");
491  }
492});
493```
494
495
496## reminderAgentManager.removeNotificationSlot
497
498removeNotificationSlot(slotType: notification.SlotType): Promise\<void>
499
500删除目标NotificationSlot(通知槽),使用Promise异步回调。
501
502**系统能力**: SystemCapability.Notification.ReminderAgent
503
504**参数**:
505
506| 参数名 | 类型 | 必填 | 说明 |
507| -------- | -------- | -------- | -------- |
508| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification\.slot的类型。 |
509
510**返回值**:
511
512| 类型 | 说明 |
513| -------- | -------- |
514| Promise\<void> | 无返回结果的Promise对象。 |
515
516**示例**:
517
518```ts
519import notification from '@ohos.notificationManager'
520import { BusinessError } from '@ohos.base';
521
522reminderAgentManager.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
523  console.log("removeNotificationSlot promise");
524}).catch((err: BusinessError) => {
525  console.error("promise err code:" + err.code + " message:" + err.message);
526});
527```
528
529## ActionButtonType
530
531按钮的类型。
532
533**系统能力**:SystemCapability.Notification.ReminderAgent
534
535| 名称 | 值 | 说明 |
536| -------- | -------- | -------- |
537| ACTION_BUTTON_TYPE_CLOSE | 0 | 表示关闭提醒的按钮。 |
538| ACTION_BUTTON_TYPE_SNOOZE | 1 | 表示延迟提醒的按钮。 |
539| ACTION_BUTTON_TYPE_CUSTOM<sup>10+</sup>  | 2 | 表示自定义的按钮。<br>**系统接口**: 系统接口,三方应用不支持调用。 |
540
541
542## ReminderType
543
544提醒的类型。
545
546**系统能力**:SystemCapability.Notification.ReminderAgent
547
548| 名称 | 值 | 说明 |
549| -------- | -------- | -------- |
550| REMINDER_TYPE_TIMER | 0 | 表示提醒类型:倒计时。 |
551| REMINDER_TYPE_CALENDAR | 1 | 表示提醒类型:日历。 |
552| REMINDER_TYPE_ALARM | 2 | 表示提醒类型:闹钟。 |
553
554
555## ActionButton
556
557弹出的提醒通知中按钮的类型和标题。
558
559**系统能力**:SystemCapability.Notification.ReminderAgent
560
561| 名称 | 类型 | 必填 | 说明 |
562| -------- | -------- | -------- | -------- |
563| title | string | 是 | 按钮显示的标题。 |
564| type | [ActionButtonType](#actionbuttontype) | 是 | 按钮的类型。 |
565| wantAgent<sup>10+</sup> | [WantAgent](#wantagent) | 否 | 点击按钮跳转的ability信息。<br>**系统接口**: 系统接口,三方应用不支持调用。 |
566
567
568## WantAgent
569
570跳转目标的ability信息。
571
572**系统能力**:SystemCapability.Notification.ReminderAgent
573
574
575| 名称 | 类型 | 必填 | 说明 |
576| -------- | -------- | -------- | -------- |
577| pkgName | string | 是 | 指明跳转目标的包名。 |
578| abilityName | string | 是 | 指明跳转目标的ability名称。 |
579| uri<sup>10+</sup> | string | 否 | 指明跳转目标的uri信息。<br>**系统接口**: 系统接口,三方应用不支持调用。 |
580
581
582## MaxScreenWantAgent
583
584提醒到达时,全屏显示自动拉起目标的ability信息。该接口为预留接口,暂不支持使用。
585
586**系统能力**:SystemCapability.Notification.ReminderAgent
587
588| 名称 | 类型 | 必填 | 说明 |
589| -------- | -------- | -------- | -------- |
590| pkgName | string | 是 | 指明提醒到达时自动拉起的目标包名(如果设备在使用中,则只弹出通知横幅框)。 |
591| abilityName | string | 是 | 指明提醒到达时自动拉起的目标ability名(如果设备在使用中,则只弹出通知横幅框)。 |
592
593
594## ReminderRequest
595
596代理提醒对象,用于设置提醒类型、响铃时长等具体信息。
597
598**系统能力**:SystemCapability.Notification.ReminderAgent
599
600| 名称 | 类型 | 必填 | 说明 |
601| -------- | -------- | -------- | -------- |
602| reminderType | [ReminderType](#remindertype) | 是 | 指明代理提醒类型。 |
603| actionButton | [[ActionButton?, ActionButton?, ActionButton?]](#actionbutton) | 否 | 弹出的提醒通知栏中显示的按钮。<br>-普通应用:最多支持两个按钮。<br>-系统应用:API9最多支持两个按钮,在API10开始最多支持三个按钮。 |
604| wantAgent | [WantAgent](#wantagent) | 否 | 点击通知后需要跳转的目标ability信息。 |
605| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | 否 | 提醒到达时,全屏显示自动拉起目标的ability信息。如果设备正在使用中,则弹出一个通知框。 <br> 说明:该接口为预留接口,暂不支持使用。|
606| ringDuration | number | 否 | 指明响铃时长(单位:秒),默认1秒。 |
607| snoozeTimes | number | 否 | 指明延迟提醒次数,默认0次(不适用于倒计时提醒类型)。 |
608| timeInterval | number | 否 | 执行延迟提醒间隔(单位:秒),最少5分钟(不适用于倒计时提醒类型)。 |
609| title | string | 否 | 指明提醒标题。 |
610| content | string | 否 | 指明提醒内容。 |
611| expiredContent | string | 否 | 指明提醒过期后需要显示的内容。 |
612| snoozeContent | string | 否 | 指明延迟提醒时需要显示的内容(不适用于倒计时提醒类型)。 |
613| notificationId | number | 否 | 指明提醒使用的通知的id号,相同id号的提醒会覆盖。 |
614| slotType | [notification.SlotType](js-apis-notificationManager.md#slottype) | 否 | 指明提醒的slot类型。 |
615| tapDismissed<sup>10+</sup> | boolean | 否 | 通知是否自动清除,具体请参考[NotificationRequest.tapDismissed](js-apis-inner-notification-notificationRequest.md#notificationrequest)。  |
616| autoDeletedTime<sup>10+</sup> | number | 否 | 自动清除的时间,具体请参考[NotificationRequest.autoDeletedTime](js-apis-inner-notification-notificationRequest.md#notificationrequest)。 |
617
618
619## ReminderRequestCalendar
620
621ReminderRequestCalendar extends ReminderRequest
622
623日历实例对象,用于设置提醒的时间。
624
625**系统能力**:SystemCapability.Notification.ReminderAgent
626
627| 名称 | 类型 | 必填 | 说明 |
628| -------- | -------- | -------- | -------- |
629| dateTime | [LocalDateTime](#localdatetime) | 是 | 指明提醒的目标时间。 |
630| repeatMonths | Array\<number> | 否 | 指明重复提醒的月份。 |
631| repeatDays | Array\<number> | 否 | 指明重复提醒的日期。 |
632
633
634## ReminderRequestAlarm
635
636ReminderRequestAlarm extends ReminderRequest
637
638闹钟实例对象,用于设置提醒的时间。
639
640**系统能力**:SystemCapability.Notification.ReminderAgent
641
642| 名称 | 类型 | 必填 | 说明 |
643| -------- | -------- | -------- | -------- |
644| hour | number | 是 | 指明提醒的目标时刻。 |
645| minute | number | 是 | 指明提醒的目标分钟。 |
646| daysOfWeek | Array\<number> | 否 | 指明每周哪几天需要重复提醒。范围为周一到周末,对应数字为1到7。 |
647
648
649## ReminderRequestTimer
650
651ReminderRequestTimer extends ReminderRequest
652
653倒计时实例对象,用于设置提醒的时间。
654
655**系统能力**:SystemCapability.Notification.ReminderAgent
656
657| 名称 | 类型 | 必填 | 说明 |
658| -------- | -------- | -------- | -------- |
659| triggerTimeInSeconds | number | 是 | 指明倒计时的秒数。 |
660
661
662## LocalDateTime
663
664用于日历类提醒设置时指定时间信息。
665
666**系统能力**:SystemCapability.Notification.ReminderAgent
667
668| 名称 | 类型 | 必填 | 说明 |
669| -------- | -------- | -------- | -------- |
670| year | number | 是 | 年 |
671| month | number | 是 | 月,取值范围是[1, 12]。 |
672| day | number | 是 | 日,取值范围是[1, 31]。 |
673| hour | number | 是 | 时,取值范围是[0, 23]。 |
674| minute | number | 是 | 分,取值范围是[0, 59]。 |
675| second | number | 否 | 秒,取值范围是[0, 59]。 |
676