js-apis-reminderAgent.md 24.2 KB
Newer Older
G
Gloria 已提交
1
# @ohos.reminderAgent (reminderAgent)
Z
zengyawen 已提交
2

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

5
You can use the 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.
E
uu  
ester.zhou 已提交
6 7 8

> **NOTE**
>
9 10
> This module is deprecated since API version 9. You are advised to use [@ohos.reminderAgentManager](js-apis-reminderAgentManager.md) instead.
>
E
ester.zhou 已提交
11
> 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 已提交
12 13


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

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

E
ester.zhou 已提交
20

G
Gloria 已提交
21
## reminderAgent.publishReminder<sup>(deprecated)</sup>
E
ester.zhou 已提交
22

23
```ts
G
Gloria 已提交
24
publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void
25
```
E
ester.zhou 已提交
26

27
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](js-apis-notification.md#notificationrequestenablenotification8).
E
ester.zhou 已提交
28

G
Gloria 已提交
29 30 31 32
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder).

E
ester.zhou 已提交
33
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER
E
ester.zhou 已提交
34

E
ester.zhou 已提交
35 36 37
**System capability**: SystemCapability.Notification.ReminderAgent

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

39 40 41
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
42
  | callback | AsyncCallback\<number\> | Yes| Callback used to return the published reminder's ID.|
E
ester.zhou 已提交
43

E
ester.zhou 已提交
44
**Example**
45
```ts
R
rcy-hw 已提交
46
  let timer = {
R
rcy-hw 已提交
47 48
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
E
ester.zhou 已提交
49
  }
50

R
rcy-hw 已提交
51
  reminderAgent.publishReminder(timer, (err, reminderId) => {
R
rcy-hw 已提交
52
      console.log("callback, reminderId = " + reminderId);
R
rcy-hw 已提交
53
  });
E
uu  
ester.zhou 已提交
54
```
E
ester.zhou 已提交
55 56


G
Gloria 已提交
57
## reminderAgent.publishReminder<sup>(deprecated)</sup>
E
ester.zhou 已提交
58

59
```ts
G
Gloria 已提交
60
publishReminder(reminderReq: ReminderRequest): Promise\<number>
61
```
E
ester.zhou 已提交
62

