js-apis-reminderAgent.md 18.6 KB
Newer Older
E
uu  
ester.zhou 已提交
1
# reminderAgent
Z
zengyawen 已提交
2

E
uu  
ester.zhou 已提交
3 4 5 6 7 8
The **reminderAgent** module provides APIs for publishing scheduled reminders through the reminder agent.

You can set your application to use the reminder agent APIs to create scheduled reminders for countdown timers, calendar events, and alarm clocks. When the created reminders are published, the timing and pop-up notification functions of your application will be taken over by the reminder agent in the background when your application is frozen or exits.

> **NOTE**
>
E
ester.zhou 已提交
9
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Z
zengyawen 已提交
10 11


E
ester.zhou 已提交
12
## Modules to Import
Z
zengyawen 已提交
13 14

```
E
ester.zhou 已提交
15
import reminderAgent from'@ohos.reminderAgent';
Z
zengyawen 已提交
16 17
```

E
ester.zhou 已提交
18 19 20 21 22

## reminderAgent.publishReminder

publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number>): void

E
ester.zhou 已提交
23
Publishes a reminder through the reminder agent. This API uses an asynchronous callback to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](../reference/apis/js-apis-notification.md#notificationrequestenablenotification8).
E
ester.zhou 已提交
24

E
ester.zhou 已提交
25
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
E
ester.zhou 已提交
26

E
ester.zhou 已提交
27 28 29
**System capability**: SystemCapability.Notification.ReminderAgent

**Parameters**
E
ester.zhou 已提交
30

E
uu  
ester.zhou 已提交
31 32 33 34
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
| callback | AsyncCallback<number> | Yes| Asynchronous callback used to return the published reminder's ID.|
E
ester.zhou 已提交
35

E
ester.zhou 已提交
36
**Example**
E
uu  
ester.zhou 已提交
37
```js
R
rcy-hw 已提交
38
  let timer = {
R
rcy-hw 已提交
39 40
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
E
ester.zhou 已提交
41
  }
R
rcy-hw 已提交
42
  reminderAgent.publishReminder(timer, (err, reminderId) => {
R
rcy-hw 已提交
43
      console.log("callback, reminderId = " + reminderId);
R
rcy-hw 已提交
44
  });
E
uu  
ester.zhou 已提交
45
```
E
ester.zhou 已提交
46 47 48 49 50 51


## reminderAgent.publishReminder

publishReminder(reminderReq: ReminderRequest): Promise<number>

E
ester.zhou 已提交
52
Publishes a reminder through the reminder agent. This API uses a promise to return the result. It can be called only when notification is enabled for the application through [Notification.requestEnableNotification](../reference/apis/js-apis-notification.md#notificationrequestenablenotification8).
E
ester.zhou 已提交
53

E
uu  
ester.zhou 已提交
54 55
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER

E
ester.zhou 已提交
56
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
57

E
ester.zhou 已提交
58
**Parameters**
E
uu  
ester.zhou 已提交
59 60 61
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
E
ester.zhou 已提交
62

E
ester.zhou 已提交
63
**Return value**
E
uu  
ester.zhou 已提交
64 65 66
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the published reminder's ID.|
E
ester.zhou 已提交
67

E
ester.zhou 已提交
68
**Example**
E
uu  
ester.zhou 已提交
69
```js
R
rcy-hw 已提交
70
  let timer = {
R
rcy-hw 已提交
71 72
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
E
ester.zhou 已提交
73
  }
R
rcy-hw 已提交
74
  reminderAgent.publishReminder(timer).then((reminderId) => {
R
rcy-hw 已提交
75
      console.log("promise, reminderId = " + reminderId);
R
rcy-hw 已提交
76
  });
E
uu  
ester.zhou 已提交
77
```
E
ester.zhou 已提交
78 79 80 81 82 83 84 85


## reminderAgent.cancelReminder

cancelReminder(reminderId: number, callback: AsyncCallback<void>): void

Cancels the reminder with the specified ID. This API uses an asynchronous callback to return the cancellation result.

E
ester.zhou 已提交
86
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
87

E
ester.zhou 已提交
88
**Parameters**
E
ester.zhou 已提交
89 90 91 92 93 94

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|
| callback | AsyncCallback<void> | Yes| Asynchronous callback used to return the result.|

E
ester.zhou 已提交
95
**Example**
Z
zengyawen 已提交
96

R
rcy-hw 已提交
97
```js
R
rcy-hw 已提交
98 99 100
reminderAgent.cancelReminder(1, (err, data) => {
    console.log("cancelReminder callback");
});
Z
zengyawen 已提交
101 102
```

E
ester.zhou 已提交
103 104 105 106 107 108 109

## reminderAgent.cancelReminder

cancelReminder(reminderId: number): Promise<void>

Cancels the reminder with the specified ID. This API uses a promise to return the cancellation result.

E
ester.zhou 已提交
110
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
111

E
ester.zhou 已提交
112
**Parameters**
E
ester.zhou 已提交
113 114 115 116 117

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderId | number | Yes| ID of the reminder to cancel.|

E
ester.zhou 已提交
118
**Return value**
E
ester.zhou 已提交
119 120 121 122 123

| Type| Description|
| -------- | -------- |
| Promise<void> | Promise used to return the result.|

E
ester.zhou 已提交
124
**Example**
Z
zengyawen 已提交
125

R
rcy-hw 已提交
126
```js
R
rcy-hw 已提交
127 128 129
reminderAgent.cancelReminder(1).then(() => {
    console.log("cancelReminder promise");
});
Z
zengyawen 已提交
130 131
```

E
ester.zhou 已提交
132 133 134 135 136 137 138

## reminderAgent.getValidReminders

getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>): void

Obtains all valid (not yet expired) reminders set by the current application. This API uses an asynchronous callback to return the reminders.

E
ester.zhou 已提交
139
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
140

E
ester.zhou 已提交
141
**Parameters**
E
ester.zhou 已提交
142 143 144 145 146

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<Array<[ReminderRequest](#reminderrequest)>> | Yes| Asynchronous callback used to return an array of all valid reminders set by the current application.|

E
ester.zhou 已提交
147
**Example**
Z
zengyawen 已提交
148

R
rcy-hw 已提交
149
```js
Z
zengyawen 已提交
150
reminderAgent.getValidReminders((err, reminders) => {
R
rcy-hw 已提交
151
    console.log("callback, getValidReminders length = " + reminders.length);
Z
zengyawen 已提交
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
    for (let i = 0; i < reminders.length; i++) {
        console.log("getValidReminders = " + reminders[i]);
        console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
        for (let j = 0; j < reminders[i].actionButton.length; j++) {
            console.log("getValidReminders, actionButton.title = " + reminders[i].actionButton[j].title);
            console.log("getValidReminders, actionButton.type = " + reminders[i].actionButton[j].type);
        }
        console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent.pkgName);
        console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent.abilityName);
        console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent.pkgName);
        console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent.abilityName);
        console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
        console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
        console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
        console.log("getValidReminders, title = " + reminders[i].title);
        console.log("getValidReminders, content = " + reminders[i].content);
        console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
        console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
        console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
        console.log("getValidReminders, slotType = " + reminders[i].slotType);
    }
})
```


E
ester.zhou 已提交
177 178 179 180 181
## reminderAgent.getValidReminders

getValidReminders(): Promise&lt;Array&lt;ReminderRequest&gt;&gt;

Obtains all valid (not yet expired) reminders set by the current application. This API uses a promise to return the reminders.
Z
zengyawen 已提交
182

E
ester.zhou 已提交
183
**System capability**: SystemCapability.Notification.ReminderAgent
Z
zengyawen 已提交
184

E
ester.zhou 已提交
185
**Return value**
Z
zengyawen 已提交
186

E
ester.zhou 已提交
187 188 189 190
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[ReminderRequest](#reminderrequest)&gt;&gt; | Promise used to return an array of all valid reminders set by the current application.|

E
ester.zhou 已提交
191
**Example**
Z
zengyawen 已提交
192

R
rcy-hw 已提交
193
```js
E
ester.zhou 已提交
194
reminderAgent.getValidReminders().then((reminders) => {
R
rcy-hw 已提交
195
    console.log("promise, getValidReminders length = " + reminders.length);
Z
zengyawen 已提交
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
    for (let i = 0; i < reminders.length; i++) {
        console.log("getValidReminders = " + reminders[i]);
        console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
        for (let j = 0; j < reminders[i].actionButton.length; j++) {
            console.log("getValidReminders, actionButton.title = " + reminders[i].actionButton[j].title);
            console.log("getValidReminders, actionButton.type = " + reminders[i].actionButton[j].type);
        }
        console.log("getValidReminders, wantAgent.pkgName = " + reminders[i].wantAgent.pkgName);
        console.log("getValidReminders, wantAgent.abilityName = " + reminders[i].wantAgent.abilityName);
        console.log("getValidReminders, maxScreenWantAgent.pkgName = " + reminders[i].maxScreenWantAgent.pkgName);
        console.log("getValidReminders, maxScreenWantAgent.abilityName = " + reminders[i].maxScreenWantAgent.abilityName);
        console.log("getValidReminders, ringDuration = " + reminders[i].ringDuration);
        console.log("getValidReminders, snoozeTimes = " + reminders[i].snoozeTimes);
        console.log("getValidReminders, timeInterval = " + reminders[i].timeInterval);
        console.log("getValidReminders, title = " + reminders[i].title);
        console.log("getValidReminders, content = " + reminders[i].content);
        console.log("getValidReminders, expiredContent = " + reminders[i].expiredContent);
        console.log("getValidReminders, snoozeContent = " + reminders[i].snoozeContent);
        console.log("getValidReminders, notificationId = " + reminders[i].notificationId);
        console.log("getValidReminders, slotType = " + reminders[i].slotType);
    }
})
```

E
ester.zhou 已提交
220 221 222 223 224 225 226

## reminderAgent.cancelAllReminders

cancelAllReminders(callback: AsyncCallback&lt;void&gt;): void

Cancels all reminders set by the current application. This API uses an asynchronous callback to return the cancellation result.

E
ester.zhou 已提交
227
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
228

E
ester.zhou 已提交
229
**Parameters**
E
ester.zhou 已提交
230 231 232 233 234

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|

E
ester.zhou 已提交
235
**Example**
Z
zengyawen 已提交
236

R
rcy-hw 已提交
237
```js
E
ester.zhou 已提交
238
reminderAgent.cancelAllReminders((err, data) =>{
R
rcy-hw 已提交
239 240
    console.log("cancelAllReminders callback")
})
Z
zengyawen 已提交
241 242 243
```


E
ester.zhou 已提交
244
## reminderAgent.cancelAllReminders
Z
zengyawen 已提交
245

E
ester.zhou 已提交
246
cancelAllReminders(): Promise&lt;void&gt;
Z
zengyawen 已提交
247

E
ester.zhou 已提交
248
Cancels all reminders set by the current application. This API uses a promise to return the cancellation result.
Z
zengyawen 已提交
249

E
ester.zhou 已提交
250
**System capability**: SystemCapability.Notification.ReminderAgent
Z
zengyawen 已提交
251

E
ester.zhou 已提交
252
**Return value**
E
ester.zhou 已提交
253 254 255 256 257

| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|

E
ester.zhou 已提交
258
**Example**
Z
zengyawen 已提交
259

R
rcy-hw 已提交
260
```js
Z
zengyawen 已提交
261
reminderAgent.cancelAllReminders().then(() => {
R
rcy-hw 已提交
262 263
    console.log("cancelAllReminders promise")
})
Z
zengyawen 已提交
264 265
```

E
ester.zhou 已提交
266 267 268 269 270

## reminderAgent.addNotificationSlot

addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback&lt;void&gt;): void

E
uu  
ester.zhou 已提交
271
Adds a notification slot. This API uses an asynchronous callback to return the result.
E
ester.zhou 已提交
272

E
ester.zhou 已提交
273
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
274

E
ester.zhou 已提交
275
**Parameters**
E
ester.zhou 已提交
276 277 278

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
E
uu  
ester.zhou 已提交
279
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
E
ester.zhou 已提交
280 281
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|

E
ester.zhou 已提交
282
**Example**
Z
zengyawen 已提交
283

R
rcy-hw 已提交
284
```js
R
rcy-hw 已提交
285 286
import notification from '@ohos.notification'

R
rcy-hw 已提交
287
let mySlot = {
R
rcy-hw 已提交
288
    type: notification.SlotType.SOCIAL_COMMUNICATION
Z
zengyawen 已提交
289
}
R
rcy-hw 已提交
290
reminderAgent.addNotificationSlot(mySlot, (err, data) => {
R
rcy-hw 已提交
291 292
    console.log("addNotificationSlot callback");
});
Z
zengyawen 已提交
293 294
```

E
ester.zhou 已提交
295 296 297 298 299

## reminderAgent.addNotificationSlot

addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt;

E
uu  
ester.zhou 已提交
300
Adds a notification slot. This API uses a promise to return the result.
E
ester.zhou 已提交
301

E
ester.zhou 已提交
302
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
303

E
ester.zhou 已提交
304
**Parameters**
E
ester.zhou 已提交
305 306 307

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
E
uu  
ester.zhou 已提交
308
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
E
ester.zhou 已提交
309

E
ester.zhou 已提交
310
**Return value**
E
ester.zhou 已提交
311 312 313 314 315

| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|

E
ester.zhou 已提交
316
**Example**
Z
zengyawen 已提交
317

R
rcy-hw 已提交
318
```js
R
rcy-hw 已提交
319 320
import notification from '@ohos.notification'

R
rcy-hw 已提交
321
let mySlot = {
R
rcy-hw 已提交
322
    type: notification.SlotType.SOCIAL_COMMUNICATION
Z
zengyawen 已提交
323
}
R
rcy-hw 已提交
324 325 326
reminderAgent.addNotificationSlot(mySlot).then(() => {
   console.log("addNotificationSlot promise");
});
Z
zengyawen 已提交
327 328
```

E
ester.zhou 已提交
329 330 331 332 333 334 335

## reminderAgent.removeNotificationSlot

removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback&lt;void&gt;): void

Removes a notification slot of a specified type. This API uses an asynchronous callback to return the result.

E
ester.zhou 已提交
336
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
337

E
ester.zhou 已提交
338
**Parameters**
E
ester.zhou 已提交
339 340 341

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
E
uu  
ester.zhou 已提交
342
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
E
ester.zhou 已提交
343 344
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|

E
ester.zhou 已提交
345
**Example**
Z
zengyawen 已提交
346

R
rcy-hw 已提交
347
```js
R
rcy-hw 已提交
348 349
import notification from '@ohos.notification'

R
rcy-hw 已提交
350 351
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
    console.log("removeNotificationSlot callback");
E
ester.zhou 已提交
352
});
Z
zengyawen 已提交
353 354
```

E
ester.zhou 已提交
355 356 357 358 359 360 361

## reminderAgent.removeNotificationSlot

removeNotificationSlot(slotType: notification.SlotType): Promise&lt;void&gt;

Removes a notification slot of a specified type. This API uses a promise to return the result.

E
ester.zhou 已提交
362
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
363

E
ester.zhou 已提交
364
**Parameters**
E
ester.zhou 已提交
365 366 367

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
E
uu  
ester.zhou 已提交
368
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the notification slot to remove.|
E
ester.zhou 已提交
369

E
ester.zhou 已提交
370
**Return value**
E
ester.zhou 已提交
371 372 373 374 375

| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|

E
ester.zhou 已提交
376
**Example**
Z
zengyawen 已提交
377

R
rcy-hw 已提交
378
```js
R
rcy-hw 已提交
379 380
import notification from '@ohos.notification'

R
rcy-hw 已提交
381 382 383
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
    console.log("removeNotificationSlot promise");
});
Z
zengyawen 已提交
384 385
```

E
ester.zhou 已提交
386 387

## ActionButtonType
Z
zengyawen 已提交
388 389 390

Enumerates button types.

E
ester.zhou 已提交
391
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
392 393 394 395 396 397 398 399

| Name| Default Value| Description|
| -------- | -------- | -------- |
| ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.|
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|


## ReminderType
Z
zengyawen 已提交
400 401 402

Enumerates reminder types.

E
ester.zhou 已提交
403
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
404 405 406 407 408 409 410 411 412

| Name| Default Value| Description|
| -------- | -------- | -------- |
| REMINDER_TYPE_TIMER | 0 | Countdown reminder.|
| REMINDER_TYPE_CALENDAR | 1 | Calendar reminder.|
| REMINDER_TYPE_ALARM | 2 | Alarm reminder.|


## ActionButton
Z
zengyawen 已提交
413 414 415

Defines a button displayed in the reminder notification.

E
ester.zhou 已提交
416
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
417 418 419 420 421 422 423 424

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| title | string | Yes| Text on the button.|
| type | [ActionButtonType](#actionbuttontype) | Yes| Button type.|


## WantAgent
Z
zengyawen 已提交
425 426 427

Sets the package and ability that are redirected to when the reminder notification is clicked.

E
ester.zhou 已提交
428
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
429 430 431 432 433 434 435 436

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the package that is redirected to when the reminder notification is clicked.|
| abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.|


## MaxScreenWantAgent
Z
zengyawen 已提交
437

E
ester.zhou 已提交
438
Provides the information about the target package and ability to start automatically when the reminder is displayed in full-screen mode. This API is reserved.
Z
zengyawen 已提交
439

E
ester.zhou 已提交
440
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
441 442 443 444 445 446 447 448

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pkgName | string | Yes| Name of the package that is automatically started when the reminder arrives and the device is not in use.|
| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|


## ReminderRequest
Z
zengyawen 已提交
449 450 451

Defines the reminder to publish.

E
ester.zhou 已提交
452
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
453 454 455 456

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reminderType | ReminderType | Yes| Type of the reminder.|
E
ester.zhou 已提交
457
| actionButton | [ActionButton?,&nbsp;ActionButton?] | No| Button displayed in the reminder notification. (The parameter is optional. Up to two buttons are supported.)|
E
ester.zhou 已提交
458 459 460 461 462 463 464 465 466 467 468 469 470 471
| wantAgent | WantAgent | No| Information about the ability that is redirected to when the notification is clicked.|
| maxScreenWantAgent | MaxScreenWantAgent | No| Information about the ability that is automatically started when the reminder arrives. If the device is in use, a notification will be displayed.|
| ringDuration | number | No| Ringing duration.|
| snoozeTimes | number | No| Number of reminder snooze times.|
| timeInterval | number | No| Reminder snooze interval.|
| title | string | No| Reminder title.|
| content | string | No| Reminder content.|
| expiredContent | string | No| Content to be displayed after the reminder expires.|
| snoozeContent | string | No| Content to be displayed when the reminder is snoozing.|
| notificationId | number | No| Notification ID used by the reminder. If there are reminders with the same notification ID, the later one will overwrite the earlier one.|
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | No| Type of the slot used by the reminder.|


## ReminderRequestCalendar
Z
zengyawen 已提交
472 473 474 475 476

ReminderRequestCalendar extends ReminderRequest

Defines a reminder for a calendar event.

E
ester.zhou 已提交
477
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
478 479 480 481 482 483 484 485 486

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.|
| repeatMonths | Array&lt;number&gt; | No| Month in which the reminder repeats.|
| repeatDays | Array&lt;number&gt; | No| Date on which the reminder repeats.|


## ReminderRequestAlarm
Z
zengyawen 已提交
487 488 489

ReminderRequestAlarm extends ReminderRequest

E
ester.zhou 已提交
490 491
Defines a reminder for an alarm.

E
ester.zhou 已提交
492
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
493

E
ester.zhou 已提交
494
| Name| Type| Mandatory| Description|
E
ester.zhou 已提交
495 496 497 498 499 500 501 502 503
| -------- | -------- | -------- | -------- |
| hour | number | Yes| Hour portion of the reminder time.|
| minute | number | Yes| Minute portion of the reminder time.|
| daysOfWeek | Array&lt;number&gt; | No| Days of a week when the reminder repeats.|


## ReminderRequestTimer

ReminderRequestTimer extends ReminderRequest
Z
zengyawen 已提交
504 505 506

Defines a reminder for a scheduled timer.

E
ester.zhou 已提交
507
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
508 509 510 511 512 513 514

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| triggerTimeInSeconds | number | Yes| Number of seconds in the countdown timer.|


## LocalDateTime
Z
zengyawen 已提交
515 516 517

Sets the time information for a calendar reminder.

E
ester.zhou 已提交
518
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
519 520 521 522 523 524 525 526 527

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| year | number | Yes| Year.|
| month | number | Yes| Month.|
| day | number | Yes| Date.|
| hour | number | Yes| Hour.|
| minute | number | Yes| Minute.|
| second | number | No| Second.|