js-apis-reminderAgent.md 18.4 KB
Newer Older
1
# @ohos.reminderAgent (后台代理提醒)
S
s00567680 已提交
2

廖康康 已提交
3
本模块提供后台代理提醒的能力。
廖康康 已提交
4

廖康康 已提交
5
开发应用时,开发者可以调用后台提醒发布的接口创建定时提醒,包括倒计时、日历、闹钟三种提醒类型。使用后台代理提醒能力后,应用可以被冻结或退出,计时和弹出提醒的功能将被后台系统服务代理。
廖康康 已提交
6

廖康康 已提交
7 8 9 10
> **说明:**
>
> 从API Version 9 开始,该接口不再维护,推荐使用新接口[@ohos.reminderAgentManager (后台代理提醒)](js-apis-reminderAgentManager.md)
>
S
s00567680 已提交
11 12 13 14 15
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。


## 导入模块

Z
zhangxin_T 已提交
16
```js
S
s00567680 已提交
17 18 19 20
import reminderAgent from'@ohos.reminderAgent';
```


廖康康 已提交
21
## reminderAgent.publishReminder
S
s00567680 已提交
22 23 24

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

廖康康 已提交
25
发布一个后台代理提醒,使用callback方式实现异步调用,该方法需要申请通知弹窗[Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8)后才能调用。
廖康康 已提交
26

R
rcy-hw 已提交
27 28
**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER

R
RayShih 已提交
29
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
30

R
RayShih 已提交
31
**参数**
X
xuezhongzhu 已提交
32 33

  | 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
34
  | -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
35 36
  | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的提醒实例。 |
  | callback | AsyncCallback<number> | 是 | 异步回调,返回当前发布的提醒的reminderId。 |
S
s00567680 已提交
37

R
RayShih 已提交
38
**示例**
R
rcy-hw 已提交
39
```js
R
rcy-hw 已提交
40
  let timer = {
R
rcy-hw 已提交
41 42
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
S
s00567680 已提交
43
  }
R
rcy-hw 已提交
44
  reminderAgent.publishReminder(timer, (err, reminderId) => {
R
rcy-hw 已提交
45
      console.log("callback, reminderId = " + reminderId);
R
rcy-hw 已提交
46 47
  });
```
S
s00567680 已提交
48 49


廖康康 已提交
50
## reminderAgent.publishReminder
S
s00567680 已提交
51 52 53

publishReminder(reminderReq: ReminderRequest): Promise<number>