63
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](js-apis-notification.md#notificationrequestenablenotification8).
E
ester.zhou 已提交
64

G
Gloria 已提交
65 66 67 68
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.publishReminder](js-apis-reminderAgentManager.md#reminderagentmanagerpublishreminder-1).

E
uu  
ester.zhou 已提交
69 70
**Required permissions**: ohos.permission.PUBLISH_AGENT_REMINDER

E
ester.zhou 已提交
71
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
72

E
ester.zhou 已提交
73
**Parameters**
74 75 76
  | Name| Type| Mandatory| Description|
  | -------- | -------- | -------- | -------- |
  | reminderReq | [ReminderRequest](#reminderrequest) | Yes| Reminder to be published.|
E
ester.zhou 已提交
77

E
ester.zhou 已提交
78
**Return value**
79 80
  | Type| Description|
  | -------- | -------- |
81
  | Promise\<number\> | Promise used to return the published reminder's ID.|
E
ester.zhou 已提交
82

E
ester.zhou 已提交
83
**Example**
84
```ts
R
rcy-hw 已提交
85
  let timer = {
R
rcy-hw 已提交
86 87
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
E
ester.zhou 已提交
88
  }
89

R
rcy-hw 已提交
90
  reminderAgent.publishReminder(timer).then((reminderId) => {
R
rcy-hw 已提交
91
      console.log("promise, reminderId = " + reminderId);
R
rcy-hw 已提交
92
  });
E
uu  
ester.zhou 已提交
93
```
E
ester.zhou 已提交
94 95


G
Gloria 已提交
96
## reminderAgent.cancelReminder<sup>(deprecated)</sup>
E
ester.zhou 已提交
97

98
```ts
G
Gloria 已提交
99
cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void
100
```
E
ester.zhou 已提交
101 102 103

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

G
Gloria 已提交
104 105 106 107
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder).

E
ester.zhou 已提交
108
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
109

E
ester.zhou 已提交
110
**Parameters**
E
ester.zhou 已提交
111 112 113

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
114
| reminderId | number | Yes| ID of the reminder to cancel. The value is obtained by calling [publishReminder](#reminderagentpublishreminder).|
G
Gloria 已提交
115
| callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
E
ester.zhou 已提交
116

E
ester.zhou 已提交
117
**Example**
Z
zengyawen 已提交
118

119
```ts
R
rcy-hw 已提交
120 121 122
reminderAgent.cancelReminder(1, (err, data) => {
    console.log("cancelReminder callback");
});
Z
zengyawen 已提交
123 124
```

E
ester.zhou 已提交
125

G
Gloria 已提交
126
## reminderAgent.cancelReminder<sup>(deprecated)</sup>
E
ester.zhou 已提交
127

128
```ts
G
Gloria 已提交
129
cancelReminder(reminderId: number): Promise\<void>
130
```
E
ester.zhou 已提交
131 132 133

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

G
Gloria 已提交
134 135 136 137
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelReminder](js-apis-reminderAgentManager.md#reminderagentmanagercancelreminder-1).

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

E
ester.zhou 已提交
140
**Parameters**
E
ester.zhou 已提交
141 142 143

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
144
| reminderId | number | Yes| ID of the reminder to cancel. The value is obtained by calling [publishReminder](#reminderagentpublishreminder).|
E
ester.zhou 已提交
145

E
ester.zhou 已提交
146
**Return value**
E
ester.zhou 已提交
147 148 149

| Type| Description|
| -------- | -------- |
150
| Promise\<void\> | Promise used to return the result.|
E
ester.zhou 已提交
151

E
ester.zhou 已提交
152
**Example**
Z
zengyawen 已提交
153

154
```ts
R
rcy-hw 已提交
155 156 157
reminderAgent.cancelReminder(1).then(() => {
    console.log("cancelReminder promise");
});
Z
zengyawen 已提交
158 159
```

G
Gloria 已提交
160
## reminderAgent.getValidReminders<sup>(deprecated)</sup>
E
ester.zhou 已提交
161

162
```ts
G
Gloria 已提交
163
getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void
164
```
E
ester.zhou 已提交
165 166 167

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

G
Gloria 已提交
168 169 170 171
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders).

E
ester.zhou 已提交
172
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
173

E
ester.zhou 已提交
174
**Parameters**
E
ester.zhou 已提交
175 176 177

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
G
Gloria 已提交
178
| callback | AsyncCallback\<Array\<[ReminderRequest](#reminderrequest)\>\> | Yes| Callback used to return an array of all valid reminders set by the current application.|
E
ester.zhou 已提交
179

E
ester.zhou 已提交
180
**Example**
Z
zengyawen 已提交
181

182
```ts
Z
zengyawen 已提交
183
reminderAgent.getValidReminders((err, reminders) => {
R
rcy-hw 已提交
184
    console.log("callback, getValidReminders length = " + reminders.length);
Z
zengyawen 已提交
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
    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);
    }
})
```


G
Gloria 已提交
210
## reminderAgent.getValidReminders<sup>(deprecated)</sup>
E
ester.zhou 已提交
211

212
```ts
G
Gloria 已提交
213
getValidReminders(): Promise\<Array\<ReminderRequest>>
214
```
E
ester.zhou 已提交
215 216

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

G
Gloria 已提交
218 219 220 221
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.getValidReminders](js-apis-reminderAgentManager.md#reminderagentmanagergetvalidreminders-1).

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

E
ester.zhou 已提交
224
**Return value**
Z
zengyawen 已提交
225

E
ester.zhou 已提交
226 227
| Type| Description|
| -------- | -------- |
228
| Promise\<Array\<[ReminderRequest](#reminderrequest)\>\> | Promise used to return an array of all valid reminders set by the current application.|
E
ester.zhou 已提交
229

E
ester.zhou 已提交
230
**Example**
Z
zengyawen 已提交
231

232
```ts
E
ester.zhou 已提交
233
reminderAgent.getValidReminders().then((reminders) => {
R
rcy-hw 已提交
234
    console.log("promise, getValidReminders length = " + reminders.length);
Z
zengyawen 已提交
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258
    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 已提交
259

G
Gloria 已提交
260
## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
E
ester.zhou 已提交
261

262
```ts
G
Gloria 已提交
263
cancelAllReminders(callback: AsyncCallback\<void>): void
264
```
E
ester.zhou 已提交
265 266 267

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

G
Gloria 已提交
268 269 270 271
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders).

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

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

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
G
Gloria 已提交
278
| callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
E
ester.zhou 已提交
279

E
ester.zhou 已提交
280
**Example**
Z
zengyawen 已提交
281

282
```ts
E
ester.zhou 已提交
283
reminderAgent.cancelAllReminders((err, data) =>{
R
rcy-hw 已提交
284 285
    console.log("cancelAllReminders callback")
})
Z
zengyawen 已提交
286 287 288
```


G
Gloria 已提交
289
## reminderAgent.cancelAllReminders<sup>(deprecated)</sup>
Z
zengyawen 已提交
290

291
```ts
G
Gloria 已提交
292
cancelAllReminders(): Promise\<void>
293
```
Z
zengyawen 已提交
294

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

G
Gloria 已提交
297 298 299 300
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.cancelAllReminders](js-apis-reminderAgentManager.md#reminderagentmanagercancelallreminders-1).

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

E
ester.zhou 已提交
303
**Return value**
E
ester.zhou 已提交
304 305 306

| Type| Description|
| -------- | -------- |
307
| Promise\<void\> | Promise used to return the result.|
E
ester.zhou 已提交
308

E
ester.zhou 已提交
309
**Example**
Z
zengyawen 已提交
310

311
```ts
Z
zengyawen 已提交
312
reminderAgent.cancelAllReminders().then(() => {
R
rcy-hw 已提交
313 314
    console.log("cancelAllReminders promise")
})
Z
zengyawen 已提交
315 316
```

G
Gloria 已提交
317
## reminderAgent.addNotificationSlot<sup>(deprecated)</sup>
E
ester.zhou 已提交
318

319
```ts
G
Gloria 已提交
320
addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void
321
```
E
ester.zhou 已提交
322

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

G
Gloria 已提交
325 326 327 328
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot).

E
ester.zhou 已提交
329
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
330

E
ester.zhou 已提交
331
**Parameters**
E
ester.zhou 已提交
332 333 334

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
E
uu  
ester.zhou 已提交
335
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot, whose type can be set.|
G
Gloria 已提交
336
| callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
E
ester.zhou 已提交
337

E
ester.zhou 已提交
338
**Example**
Z
zengyawen 已提交
339

340
```ts
R
rcy-hw 已提交
341 342
import notification from '@ohos.notification'

R
rcy-hw 已提交
343
let mySlot = {
R
rcy-hw 已提交
344
    type: notification.SlotType.SOCIAL_COMMUNICATION
Z
zengyawen 已提交
345
}
R
rcy-hw 已提交
346
reminderAgent.addNotificationSlot(mySlot, (err, data) => {
R
rcy-hw 已提交
347 348
    console.log("addNotificationSlot callback");
});
Z
zengyawen 已提交
349 350
```

E
ester.zhou 已提交
351

G
Gloria 已提交
352
## reminderAgent.addNotificationSlot<sup>(deprecated)</sup>
E
ester.zhou 已提交
353

354
```ts
G
Gloria 已提交
355
addNotificationSlot(slot: NotificationSlot): Promise\<void>
356
```
E
ester.zhou 已提交
357

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

G
Gloria 已提交
360 361 362 363
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.addNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanageraddnotificationslot-1).

E
ester.zhou 已提交
364
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
365

E
ester.zhou 已提交
366
**Parameters**
E
ester.zhou 已提交
367 368 369

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

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

| Type| Description|
| -------- | -------- |
376
| Promise\<void\> | Promise used to return the result.|
E
ester.zhou 已提交
377

E
ester.zhou 已提交
378
**Example**
Z
zengyawen 已提交
379

380
```ts
R
rcy-hw 已提交
381 382
import notification from '@ohos.notification'

R
rcy-hw 已提交
383
let mySlot = {
R
rcy-hw 已提交
384
    type: notification.SlotType.SOCIAL_COMMUNICATION
Z
zengyawen 已提交
385
}
R
rcy-hw 已提交
386 387 388
reminderAgent.addNotificationSlot(mySlot).then(() => {
   console.log("addNotificationSlot promise");
});
Z
zengyawen 已提交
389 390
```

E
ester.zhou 已提交
391

G
Gloria 已提交
392
## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
E
ester.zhou 已提交
393

394 395 396
```ts
removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback<void>): void
```
E
ester.zhou 已提交
397 398 399

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

G
Gloria 已提交
400 401 402 403
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot).

E
ester.zhou 已提交
404
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
405

E
ester.zhou 已提交
406
**Parameters**
E
ester.zhou 已提交
407 408 409

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
410
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | Yes| Type of the reminder notification slot to remove.|
G
Gloria 已提交
411
| callback | AsyncCallback\<void\> | Yes| Callback used to return the result.|
E
ester.zhou 已提交
412

E
ester.zhou 已提交
413
**Example**
Z
zengyawen 已提交
414

415
```ts
R
rcy-hw 已提交
416 417
import notification from '@ohos.notification'

R
rcy-hw 已提交
418 419
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
    console.log("removeNotificationSlot callback");
E
ester.zhou 已提交
420
});
Z
zengyawen 已提交
421 422
```

E
ester.zhou 已提交
423

G
Gloria 已提交
424
## reminderAgent.removeNotificationSlot<sup>(deprecated)</sup>
E
ester.zhou 已提交
425

426 427 428
```ts
removeNotificationSlot(slotType: notification.SlotType): Promise<void>
```
E
ester.zhou 已提交
429 430 431

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

G
Gloria 已提交
432 433 434 435
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.removeNotificationSlot](js-apis-reminderAgentManager.md#reminderagentmanagerremovenotificationslot-1).

E
ester.zhou 已提交
436
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
437

E
ester.zhou 已提交
438
**Parameters**
E
ester.zhou 已提交
439 440 441

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

E
ester.zhou 已提交
444
**Return value**
E
ester.zhou 已提交
445 446 447

| Type| Description|
| -------- | -------- |
448
| Promise\<void\> | Promise used to return the result.|
E
ester.zhou 已提交
449

E
ester.zhou 已提交
450
**Example**
Z
zengyawen 已提交
451

452
```ts
R
rcy-hw 已提交
453 454
import notification from '@ohos.notification'

R
rcy-hw 已提交
455 456 457
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
    console.log("removeNotificationSlot promise");
});
Z
zengyawen 已提交
458 459
```

E
ester.zhou 已提交
460

G
Gloria 已提交
461
## ActionButtonType<sup>(deprecated)</sup>
Z
zengyawen 已提交
462 463 464

Enumerates button types.

G
Gloria 已提交
465 466 467 468
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButtonType](js-apis-reminderAgentManager.md#ActionButtonType).

E
ester.zhou 已提交
469
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
470

471
| Name| Value| Description|
E
ester.zhou 已提交
472 473 474 475 476
| -------- | -------- | -------- |
| ACTION_BUTTON_TYPE_CLOSE | 0 | Button for closing the reminder.|
| ACTION_BUTTON_TYPE_SNOOZE | 1 | Button for snoozing the reminder.|


G
Gloria 已提交
477
## ReminderType<sup>(deprecated)</sup>
Z
zengyawen 已提交
478 479 480

Enumerates reminder types.

G
Gloria 已提交
481 482 483 484
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderType](js-apis-reminderAgentManager.md#ReminderType).

E
ester.zhou 已提交
485
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
486

487
| Name| Value| Description|
E
ester.zhou 已提交
488 489 490 491 492 493
| -------- | -------- | -------- |
| REMINDER_TYPE_TIMER | 0 | Countdown reminder.|
| REMINDER_TYPE_CALENDAR | 1 | Calendar reminder.|
| REMINDER_TYPE_ALARM | 2 | Alarm reminder.|


G
Gloria 已提交
494
## ActionButton<sup>(deprecated)</sup>
Z
zengyawen 已提交
495 496 497

Defines a button displayed in the reminder notification.

G
Gloria 已提交
498 499 500 501
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ActionButton](js-apis-reminderAgentManager.md#ActionButton).

E
ester.zhou 已提交
502
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
503 504 505 506 507 508 509

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


G
Gloria 已提交
510
## WantAgent<sup>(deprecated)</sup>
Z
zengyawen 已提交
511 512 513

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

G
Gloria 已提交
514 515 516 517
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.WantAgent](js-apis-reminderAgentManager.md#WantAgent).

E
ester.zhou 已提交
518
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
519 520 521

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
522
| pkgName | string | Yes| Name of the HAP that is redirected to when the reminder notification is clicked.|
E
ester.zhou 已提交
523 524 525
| abilityName | string | Yes| Name of the ability that is redirected to when the reminder notification is clicked.|


G
Gloria 已提交
526
## MaxScreenWantAgent<sup>(deprecated)</sup>
Z
zengyawen 已提交
527

E
ester.zhou 已提交
528
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 已提交
529

G
Gloria 已提交
530 531 532 533
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.MaxScreenWantAgent](js-apis-reminderAgentManager.md#MaxScreenWantAgent).

E
ester.zhou 已提交
534
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
535 536 537

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
538
| pkgName | string | Yes| Name of the HAP that is automatically started when the reminder arrives and the device is not in use.|
E
ester.zhou 已提交
539 540 541
| abilityName | string | Yes| Name of the ability that is automatically started when the reminder arrives and the device is not in use.|


G
Gloria 已提交
542
## ReminderRequest<sup>(deprecated)</sup>
Z
zengyawen 已提交
543 544 545

Defines the reminder to publish.

G
Gloria 已提交
546 547 548 549
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequest](js-apis-reminderAgentManager.md#ReminderRequest).

E
ester.zhou 已提交
550
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
551 552 553

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
554 555 556 557
| reminderType | [ReminderType](#remindertype) | Yes| Type of the reminder.|
| actionButton | [ActionButton](#actionbutton) | No| Button displayed in the reminder notification. (The parameter is optional. Up to two buttons are supported.)|
| wantAgent | [WantAgent](#wantagent) | No| Information about the ability that is redirected to when the notification is clicked.|
| maxScreenWantAgent | [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.|
558 559 560
| ringDuration | number | No| Ringing duration, in seconds. The default value is **1**.|
| snoozeTimes | number | No| Number of reminder snooze times. The default value is **0**.|
| timeInterval | number | No| Reminder snooze interval, in seconds. The default value is **0**.|
E
ester.zhou 已提交
561 562 563 564 565 566 567 568
| 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.|


G
Gloria 已提交
569
## ReminderRequestCalendar<sup>(deprecated)</sup>
Z
zengyawen 已提交
570 571 572 573 574

ReminderRequestCalendar extends ReminderRequest

Defines a reminder for a calendar event.

G
Gloria 已提交
575 576 577 578
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestCalendar](js-apis-reminderAgentManager.md#ReminderRequestCalendar).

E
ester.zhou 已提交
579
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
580 581 582 583

| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| dateTime | [LocalDateTime](#localdatetime) | Yes| Reminder time.|
584 585
| repeatMonths | Array\<number\> | No| Month in which the reminder repeats.|
| repeatDays | Array\<number\> | No| Date on which the reminder repeats.|
E
ester.zhou 已提交
586 587


G
Gloria 已提交
588
## ReminderRequestAlarm<sup>(deprecated)</sup>
Z
zengyawen 已提交
589 590 591

ReminderRequestAlarm extends ReminderRequest

E
ester.zhou 已提交
592 593
Defines a reminder for an alarm.

G
Gloria 已提交
594 595 596 597
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestAlarm](js-apis-reminderAgentManager.md#ReminderRequestAlarm).

E
ester.zhou 已提交
598
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
599

E
ester.zhou 已提交
600
| Name| Type| Mandatory| Description|
E
ester.zhou 已提交
601 602 603
| -------- | -------- | -------- | -------- |
| hour | number | Yes| Hour portion of the reminder time.|
| minute | number | Yes| Minute portion of the reminder time.|
604
| daysOfWeek | Array\<number\> | No| Days of a week when the reminder repeats. The value ranges from 1 to 7, corresponding to the data from Monday to Sunday.|
E
ester.zhou 已提交
605 606


G
Gloria 已提交
607
## ReminderRequestTimer<sup>(deprecated)</sup>
E
ester.zhou 已提交
608 609

ReminderRequestTimer extends ReminderRequest
Z
zengyawen 已提交
610 611 612

Defines a reminder for a scheduled timer.

G
Gloria 已提交
613 614 615 616
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.ReminderRequestTimer](js-apis-reminderAgentManager.md#ReminderRequestTimer).

E
ester.zhou 已提交
617
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
618 619 620 621 622 623

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


G
Gloria 已提交
624
## LocalDateTime<sup>(deprecated)</sup>
Z
zengyawen 已提交
625 626 627

Sets the time information for a calendar reminder.

G
Gloria 已提交
628 629 630 631
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [reminderAgentManager.LocalDateTime](js-apis-reminderAgentManager.md#LocalDateTime).

E
ester.zhou 已提交
632
**System capability**: SystemCapability.Notification.ReminderAgent
E
ester.zhou 已提交
633 634 635 636 637 638 639 640 641

| 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.|