Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d87e6b2c
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d87e6b2c
编写于
4月 15, 2022
作者:
R
rcy-hw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update api and user guide
Signed-off-by:
N
rcy-hw
<
renchunyang@huawei.com
>
上级
d66c8408
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
108 addition
and
140 deletion
+108
-140
en/application-dev/background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md
...led-reminder/background-agent-scheduled-reminder-guide.md
+14
-5
en/application-dev/reference/apis/js-apis-reminderAgent.md
en/application-dev/reference/apis/js-apis-reminderAgent.md
+35
-59
zh-cn/application-dev/background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md
...led-reminder/background-agent-scheduled-reminder-guide.md
+14
-4
zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
...n/application-dev/reference/apis/js-apis-reminderAgent.md
+45
-72
未找到文件。
en/application-dev/background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md
浏览文件 @
d87e6b2c
...
@@ -553,7 +553,10 @@ Publish a 10-second countdown reminder.
...
@@ -553,7 +553,10 @@ Publish a 10-second countdown reminder.
import reminderAgent from '@ohos.reminderAgent';
import reminderAgent from '@ohos.reminderAgent';
import notification from '@ohos.notification';
import notification from '@ohos.notification';
export default {
export default {
timer: {
// In JS Project:
// timer: {
// In eTS Project:
let timer : reminderAgent.ReminderRequestTimer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10,
triggerTimeInSeconds: 10,
actionButton: [
actionButton: [
...
@@ -602,7 +605,10 @@ Publish a 10-second countdown reminder.
...
@@ -602,7 +605,10 @@ Publish a 10-second countdown reminder.
Sample code for defining a calendar reminder instance:
Sample code for defining a calendar reminder instance:
```
```
calendar: {
// In JS Project:
// calendar: {
// In eTS Project:
let calendar : reminderAgent.ReminderRequestCalendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime: {
dateTime: {
year: 2050,
year: 2050,
...
@@ -647,7 +653,10 @@ calendar: {
...
@@ -647,7 +653,10 @@ calendar: {
Sample code for defining an alarm reminder instance:
Sample code for defining an alarm reminder instance:
```
```
alarm: {
// In JS Project:
// alarm: {
// In eTS Project:
let alarm : reminderAgent.ReminderRequestAlarm = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11,
hour: 11,
minute: 14,
minute: 14,
...
...
en/application-dev/reference/apis/js-apis-reminderAgent.md
浏览文件 @
d87e6b2c
...
@@ -30,18 +30,13 @@ Publishes an agent-powered reminder. This API uses an asynchronous callback to r
...
@@ -30,18 +30,13 @@ Publishes an agent-powered reminder. This API uses an asynchronous callback to r
**Example**
**Example**
```
```
export default {
let timer : reminderAgent.ReminderRequestTimer = {
data: {
timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
triggerTimeInSeconds: 10
}
}
},
reminderAgent.publishReminder(timer, (err, reminderId) => {
startTimer() {
console.log("reminderId = " + reminderId);
reminderAgent.publishReminder(timer, (err, reminderId) => { console.log("reminderId = " + reminderId);
});
});
}
}
```
```
...
@@ -65,19 +60,13 @@ Publishes an agent-powered reminder. This API uses a promise callback to return
...
@@ -65,19 +60,13 @@ Publishes an agent-powered reminder. This API uses a promise callback to return
**Example**
**Example**
```
```
export default {
let timer : reminderAgent.ReminderRequestTimer = {
data:
{timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
triggerTimeInSeconds: 10
}
}
},
reminderAgent.publishReminder(timer).then((reminderId) => {
startTimer() {
reminderAgent.publishReminder(this.timer).then((reminderId) => {
console.log("reminderId = " + reminderId);
console.log("reminderId = " + reminderId);
});
});
}
}
```
```
...
@@ -99,13 +88,9 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
...
@@ -99,13 +88,9 @@ Cancels the reminder with the specified ID. This API uses an asynchronous callba
**Example**
**Example**
```
```
export default {
reminderAgent.cancelReminder(1, (err, data) => {
cancel() {
console.log("cancelReminder callback");
reminderAgent.cancelReminder(1, (err, data) => {
});
console.log("do next");
});
}
}
```
```
...
@@ -132,13 +117,9 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
...
@@ -132,13 +117,9 @@ Cancels the reminder with the specified ID. This API uses a promise to return th
**Example**
**Example**
```
```
export default {
reminderAgent.cancelReminder(1).then(() => {
cancel() {
console.log("cancelReminder promise");
reminderAgent.cancelReminder(1).then(() => {
});
console.log("do next");
});
}
}
```
```
...
@@ -160,6 +141,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
...
@@ -160,6 +141,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
```
```
reminderAgent.getValidReminders((err, reminders) => {
reminderAgent.getValidReminders((err, reminders) => {
console.log("getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) {
for (let i = 0; i < reminders.length; i++) {
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
...
@@ -203,6 +185,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
...
@@ -203,6 +185,7 @@ Obtains all valid (not yet expired) reminders set by the current application. Th
```
```
reminderAgent.getValidReminders().then((reminders) => {
reminderAgent.getValidReminders().then((reminders) => {
console.log("getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) {
for (let i = 0; i < reminders.length; i++) {
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
...
@@ -246,7 +229,8 @@ Cancels all reminders set by the current application. This API uses an asynchron
...
@@ -246,7 +229,8 @@ Cancels all reminders set by the current application. This API uses an asynchron
```
```
reminderAgent.cancelAllReminders((err, data) =>{
reminderAgent.cancelAllReminders((err, data) =>{
console.log("do next")})
console.log("cancelAllReminders callback")
})
```
```
...
@@ -268,7 +252,8 @@ Cancels all reminders set by the current application. This API uses a promise to
...
@@ -268,7 +252,8 @@ Cancels all reminders set by the current application. This API uses a promise to
```
```
reminderAgent.cancelAllReminders().then(() => {
reminderAgent.cancelAllReminders().then(() => {
console.log("do next")})
console.log("cancelAllReminders promise")
})
```
```
...
@@ -290,16 +275,13 @@ Adds a reminder notification slot. This API uses an asynchronous callback to ret
...
@@ -290,16 +275,13 @@ Adds a reminder notification slot. This API uses an asynchronous callback to ret
**Example**
**Example**
```
```
export default { data: {
mySlot: {
mySlot: {
type: 3,
type: 3,
sound: "/sdcard/music2.mp3"
sound: "/sdcard/music2.mp3"
} },
addSlot() {
reminderAgent.addNotificationSlot(this.mySlot, (err, data) => {
console.log("do next");
});
}
}
}
reminderAgent.addNotificationSlot(this.mySlot, (err, data) => {
console.log("addNotificationSlot callback");
});
```
```
...
@@ -357,12 +339,9 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
...
@@ -357,12 +339,9 @@ Removes a notification slot of a specified type. This API uses an asynchronous c
**Example**
**Example**
```
```
export default {
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
removeSlot() {reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
console.log("removeNotificationSlot callback");
console.log("do next");
});
});
}
}
```
```
...
@@ -389,12 +368,9 @@ Removes a notification slot of a specified type. This API uses a promise to retu
...
@@ -389,12 +368,9 @@ Removes a notification slot of a specified type. This API uses a promise to retu
**Example**
**Example**
```
```
export default {
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
removeSlot() { reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
console.log("removeNotificationSlot promise");
console.log("do next");
});
});
}
}
```
```
...
...
zh-cn/application-dev/background-agent-scheduled-reminder/background-agent-scheduled-reminder-guide.md
浏览文件 @
d87e6b2c
...
@@ -139,8 +139,12 @@ interface LocalDateTime:时间信息实例
...
@@ -139,8 +139,12 @@ interface LocalDateTime:时间信息实例
1.
定义一个倒计时实例
1.
定义一个倒计时实例
```
```
import reminderAgent from '@ohos.reminderAgent';
import reminderAgent from '@ohos.reminderAgent';
import notification from '@ohos.notification';export default {
import notification from '@ohos.notification';
timer: {
export default {
// JS工程写法:
// timer: {
// eTS工程写法:
let timer : reminderAgent.ReminderRequestTimer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10,
triggerTimeInSeconds: 10,
actionButton: [
actionButton: [
...
@@ -186,7 +190,10 @@ interface LocalDateTime:时间信息实例
...
@@ -186,7 +190,10 @@ interface LocalDateTime:时间信息实例
日历实例定义:
日历实例定义:
```
```
calendar: {
// JS工程写法:
// calendar: {
// eTS工程写法:
let calendar : reminderAgent.ReminderRequestCalendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime: {
dateTime: {
year: 2050,
year: 2050,
...
@@ -231,7 +238,10 @@ calendar: {
...
@@ -231,7 +238,10 @@ calendar: {
闹钟实例定义:
闹钟实例定义:
```
```
alarm: {
// JS工程写法:
// alarm: {
// eTS工程写法:
let alarm : reminderAgent.ReminderRequestAlarm = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11,
hour: 11,
minute: 14,
minute: 14,
...
...
zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
浏览文件 @
d87e6b2c
...
@@ -29,20 +29,15 @@ publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number&
...
@@ -29,20 +29,15 @@ publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback<number&
| callback | AsyncCallback
<
number
>
| 是 | 异步回调,返回当前发布的提醒的reminderId。 |
| callback | AsyncCallback
<
number
>
| 是 | 异步回调,返回当前发布的提醒的reminderId。 |
**示例**
:
**示例**
:
```
```
export default {
let timer : reminderAgent.ReminderRequestTimer = {
data: {
timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
triggerTimeInSeconds: 10
}
}
},
reminderAgent.publishReminder(timer, (err, reminderId) => {
startTimer() {
console.log("reminderId = " + reminderId);
reminderAgent.publishReminder(timer, (err, reminderId) => { console.log("reminderId = " + reminderId);
});
});
}
```
}
```
## reminderAgent.publishReminder
## reminderAgent.publishReminder
...
@@ -64,21 +59,15 @@ publishReminder(reminderReq: ReminderRequest): Promise<number>
...
@@ -64,21 +59,15 @@ publishReminder(reminderReq: ReminderRequest): Promise<number>
| Promise
<
number
>
| 返回提醒的reminderId。 |
| Promise
<
number
>
| 返回提醒的reminderId。 |
**示例**
:
**示例**
:
```
```
export default {
let timer : reminderAgent.ReminderRequestTimer = {
data:
{timer: {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 3
triggerTimeInSeconds: 10
}
}
},
reminderAgent.publishReminder(timer).then((reminderId) => {
startTimer() {
reminderAgent.publishReminder(this.timer).then((reminderId) => {
console.log("reminderId = " + reminderId);
console.log("reminderId = " + reminderId);
});
});
}
```
}
```
## reminderAgent.cancelReminder
## reminderAgent.cancelReminder
...
@@ -99,13 +88,9 @@ cancelReminder(reminderId: number, callback: AsyncCallback<void>): void
...
@@ -99,13 +88,9 @@ cancelReminder(reminderId: number, callback: AsyncCallback<void>): void
**示例**
:
**示例**
:
```
```
export default {
reminderAgent.cancelReminder(1, (err, data) => {
cancel() {
console.log("cancelReminder callback");
reminderAgent.cancelReminder(1, (err, data) => {
});
console.log("do next");
});
}
}
```
```
...
@@ -132,13 +117,9 @@ cancelReminder(reminderId: number): Promise<void>
...
@@ -132,13 +117,9 @@ cancelReminder(reminderId: number): Promise<void>
**示例**
:
**示例**
:
```
```
export default {
reminderAgent.cancelReminder(1).then(() => {
cancel() {
console.log("cancelReminder promise");
reminderAgent.cancelReminder(1).then(() => {
});
console.log("do next");
});
}
}
```
```
...
@@ -160,6 +141,7 @@ getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>):
...
@@ -160,6 +141,7 @@ getValidReminders(callback: AsyncCallback<Array<ReminderRequest>>):
```
```
reminderAgent.getValidReminders((err, reminders) => {
reminderAgent.getValidReminders((err, reminders) => {
console.log("getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) {
for (let i = 0; i < reminders.length; i++) {
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
...
@@ -203,6 +185,7 @@ getValidReminders(): Promise<Array<ReminderRequest>>
...
@@ -203,6 +185,7 @@ getValidReminders(): Promise<Array<ReminderRequest>>
```
```
reminderAgent.getValidReminders().then((reminders) => {
reminderAgent.getValidReminders().then((reminders) => {
console.log("getValidReminders length = " + reminders.length);
for (let i = 0; i < reminders.length; i++) {
for (let i = 0; i < reminders.length; i++) {
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders = " + reminders[i]);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
console.log("getValidReminders, reminderType = " + reminders[i].reminderType);
...
@@ -246,7 +229,8 @@ cancelAllReminders(callback: AsyncCallback<void>): void
...
@@ -246,7 +229,8 @@ cancelAllReminders(callback: AsyncCallback<void>): void
```
```
reminderAgent.cancelAllReminders((err, data) =>{
reminderAgent.cancelAllReminders((err, data) =>{
console.log("do next")})
console.log("cancelAllReminders callback")
})
```
```
...
@@ -268,7 +252,8 @@ cancelAllReminders(): Promise<void>
...
@@ -268,7 +252,8 @@ cancelAllReminders(): Promise<void>
```
```
reminderAgent.cancelAllReminders().then(() => {
reminderAgent.cancelAllReminders().then(() => {
console.log("do next")})
console.log("cancelAllReminders promise")
})
```
```
...
@@ -290,16 +275,13 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>)
...
@@ -290,16 +275,13 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback<void>)
**示例**
:
**示例**
:
```
```
export default { data: {
mySlot: {
mySlot: {
type: 3,
type: 3,
sound: "/sdcard/music2.mp3"
sound: "/sdcard/music2.mp3"
} },
addSlot() {
reminderAgent.addNotificationSlot(this.mySlot, (err, data) => {
console.log("do next");
});
}
}
}
reminderAgent.addNotificationSlot(this.mySlot, (err, data) => {
console.log("addNotificationSlot callback");
});
```
```
...
@@ -326,16 +308,13 @@ addNotificationSlot(slot: NotificationSlot): Promise<void>
...
@@ -326,16 +308,13 @@ addNotificationSlot(slot: NotificationSlot): Promise<void>
**示例**
:
**示例**
:
```
```
export default { data: {
mySlot: {
mySlot: {
type: 3,
type: 3,
sound: "/sdcard/music2.mp3"
sound: "/sdcard/music2.mp3"
} },
addSlot() {
reminderAgent.addNotificationSlot(this.mySlot).then(() => {
console.log("do next");
});
}
}
}
reminderAgent.addNotificationSlot(this.mySlot).then(() => {
console.log("addNotificationSlot promise");
});
```
```
...
@@ -357,12 +336,9 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback&
...
@@ -357,12 +336,9 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback&
**示例**
:
**示例**
:
```
```
export default {
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
removeSlot() {reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION, (err, data) => {
console.log("removeNotificationSlot callback");
console.log("do next");
});
});
}
}
```
```
...
@@ -389,12 +365,9 @@ removeNotificationSlot(slotType: notification.SlotType): Promise<void>
...
@@ -389,12 +365,9 @@ removeNotificationSlot(slotType: notification.SlotType): Promise<void>
**示例**
:
**示例**
:
```
```
export default {
reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
removeSlot() { reminderAgent.removeNotificationSlot(notification.SlotType.CONTENT_INFORMATION).then(() => {
console.log("removeNotificationSlot promise");
console.log("do next");
});
});
}
}
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录