廖康康 已提交
54
发布一个后台代理提醒,使用Promise方式实现异步调用,该方法需要申请通知弹窗[Notification.requestEnableNotification](js-apis-notification.md#notificationrequestenablenotification8)后才能调用。
廖康康 已提交
55

X
xuzhihao 已提交
56 57
**需要权限**: ohos.permission.PUBLISH_AGENT_REMINDER

R
RayShih 已提交
58
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
59

R
RayShih 已提交
60
**参数**
X
xuezhongzhu 已提交
61
  | 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
62
  | -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
63
  | reminderReq | [ReminderRequest](#reminderrequest) | 是 | 需要发布的提醒实例。 |
S
s00567680 已提交
64

R
RayShih 已提交
65
**返回值**
X
xuezhongzhu 已提交
66
  | 类型 | 说明 |
S
s00567680 已提交
67
  | -------- | -------- |
X
xuezhongzhu 已提交
68
  | Promise<number> | 返回提醒的reminderId。 |
S
s00567680 已提交
69

R
RayShih 已提交
70
**示例**
R
rcy-hw 已提交
71
```js
R
rcy-hw 已提交
72
  let timer = {
R
rcy-hw 已提交
73 74
      reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
      triggerTimeInSeconds: 10
S
s00567680 已提交
75
  }
R
rcy-hw 已提交
76
  reminderAgent.publishReminder(timer).then((reminderId) => {
R
rcy-hw 已提交
77
      console.log("promise, reminderId = " + reminderId);
R
rcy-hw 已提交
78 79
  });
```
S
s00567680 已提交
80 81


廖康康 已提交
82
## reminderAgent.cancelReminder
S
s00567680 已提交
83 84 85 86 87

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

取消指定id的提醒,使用callback方式实现异步调用。

R
RayShih 已提交
88
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
89

R
RayShih 已提交
90
**参数**
S
s00567680 已提交
91

X
xuezhongzhu 已提交
92
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
93
| -------- | -------- | -------- | -------- |
Z
zhangxin_T 已提交
94
| reminderId | number | 是 | 目标reminder的id号,[publishReminder](#reminderagentpublishreminder)方法调用成功后获得。 |
X
xuezhongzhu 已提交
95
| callback | AsyncCallback<void> | 是 | 异步回调。 |
S
s00567680 已提交
96

R
RayShih 已提交
97
**示例**
S
s00567680 已提交
98

R
rcy-hw 已提交
99
```js
R
rcy-hw 已提交
100 101 102
reminderAgent.cancelReminder(1, (err, data) => {
    console.log("cancelReminder callback");
});
S
s00567680 已提交
103 104 105
```


廖康康 已提交
106
## reminderAgent.cancelReminder
S
s00567680 已提交
107 108 109 110 111

cancelReminder(reminderId: number): Promise<void>

取消指定id的提醒,使用Promise方式实现异步调用。

R
RayShih 已提交
112
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
113

R
RayShih 已提交
114
**参数**
S
s00567680 已提交
115

X
xuezhongzhu 已提交
116
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
117
| -------- | -------- | -------- | -------- |
Z
zhangxin_T 已提交
118
| reminderId | number | 是 | 目标reminder的id号,[publishReminder](#reminderagentpublishreminder)方法调用成功后获得。 |
S
s00567680 已提交
119

R
RayShih 已提交
120
**返回值**
S
s00567680 已提交
121

X
xuezhongzhu 已提交
122
| 类型 | 说明 |
S
s00567680 已提交
123
| -------- | -------- |
X
xuezhongzhu 已提交
124
| Promise<void> | Promise类型异步回调。 |
S
s00567680 已提交
125

R
RayShih 已提交
126
**示例**
S
s00567680 已提交
127

R
rcy-hw 已提交
128
```js
R
rcy-hw 已提交
129 130 131
reminderAgent.cancelReminder(1).then(() => {
    console.log("cancelReminder promise");
});
S
s00567680 已提交
132 133 134
```


廖康康 已提交
135
## reminderAgent.getValidReminders
S
s00567680 已提交
136 137 138 139 140

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

获取当前应用已设置的所有有效(未过期)的提醒,使用callback方式实现异步调用。

R
RayShih 已提交
141
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
142

R
RayShih 已提交
143
**参数**
S
s00567680 已提交
144

X
xuezhongzhu 已提交
145
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
146
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
147
| callback | AsyncCallback<Array<[ReminderRequest](#reminderrequest)>> | 是 | 异步回调,返回当前应用已设置的所有有效(未过期)的提醒。 |
S
s00567680 已提交
148

R
RayShih 已提交
149
**示例**
S
s00567680 已提交
150

R
rcy-hw 已提交
151
```js
S
s00567680 已提交
152
reminderAgent.getValidReminders((err, reminders) => {
R
rcy-hw 已提交
153
    console.log("callback, getValidReminders length = " + reminders.length);
S
s00567680 已提交
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
    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);
    }
})
```


廖康康 已提交
179
## reminderAgent.getValidReminders
S
s00567680 已提交
180 181 182 183 184

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

获取当前应用已设置的所有有效(未过期)的提醒,使用Promise方式实现异步调用。

R
RayShih 已提交
185
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
186

R
RayShih 已提交
187
**返回值**
S
s00567680 已提交
188

X
xuezhongzhu 已提交
189
| 类型 | 说明 |
S
s00567680 已提交
190
| -------- | -------- |
X
xuezhongzhu 已提交
191
| Promise&lt;Array&lt;[ReminderRequest](#reminderrequest)&gt;&gt; | 返回当前应用已设置的所有有效(未过期)的提醒。 |
S
s00567680 已提交
192

R
RayShih 已提交
193
**示例**
S
s00567680 已提交
194

R
rcy-hw 已提交
195
```js
R
rcy-hw 已提交
196
reminderAgent.getValidReminders().then((reminders) => {
R
rcy-hw 已提交
197
    console.log("promise, getValidReminders length = " + reminders.length);
S
s00567680 已提交
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
    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);
    }
})
```


廖康康 已提交
223
## reminderAgent.cancelAllReminders
S
s00567680 已提交
224 225 226 227 228

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

取消当前应用所有的提醒,使用callback方式实现异步调用。

R
RayShih 已提交
229
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
230

R
RayShih 已提交
231
**参数**
S
s00567680 已提交
232

X
xuezhongzhu 已提交
233
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
234
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
235
| callback | AsyncCallback&lt;void&gt; | 是 | 异步回调。 |
S
s00567680 已提交
236

R
RayShih 已提交
237
**示例**
S
s00567680 已提交
238

R
rcy-hw 已提交
239
```js
R
rcy-hw 已提交
240
reminderAgent.cancelAllReminders((err, data) =>{
R
rcy-hw 已提交
241 242
    console.log("cancelAllReminders callback")
})
S
s00567680 已提交
243 244 245
```


廖康康 已提交
246
## reminderAgent.cancelAllReminders
S
s00567680 已提交
247 248 249 250 251

cancelAllReminders(): Promise&lt;void&gt;

取消当前应用所有的提醒,使用Promise方式实现异步调用。

R
RayShih 已提交
252
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
253

R
RayShih 已提交
254
**返回值**
S
s00567680 已提交
255

X
xuezhongzhu 已提交
256
| 类型 | 说明 |
S
s00567680 已提交
257
| -------- | -------- |
X
xuezhongzhu 已提交
258
| Promise&lt;void&gt; | Promise类型异步回调。 |
S
s00567680 已提交
259

R
RayShih 已提交
260
**示例**
S
s00567680 已提交
261

R
rcy-hw 已提交
262
```js
S
s00567680 已提交
263
reminderAgent.cancelAllReminders().then(() => {
R
rcy-hw 已提交
264 265
    console.log("cancelAllReminders promise")
})
S
s00567680 已提交
266 267 268
```


廖康康 已提交
269
## reminderAgent.addNotificationSlot
S
s00567680 已提交
270 271 272 273 274

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

添加一个NotificationSlot,使用callback方式实现异步调用。

R
RayShih 已提交
275
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
276

R
RayShih 已提交
277
**参数**
S
s00567680 已提交
278

X
xuezhongzhu 已提交
279
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
280
| -------- | -------- | -------- | -------- |
R
rcy-hw 已提交
281
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例,仅支持设置其type属性。 |
X
xuezhongzhu 已提交
282
| callback | AsyncCallback&lt;void&gt; | 是 | 异步回调。 |
S
s00567680 已提交
283

R
RayShih 已提交
284
**示例**
S
s00567680 已提交
285

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

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


廖康康 已提交
298
## reminderAgent.addNotificationSlot
S
s00567680 已提交
299 300 301 302 303

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

添加一个NotificationSlot,使用Promise方式实现异步调用。

R
RayShih 已提交
304
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
305

R
RayShih 已提交
306
**参数**
S
s00567680 已提交
307

X
xuezhongzhu 已提交
308
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
309
| -------- | -------- | -------- | -------- |
R
rcy-hw 已提交
310 311
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例,仅支持设置其type属性。 |

R
RayShih 已提交
312
**返回值**
S
s00567680 已提交
313

X
xuezhongzhu 已提交
314
| 类型 | 说明 |
S
s00567680 已提交
315
| -------- | -------- |
X
xuezhongzhu 已提交
316
| Promise&lt;void&gt; | Promise类型异步回调。 |
S
s00567680 已提交
317

R
RayShih 已提交
318
**示例**
S
s00567680 已提交
319

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

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


廖康康 已提交
332
## reminderAgent.removeNotificationSlot
S
s00567680 已提交
333 334 335 336 337

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

删除目标NotificationSlot,使用callback方式实现异步调用。

R
RayShih 已提交
338
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
339

R
RayShih 已提交
340
**参数**
S
s00567680 已提交
341

X
xuezhongzhu 已提交
342
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
343
| -------- | -------- | -------- | -------- |
R
rcy-hw 已提交
344
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification&nbsp;slot的类型。 |
X
xuezhongzhu 已提交
345
| callback | AsyncCallback&lt;void&gt; | 是 | 异步回调。 |
S
s00567680 已提交
346

R
RayShih 已提交
347
**示例**
S
s00567680 已提交
348

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

R
rcy-hw 已提交
352 353
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
    console.log("removeNotificationSlot callback");
S
s00567680 已提交
354 355 356 357
});
```


廖康康 已提交
358
## reminderAgent.removeNotificationSlot
S
s00567680 已提交
359 360 361 362 363

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

删除目标NotificationSlot,使用Promise方式实现异步调用。

R
RayShih 已提交
364
**系统能力**: SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
365

R
RayShih 已提交
366
**参数**
S
s00567680 已提交
367

X
xuezhongzhu 已提交
368
| 参数名 | 类型 | 必填 | 说明 |
S
s00567680 已提交
369
| -------- | -------- | -------- | -------- |
R
rcy-hw 已提交
370
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 是 | 目标notification&nbsp;slot的类型。 |
S
s00567680 已提交
371

R
RayShih 已提交
372
**返回值**
S
s00567680 已提交
373

X
xuezhongzhu 已提交
374
| 类型 | 说明 |
S
s00567680 已提交
375
| -------- | -------- |
X
xuezhongzhu 已提交
376
| Promise&lt;void&gt; | Promise类型异步回调。 |
S
s00567680 已提交
377

R
RayShih 已提交
378
**示例**
S
s00567680 已提交
379

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

R
rcy-hw 已提交
383 384 385
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
    console.log("removeNotificationSlot promise");
});
S
s00567680 已提交
386 387 388
```


廖康康 已提交
389
## ActionButtonType
S
s00567680 已提交
390 391 392

按钮的类型。

R
RayShih 已提交
393
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
394

廖康康 已提交
395
| 名称 | 值 | 说明 |
S
s00567680 已提交
396
| -------- | -------- | -------- |
X
xuezhongzhu 已提交
397 398
| ACTION_BUTTON_TYPE_CLOSE | 0 | 表示关闭提醒的按钮。 |
| ACTION_BUTTON_TYPE_SNOOZE | 1 | 表示延迟提醒的按钮。 |
S
s00567680 已提交
399 400


廖康康 已提交
401
## ReminderType
S
s00567680 已提交
402 403 404

提醒的类型。

R
RayShih 已提交
405
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
406

廖康康 已提交
407
| 名称 | 值 | 说明 |
S
s00567680 已提交
408
| -------- | -------- | -------- |
X
xuezhongzhu 已提交
409 410 411
| REMINDER_TYPE_TIMER | 0 | 表示提醒类型:倒计时。 |
| REMINDER_TYPE_CALENDAR | 1 | 表示提醒类型:日历。 |
| REMINDER_TYPE_ALARM | 2 | 表示提醒类型:闹钟。 |
S
s00567680 已提交
412 413


廖康康 已提交
414
## ActionButton
S
s00567680 已提交
415 416 417

用于设置弹出的提醒通知信息上显示的按钮类型和标题。

R
RayShih 已提交
418
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
419

廖康康 已提交
420
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
421
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
422 423
| title | string | 是 | 按钮显示的标题。 |
| type | [ActionButtonType](#actionbuttontype) | 是 | 按钮的类型。 |
S
s00567680 已提交
424 425


廖康康 已提交
426
## WantAgent
S
s00567680 已提交
427 428 429

点击提醒通知后跳转的目标ability信息。

R
RayShih 已提交
430
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
431

廖康康 已提交
432
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
433
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
434 435
| pkgName | string | 是 | 指明点击提醒通知栏后跳转的目标hap包名。 |
| abilityName | string | 是 | 指明点击提醒通知栏后跳转的目标ability名称。 |
S
s00567680 已提交
436 437


廖康康 已提交
438
## MaxScreenWantAgent
S
s00567680 已提交
439

廖康康 已提交
440
全屏显示提醒到达时自动拉起的目标ability信息,该接口预留。
S
s00567680 已提交
441

R
RayShih 已提交
442
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
443

廖康康 已提交
444
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
445
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
446 447
| pkgName | string | 是 | 指明提醒到达时自动拉起的目标hap包名(如果设备在使用中,则只弹出通知横幅框)。 |
| abilityName | string | 是 | 指明提醒到达时自动拉起的目标ability名(如果设备在使用中,则只弹出通知横幅框)。 |
S
s00567680 已提交
448 449


廖康康 已提交
450
## ReminderRequest
S
s00567680 已提交
451 452 453

提醒实例对象,用于设置提醒类型、响铃时长等具体信息。

R
RayShih 已提交
454
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
455

廖康康 已提交
456
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
457
| -------- | -------- | -------- | -------- |
Z
zhangxin_T 已提交
458
| reminderType | [ReminderType](#remindertype) | 是 | 指明提醒类型。 |
Z
zhangxin_T 已提交
459 460 461
| actionButton | [ActionButton](#actionbutton) | 否 | 弹出的提醒通知栏中显示的按钮(参数可选,支持0/1/2个按钮)。 |
| wantAgent | [WantAgent](#wantagent) | 否 | 点击通知后需要跳转的目标ability信息。 |
| maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | 否 | 提醒到达时跳转的目标包。如果设备正在使用中,则弹出一个通知框。 |
X
xuezhongzhu 已提交
462 463 464 465 466 467 468 469
| ringDuration | number | 否 | 指明响铃时长。 |
| snoozeTimes | number | 否 | 指明延迟提醒次数。 |
| timeInterval | number | 否 | 执行延迟提醒间隔。 |
| title | string | 否 | 指明提醒标题。 |
| content | string | 否 | 指明提醒内容。 |
| expiredContent | string | 否 | 指明提醒过期后需要显示的内容。 |
| snoozeContent | string | 否 | 指明延迟提醒时需要显示的内容。 |
| notificationId | number | 否 | 指明提醒使用的通知的id号,相同id号的提醒会覆盖。 |
R
rcy-hw 已提交
470
| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 否 | 指明提醒的slot类型。 |
S
s00567680 已提交
471 472


廖康康 已提交
473
## ReminderRequestCalendar
S
s00567680 已提交
474 475 476 477 478

ReminderRequestCalendar extends ReminderRequest

日历实例对象,用于设置提醒的时间。

R
RayShih 已提交
479
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
480

廖康康 已提交
481
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
482
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
483 484 485
| dateTime | [LocalDateTime](#localdatetime) | 是 | 指明提醒的目标时间。 |
| repeatMonths | Array&lt;number&gt; | 否 | 指明重复提醒的月份。 |
| repeatDays | Array&lt;number&gt; | 否 | 指明重复提醒的日期。 |
S
s00567680 已提交
486 487


廖康康 已提交
488
## ReminderRequestAlarm
S
s00567680 已提交
489 490 491 492 493

ReminderRequestAlarm extends ReminderRequest

闹钟实例对象,用于设置提醒的时间。

R
RayShih 已提交
494
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
495

廖康康 已提交
496
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
497
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
498 499
| hour | number | 是 | 指明提醒的目标时刻。 |
| minute | number | 是 | 指明提醒的目标分钟。 |
廖康康 已提交
500
| daysOfWeek | Array&lt;number&gt; | 否 | 指明每周哪几天需要重复提醒。范围为周一到周末,对应数字为1到7。 |
S
s00567680 已提交
501 502


廖康康 已提交
503
## ReminderRequestTimer
S
s00567680 已提交
504 505 506 507 508

ReminderRequestTimer extends ReminderRequest

倒计时实例对象,用于设置提醒的时间。

R
RayShih 已提交
509
**系统能力**:SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
510

廖康康 已提交
511
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
512
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
513
| triggerTimeInSeconds | number | 是 | 指明倒计时的秒数。 |
S
s00567680 已提交
514 515


廖康康 已提交
516
## LocalDateTime
S
s00567680 已提交
517 518 519

用于日历类提醒设置时指定时间信息。

R
RayShih 已提交
520
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.ReminderAgent
X
xuezhongzhu 已提交
521

廖康康 已提交
522
| 名称 | 类型 | 必填 | 说明 |
S
s00567680 已提交
523
| -------- | -------- | -------- | -------- |
X
xuezhongzhu 已提交
524 525 526 527 528 529
| year | number | 是 | 年 |
| month | number | 是 | 月 |
| day | number | 是 | 日 |
| hour | number | 是 | 时 |
| minute | number | 是 | 分 |
| second | number | 否 | 秒 |