提交 f8b7e1c1 编写于 作者: 廖康康

提醒代理文档更新

Signed-off-by: N廖康康 <liaokangkang@huawei.com>
上级 e69c046e
......@@ -7,7 +7,7 @@
## 接口说明
reminderAgent:封装了发布、取消提醒类通知的方法
reminderAgent:封装了发布、取消提醒类通知的方法
具体后台提醒相关功能接口请见[后台代理提醒](../reference/apis/js-apis-reminderAgent.md)
......@@ -26,14 +26,14 @@ reminderAgent:封装了发布、取消提醒类通知的方法
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
>
> 1. 应用需要配置权限:ohos.permission.PUBLISH_AGENT_REMINDER
> 1. 应用需要配置权限:ohos.permission.PUBLISH_AGENT_REMINDER
>
> 2. 应用需要申请通知弹窗:[Notification.requestEnableNotification](../reference/apis/js-apis-notification.md#notificationrequestenablenotification8)
> 2. 应用需要申请通知弹窗:[Notification.requestEnableNotification](../reference/apis/js-apis-notification.md#notificationrequestenablenotification8)
发布一个10秒倒计时提醒
1. 定义一个提醒代理。
1. 定义一个倒计时实例
```
倒计时实例定义:
```js
import reminderAgent from '@ohos.reminderAgent';
import notification from '@ohos.notification';
export default {
......@@ -66,30 +66,13 @@ reminderAgent:封装了发布、取消提醒类通知的方法
}
```
2. 发布提醒
```
startTimer() {
reminderAgent.publishReminder(this.timer, (err, reminderId) =>{
this.printInfo(JSON.stringify(err));
this.printInfo("reminderId:" + reminderId);
});
}
```
日历实例定义:
HML页面:
```
<div class="container">
<button type="text" value="publishReminder" onclick="startTimer"></button>
</div>
```
日历实例定义:
```
// JS工程写法:
// calendar: {
// eTS工程写法:
let calendar : reminderAgent.ReminderRequestCalendar = {
```js
// JS工程写法:
// calendar: {
// eTS工程写法:
let calendar : reminderAgent.ReminderRequestCalendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime: {
year: 2050,
......@@ -128,16 +111,16 @@ let calendar : reminderAgent.ReminderRequestCalendar = {
snoozeContent: "remind later",
notificationId: 100,
slotType: notification.SlotType.SOCIAL_COMMUNICATION
}
```
}
```
闹钟实例定义:
闹钟实例定义:
```
// JS工程写法:
// alarm: {
// eTS工程写法:
let alarm : reminderAgent.ReminderRequestAlarm = {
```js
// JS工程写法:
// alarm: {
// eTS工程写法:
let alarm : reminderAgent.ReminderRequestAlarm = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11,
minute: 14,
......@@ -169,9 +152,25 @@ let alarm : reminderAgent.ReminderRequestAlarm = {
snoozeContent: "remind later",
notificationId: 100,
slotType: notification.SlotType.SOCIAL_COMMUNICATION
}
```
}
```
2. 发布倒计时提醒。
```js
startTimer() {
reminderAgent.publishReminder(this.timer, (err, reminderId) =>{
this.printInfo(JSON.stringify(err));
this.printInfo("reminderId:" + reminderId);
});
}
```
HML页面:
```html
<div class="container">
<button type="text" value="publishReminder" onclick="startTimer"></button>
</div>
```
## 相关实例
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册