Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f107493e
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看板
未验证
提交
f107493e
编写于
8月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!22887 提醒代理arkts文档修改
Merge pull request !22887 from 廖康康/cherry-pick-1692862283
上级
febe9480
bf40a1f4
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
208 addition
and
251 deletion
+208
-251
zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
...n/application-dev/reference/apis/js-apis-reminderAgent.md
+74
-73
zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md
...cation-dev/reference/apis/js-apis-reminderAgentManager.md
+134
-178
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md
浏览文件 @
f107493e
...
...
@@ -40,14 +40,14 @@ publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>):
**示例**
:
```
ts
let
t
imer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
let
timer
:
reminderAgent
.
ReminderRequestT
imer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
reminderAgent
.
publishReminder
(
timer
,
(
err
,
reminderId
)
=>
{
console
.
log
(
"
callback, reminderId =
"
+
reminderId
);
});
reminderAgent
.
publishReminder
(
timer
,
(
err
:
BusinessError
,
reminderId
:
number
)
=>
{
console
.
log
(
"
callback, reminderId =
"
+
reminderId
);
});
```
...
...
@@ -76,14 +76,14 @@ publishReminder(reminderReq: ReminderRequest): Promise\<number>
**示例**
:
```
ts
let
t
imer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
let
timer
:
reminderAgent
.
ReminderRequestT
imer
=
{
reminderType
:
reminderAgent
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
promise, reminderId =
"
+
reminderId
);
});
reminderAgent
.
publishReminder
(
timer
).
then
((
reminderId
:
number
)
=>
{
console
.
log
(
"
promise, reminderId =
"
+
reminderId
);
});
```
...
...
@@ -108,8 +108,8 @@ cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void
**示例**
:
```
ts
reminderAgent
.
cancelReminder
(
1
,
(
err
,
data
)
=>
{
console
.
log
(
"
cancelReminder callback
"
);
reminderAgent
.
cancelReminder
(
1
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
console
.
log
(
"
cancelReminder callback
"
);
});
```
...
...
@@ -165,29 +165,29 @@ getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void
**示例**
:
```
ts
reminderAgent
.
getValidReminders
((
err
,
reminders
)
=>
{
console
.
log
(
"
callback, getValidReminders length =
"
+
reminders
.
length
);
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
);
reminderAgent
.
getValidReminders
((
err
:
BusinessError
,
reminders
:
Array
<
reminderAgent
.
ReminderRequest
>
)
=>
{
console
.
log
(
"
callback, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
})
```
...
...
@@ -212,30 +212,31 @@ getValidReminders(): Promise\<Array\<ReminderRequest>>
**示例**
:
```
ts
reminderAgent
.
getValidReminders
().
then
((
reminders
)
=>
{
console
.
log
(
"
promise, getValidReminders length =
"
+
reminders
.
length
);
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
);
reminderAgent
.
getValidReminders
().
then
((
reminders
:
Array
<
reminderAgent
.
ReminderRequest
>
)
=>
{
console
.
log
(
"
promise, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
})
```
...
...
@@ -259,8 +260,8 @@ cancelAllReminders(callback: AsyncCallback\<void>): void
**示例**
:
```
ts
reminderAgent
.
cancelAllReminders
((
err
,
data
)
=>
{
console
.
log
(
"
cancelAllReminders callback
"
)
reminderAgent
.
cancelAllReminders
((
err
:
BusinessError
,
data
:
void
)
=>
{
console
.
log
(
"
cancelAllReminders callback
"
)
})
```
...
...
@@ -311,13 +312,13 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): voi
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
import
notification
from
'
@ohos.notification
Manager
'
let
mySlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
let
mySlot
:
notification
.
NotificationSlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
reminderAgent
.
addNotificationSlot
(
mySlot
,
(
err
,
data
)
=>
{
console
.
log
(
"
addNotificationSlot callback
"
);
reminderAgent
.
addNotificationSlot
(
mySlot
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
console
.
log
(
"
addNotificationSlot callback
"
);
});
```
...
...
@@ -348,13 +349,13 @@ addNotificationSlot(slot: NotificationSlot): Promise\<void>
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
import
notification
from
'
@ohos.notification
Manager
'
let
mySlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
let
mySlot
:
notification
.
NotificationSlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
reminderAgent
.
addNotificationSlot
(
mySlot
).
then
(()
=>
{
console
.
log
(
"
addNotificationSlot promise
"
);
console
.
log
(
"
addNotificationSlot promise
"
);
});
```
...
...
@@ -382,8 +383,8 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\
```
ts
import
notification
from
'
@ohos.notification
'
reminderAgent
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
,
data
)
=>
{
console
.
log
(
"
removeNotificationSlot callback
"
);
reminderAgent
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
console
.
log
(
"
removeNotificationSlot callback
"
);
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md
浏览文件 @
f107493e
...
...
@@ -45,22 +45,18 @@ publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>):
**示例**
:
```
ts
let
timer
=
{
reminderType
:
reminderAgentManager
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
let
timer
:
reminderAgentManager
.
ReminderRequestTimer
=
{
reminderType
:
reminderAgentManager
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
try
{
reminderAgentManager
.
publishReminder
(
timer
,
(
err
,
reminderId
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
callback, reminderId =
"
+
reminderId
);
}
});
}
catch
(
error
)
{
console
.
log
(
"
publishReminder code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
publishReminder
(
timer
,
(
err
:
BusinessError
,
reminderId
:
number
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
callback, reminderId =
"
+
reminderId
);
}
});
```
## reminderAgentManager.publishReminder
...
...
@@ -98,20 +94,16 @@ publishReminder(reminderReq: ReminderRequest): Promise\<number>
**示例**
:
```
ts
let
timer
=
{
reminderType
:
reminderAgentManager
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
let
timer
:
reminderAgentManager
.
ReminderRequestTimer
=
{
reminderType
:
reminderAgentManager
.
ReminderType
.
REMINDER_TYPE_TIMER
,
triggerTimeInSeconds
:
10
}
try
{
reminderAgentManager
.
publishReminder
(
timer
).
then
((
reminderId
)
=>
{
console
.
log
(
"
promise, reminderId =
"
+
reminderId
);
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
publishReminder code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
publishReminder
(
timer
).
then
((
reminderId
:
number
)
=>
{
console
.
log
(
"
promise, reminderId =
"
+
reminderId
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
...
...
@@ -142,17 +134,14 @@ cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void
**示例**
:
```
ts
try
{
reminderAgentManager
.
cancelReminder
(
1
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
cancelReminder callback
"
);
}
});
}
catch
(
error
)
{
console
.
log
(
"
cancelReminder code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
let
reminderId
:
number
=
1
;
reminderAgentManager
.
cancelReminder
(
reminderId
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
cancelReminder callback
"
);
}
});
```
## reminderAgentManager.cancelReminder
...
...
@@ -187,15 +176,12 @@ cancelReminder(reminderId: number): Promise\<void>
**示例**
:
```
ts
try
{
reminderAgentManager
.
cancelReminder
(
1
).
then
(()
=>
{
console
.
log
(
"
cancelReminder promise
"
);
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
cancelReminder code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
let
reminderId
:
number
=
1
;
reminderAgentManager
.
cancelReminder
(
reminderId
).
then
(()
=>
{
console
.
log
(
"
cancelReminder promise
"
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
## reminderAgentManager.getValidReminders
...
...
@@ -223,38 +209,34 @@ getValidReminders(callback: AsyncCallback<Array\<ReminderRequest>>): void
**示例**
:
```
ts
try
{
reminderAgentManager
.
getValidReminders
((
err
,
reminders
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
callback, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
}
})
}
catch
(
error
)
{
console
.
log
(
"
getValidReminders code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
getValidReminders
((
err
:
BusinessError
,
reminders
:
Array
<
reminderAgentManager
.
ReminderRequest
>
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
callback, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
}
});
```
## reminderAgentManager.getValidReminders
...
...
@@ -282,36 +264,32 @@ getValidReminders(): Promise\<Array\<ReminderRequest>>
**示例**
:
```
ts
try
{
reminderAgentManager
.
getValidReminders
().
then
((
reminders
)
=>
{
console
.
log
(
"
promise, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
getValidReminders code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
getValidReminders
().
then
((
reminders
:
Array
<
reminderAgentManager
.
ReminderRequest
>
)
=>
{
console
.
log
(
"
promise, getValidReminders length =
"
+
reminders
.
length
);
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
);
}
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
## reminderAgentManager.cancelAllReminders
...
...
@@ -339,17 +317,13 @@ cancelAllReminders(callback: AsyncCallback\<void>): void
**示例**
:
```
ts
try
{
reminderAgentManager
.
cancelAllReminders
((
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
cancelAllReminders callback
"
)
}
})
}
catch
(
error
)
{
console
.
log
(
"
cancelAllReminders code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
cancelAllReminders
((
err
:
BusinessError
,
data
:
void
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
cancelAllReminders callback
"
)
}
});
```
## reminderAgentManager.cancelAllReminders
...
...
@@ -377,15 +351,11 @@ cancelAllReminders(): Promise\<void>
**示例**
:
```
ts
try
{
reminderAgentManager
.
cancelAllReminders
().
then
(()
=>
{
console
.
log
(
"
cancelAllReminders promise
"
)
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
cancelAllReminders code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
cancelAllReminders
().
then
(()
=>
{
console
.
log
(
"
cancelAllReminders promise
"
)
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
...
...
@@ -407,22 +377,19 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): voi
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
import
notification
from
'
@ohos.notification
Manager
'
let
mySlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
let
mySlot
:
notification
.
NotificationSlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
try
{
reminderAgentManager
.
addNotificationSlot
(
mySlot
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
addNotificationSlot callback
"
);
}
});
}
catch
(
error
)
{
console
.
log
(
"
addNotificationSlot code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
addNotificationSlot
(
mySlot
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
addNotificationSlot callback
"
);
}
});
```
...
...
@@ -449,20 +416,16 @@ addNotificationSlot(slot: NotificationSlot): Promise\<void>
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
import
notification
from
'
@ohos.notification
Manager
'
let
mySlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
let
mySlot
:
notification
.
NotificationSlot
=
{
type
:
notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
try
{
reminderAgentManager
.
addNotificationSlot
(
mySlot
).
then
(()
=>
{
console
.
log
(
"
addNotificationSlot promise
"
);
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
addNotificationSlot code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
reminderAgentManager
.
addNotificationSlot
(
mySlot
).
then
(()
=>
{
console
.
log
(
"
addNotificationSlot promise
"
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
...
...
@@ -484,19 +447,16 @@ removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
try
{
reminderAgentManager
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
removeNotificationSlot callback
"
);
}
});
}
catch
(
error
)
{
console
.
log
(
"
removeNotificationSlot code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
import
notification
from
'
@ohos.notificationManager
'
reminderAgentManager
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
,
(
err
:
BusinessError
,
data
:
void
)
=>
{
if
(
err
)
{
console
.
log
(
"
callback err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
}
else
{
console
.
log
(
"
removeNotificationSlot callback
"
);
}
});
```
...
...
@@ -523,17 +483,13 @@ removeNotificationSlot(slotType: notification.SlotType): Promise\<void>
**示例**
:
```
ts
import
notification
from
'
@ohos.notification
'
try
{
reminderAgentManager
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
log
(
"
removeNotificationSlot promise
"
);
}).
catch
(
err
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
}
catch
(
error
)
{
console
.
log
(
"
removeNotificationSlot code:
"
+
error
.
code
+
"
message:
"
+
error
.
message
);
};
import
notification
from
'
@ohos.notificationManager
'
reminderAgentManager
.
removeNotificationSlot
(
notification
.
SlotType
.
CONTENT_INFORMATION
).
then
(()
=>
{
console
.
log
(
"
removeNotificationSlot promise
"
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
promise err code:
"
+
err
.
code
+
"
message:
"
+
err
.
message
);
});
```
## ActionButtonType
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录