Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
bb8f1a46
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
bb8f1a46
编写于
12月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12741 修改API参考问题
Merge pull request !12741 from zhongjianfei/mm001
上级
afade796
536d6b16
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
382 addition
and
381 deletion
+382
-381
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
...dev/reference/apis/js-apis-inner-ability-abilityResult.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-notification.md
zh-cn/application-dev/reference/apis/js-apis-notification.md
+380
-379
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
...ication-dev/reference/apis/js-apis-notificationManager.md
+1
-1
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
浏览文件 @
bb8f1a46
...
@@ -10,6 +10,6 @@
...
@@ -10,6 +10,6 @@
| 名称 | 可读 | 可写 | 类型 | 必填 | 说明 |
| 名称 | 可读 | 可写 | 类型 | 必填 | 说明 |
| ----------- | -------- |-------- | -------------------- | ---- | ------------------------------------------------------------ |
| ----------- | -------- |-------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | 是 | 否 | number |
否
| 表示ability拉起、销毁之后返回的结果码。 |
| resultCode | 是 | 否 | number |
是
| 表示ability拉起、销毁之后返回的结果码。 |
| want | 是 | 否 |
[
Want
](
./js-apis-app-ability-want.md
)
| 否 | 表示ability销毁之后返回的数据。 |
| want | 是 | 否 |
[
Want
](
./js-apis-app-ability-want.md
)
| 否 | 表示ability销毁之后返回的数据。 |
zh-cn/application-dev/reference/apis/js-apis-notification.md
浏览文件 @
bb8f1a46
...
@@ -2,11 +2,11 @@
...
@@ -2,11 +2,11 @@
本模块提供通知管理的能力,包括发布、取消发布通知,创建、获取、移除通知通道,订阅、取消订阅通知,获取通知的使能状态、角标使能状态,获取通知的相关信息等。
本模块提供通知管理的能力,包括发布、取消发布通知,创建、获取、移除通知通道,订阅、取消订阅通知,获取通知的使能状态、角标使能状态,获取通知的相关信息等。
一般情况下,只有系统应用具有通知订阅和取消订阅的权限。
> **说明:**
> **说明:**
>
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> 通知订阅和取消订阅仅对系统应用开放。
## 导入模块
## 导入模块
...
@@ -26,13 +26,13 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
...
@@ -26,13 +26,13 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
| callback | AsyncCallback
\<
void
\>
| 是 |
被指定的回调方法。
|
| callback | AsyncCallback
\<
void
\>
| 是 |
发布通知的回调方法。
|
**示例:**
**示例:**
```
js
```
js
//publish回调
//
publish回调
function
publishCallback
(
err
)
{
function
publishCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
publish failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
publish failed
"
+
JSON
.
stringify
(
err
));
...
@@ -40,7 +40,7 @@ function publishCallback(err) {
...
@@ -40,7 +40,7 @@ function publishCallback(err) {
console
.
info
(
"
publish success
"
);
console
.
info
(
"
publish success
"
);
}
}
}
}
//通知Request对象
//
通知Request对象
var
notificationRequest
=
{
var
notificationRequest
=
{
id
:
1
,
id
:
1
,
content
:
{
content
:
{
...
@@ -69,12 +69,12 @@ publish(request: NotificationRequest): Promise\<void\>
...
@@ -69,12 +69,12 @@ publish(request: NotificationRequest): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
**示例:**
**示例:**
```
js
```
js
//通知Request对象
//
通知Request对象
var
notificationRequest
=
{
var
notificationRequest
=
{
notificationId
:
1
,
notificationId
:
1
,
content
:
{
content
:
{
...
@@ -87,7 +87,7 @@ var notificationRequest = {
...
@@ -87,7 +87,7 @@ var notificationRequest = {
}
}
}
}
Notification
.
publish
(
notificationRequest
).
then
(()
=>
{
Notification
.
publish
(
notificationRequest
).
then
(()
=>
{
console
.
info
(
"
publish sucess
"
);
console
.
info
(
"
publish suc
c
ess
"
);
});
});
```
```
...
@@ -96,7 +96,7 @@ Notification.publish(notificationRequest).then(() => {
...
@@ -96,7 +96,7 @@ Notification.publish(notificationRequest).then(() => {
publish(request: NotificationRequest, userId: number, callback: AsyncCallback
\<
void
\>
): void
publish(request: NotificationRequest, userId: number, callback: AsyncCallback
\<
void
\>
): void
发布通知(callback形式)。
发布通知
给指定的用户
(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -108,14 +108,14 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
...
@@ -108,14 +108,14 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 被指定的回调方法。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 被指定的回调方法。 |
**示例:**
**示例:**
```
js
```
js
//publish回调
//
publish回调
function
publishCallback
(
err
)
{
function
publishCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
publish failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
publish failed
"
+
JSON
.
stringify
(
err
));
...
@@ -123,9 +123,9 @@ function publishCallback(err) {
...
@@ -123,9 +123,9 @@ function publishCallback(err) {
console
.
info
(
"
publish success
"
);
console
.
info
(
"
publish success
"
);
}
}
}
}
//
接收通知的
用户ID
// 用户ID
var
userId
=
1
var
userId
=
1
//通知Request对象
//
通知Request对象
var
notificationRequest
=
{
var
notificationRequest
=
{
id
:
1
,
id
:
1
,
content
:
{
content
:
{
...
@@ -144,7 +144,7 @@ Notification.publish(notificationRequest, userId, publishCallback);
...
@@ -144,7 +144,7 @@ Notification.publish(notificationRequest, userId, publishCallback);
publish(request: NotificationRequest, userId: number): Promise
\<
void
\>
publish(request: NotificationRequest, userId: number): Promise
\<
void
\>
发布通知(Promise形式)。
发布通知
给指定的用户
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -156,8 +156,8 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
...
@@ -156,8 +156,8 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
**示例:**
**示例:**
...
@@ -177,7 +177,7 @@ var notificationRequest = {
...
@@ -177,7 +177,7 @@ var notificationRequest = {
var
userId
=
1
var
userId
=
1
Notification
.
publish
(
notificationRequest
,
userId
).
then
(()
=>
{
Notification
.
publish
(
notificationRequest
,
userId
).
then
(()
=>
{
console
.
info
(
"
publish sucess
"
);
console
.
info
(
"
publish suc
c
ess
"
);
});
});
```
```
...
@@ -186,7 +186,7 @@ Notification.publish(notificationRequest, userId).then(() => {
...
@@ -186,7 +186,7 @@ Notification.publish(notificationRequest, userId).then(() => {
cancel(id: number, label: string, callback: AsyncCallback
\<
void
\>
): void
cancel(id: number, label: string, callback: AsyncCallback
\<
void
\>
): void
取消与指定id和label相匹配的已发布
通知(callback形式)。
通过通知ID和通知标签取消已发布的
通知(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -201,7 +201,7 @@ cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
...
@@ -201,7 +201,7 @@ cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//cancel回调
//
cancel回调
function
cancelCallback
(
err
)
{
function
cancelCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
cancel failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
cancel failed
"
+
JSON
.
stringify
(
err
));
...
@@ -218,7 +218,7 @@ Notification.cancel(0, "label", cancelCallback)
...
@@ -218,7 +218,7 @@ Notification.cancel(0, "label", cancelCallback)
cancel(id: number, label?: string): Promise
\<
void
\>
cancel(id: number, label?: string): Promise
\<
void
\>
取消与指定
id
相匹配的已发布通知,label可以指定也可以不指定(Promise形式)。
取消与指定
通知ID
相匹配的已发布通知,label可以指定也可以不指定(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -233,7 +233,7 @@ cancel(id: number, label?: string): Promise\<void\>
...
@@ -233,7 +233,7 @@ cancel(id: number, label?: string): Promise\<void\>
```
js
```
js
Notification
.
cancel
(
0
).
then
(()
=>
{
Notification
.
cancel
(
0
).
then
(()
=>
{
console
.
info
(
"
cancel sucess
"
);
console
.
info
(
"
cancel suc
c
ess
"
);
});
});
```
```
...
@@ -243,7 +243,7 @@ Notification.cancel(0).then(() => {
...
@@ -243,7 +243,7 @@ Notification.cancel(0).then(() => {
cancel(id: number, callback: AsyncCallback
\<
void
\>
): void
cancel(id: number, callback: AsyncCallback
\<
void
\>
): void
取消与指定
id
相匹配的已发布通知(callback形式)。
取消与指定
通知ID
相匹配的已发布通知(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -257,7 +257,7 @@ cancel(id: number, callback: AsyncCallback\<void\>): void
...
@@ -257,7 +257,7 @@ cancel(id: number, callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//cancel回调
//
cancel回调
function
cancelCallback
(
err
)
{
function
cancelCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
cancel failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
cancel failed
"
+
JSON
.
stringify
(
err
));
...
@@ -287,7 +287,7 @@ cancelAll(callback: AsyncCallback\<void\>): void
...
@@ -287,7 +287,7 @@ cancelAll(callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//cancel回调
//
cancel回调
function
cancelAllCallback
(
err
)
{
function
cancelAllCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
cancelAll failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
cancelAll failed
"
+
JSON
.
stringify
(
err
));
...
@@ -312,7 +312,7 @@ cancelAll(): Promise\<void\>
...
@@ -312,7 +312,7 @@ cancelAll(): Promise\<void\>
```
js
```
js
Notification
.
cancelAll
().
then
(()
=>
{
Notification
.
cancelAll
().
then
(()
=>
{
console
.
info
(
"
cancelAll sucess
"
);
console
.
info
(
"
cancelAll suc
c
ess
"
);
});
});
```
```
...
@@ -340,7 +340,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
...
@@ -340,7 +340,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//addslot回调
//
addslot回调
function
addSlotCallBack
(
err
)
{
function
addSlotCallBack
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
addSlot failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
addSlot failed
"
+
JSON
.
stringify
(
err
));
...
@@ -348,7 +348,7 @@ function addSlotCallBack(err) {
...
@@ -348,7 +348,7 @@ function addSlotCallBack(err) {
console
.
info
(
"
addSlot success
"
);
console
.
info
(
"
addSlot success
"
);
}
}
}
}
//通知slot对象
//
通知slot对象
var
notificationSlot
=
{
var
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
...
@@ -378,12 +378,12 @@ addSlot(slot: NotificationSlot): Promise\<void\>
...
@@ -378,12 +378,12 @@ addSlot(slot: NotificationSlot): Promise\<void\>
**示例:**
**示例:**
```
js
```
js
//通知slot对象
//
通知slot对象
var
notificationSlot
=
{
var
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
Notification
.
addSlot
(
notificationSlot
).
then
(()
=>
{
Notification
.
addSlot
(
notificationSlot
).
then
(()
=>
{
console
.
info
(
"
addSlot sucess
"
);
console
.
info
(
"
addSlot suc
c
ess
"
);
});
});
```
```
...
@@ -393,7 +393,7 @@ Notification.addSlot(notificationSlot).then(() => {
...
@@ -393,7 +393,7 @@ Notification.addSlot(notificationSlot).then(() => {
addSlot(type: SlotType, callback: AsyncCallback
\<
void
\>
): void
addSlot(type: SlotType, callback: AsyncCallback
\<
void
\>
): void
创建通知通道(callback形式)。
创建
指定类型的
通知通道(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -407,7 +407,7 @@ addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
...
@@ -407,7 +407,7 @@ addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//addslot回调
//
addslot回调
function
addSlotCallBack
(
err
)
{
function
addSlotCallBack
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
addSlot failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
addSlot failed
"
+
JSON
.
stringify
(
err
));
...
@@ -424,7 +424,7 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack
...
@@ -424,7 +424,7 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack
addSlot(type: SlotType): Promise
\<
void
\>
addSlot(type: SlotType): Promise
\<
void
\>
创建通知通道(Promise形式)。
创建
指定类型的
通知通道(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -438,7 +438,7 @@ addSlot(type: SlotType): Promise\<void\>
...
@@ -438,7 +438,7 @@ addSlot(type: SlotType): Promise\<void\>
```
js
```
js
Notification
.
addSlot
(
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
Notification
.
addSlot
(
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
(()
=>
{
console
.
info
(
"
addSlot sucess
"
);
console
.
info
(
"
addSlot suc
c
ess
"
);
});
});
```
```
...
@@ -466,7 +466,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
...
@@ -466,7 +466,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
**示例:**
**示例:**
```
js
```
js
//addSlots回调
//
addSlots回调
function
addSlotsCallBack
(
err
)
{
function
addSlotsCallBack
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
addSlots failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
addSlots failed
"
+
JSON
.
stringify
(
err
));
...
@@ -474,11 +474,11 @@ function addSlotsCallBack(err) {
...
@@ -474,11 +474,11 @@ function addSlotsCallBack(err) {
console
.
info
(
"
addSlots success
"
);
console
.
info
(
"
addSlots success
"
);
}
}
}
}
//通知slot对象
//
通知slot对象
var
notificationSlot
=
{
var
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
//通知slot array 对象
//
通知slot array 对象
var
notificationSlotArray
=
new
Array
();
var
notificationSlotArray
=
new
Array
();
notificationSlotArray
[
0
]
=
notificationSlot
;
notificationSlotArray
[
0
]
=
notificationSlot
;
...
@@ -508,16 +508,16 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
...
@@ -508,16 +508,16 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
**示例:**
**示例:**
```
js
```
js
//通知slot对象
//
通知slot对象
var
notificationSlot
=
{
var
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
//通知slot array 对象
//
通知slot array 对象
var
notificationSlotArray
=
new
Array
();
var
notificationSlotArray
=
new
Array
();
notificationSlotArray
[
0
]
=
notificationSlot
;
notificationSlotArray
[
0
]
=
notificationSlot
;
Notification
.
addSlots
(
notificationSlotArray
).
then
(()
=>
{
Notification
.
addSlots
(
notificationSlotArray
).
then
(()
=>
{
console
.
info
(
"
addSlots sucess
"
);
console
.
info
(
"
addSlots suc
c
ess
"
);
});
});
```
```
...
@@ -527,7 +527,7 @@ Notification.addSlots(notificationSlotArray).then(() => {
...
@@ -527,7 +527,7 @@ Notification.addSlots(notificationSlotArray).then(() => {
getSlot(slotType: SlotType, callback: AsyncCallback
\<
NotificationSlot
\>
): void
getSlot(slotType: SlotType, callback: AsyncCallback
\<
NotificationSlot
\>
): void
获取一个通知通道(callback形式)。
获取一个
指定类型的
通知通道(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -535,14 +535,14 @@ getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
...
@@ -535,14 +535,14 @@ getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ----------------------------------------------------------- |
| -------- | --------------------------------- | ---- | ----------------------------------------------------------- |
| slotType |
[
SlotType
](
#slottype
)
| 是 | 通知渠道类型
,
目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| slotType |
[
SlotType
](
#slottype
)
| 是 | 通知渠道类型
,
目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| callback | AsyncCallback
\<
[
NotificationSlot
](
#notificationslot
)
\>
| 是 | 表示被指定的回调方法。 |
| callback | AsyncCallback
\<
[
NotificationSlot
](
#notificationslot
)
\>
| 是 | 表示被指定的回调方法。 |
**示例:**
**示例:**
```
js
```
js
//getSlot回调
//
getSlot回调
function
getSlotCallback
(
err
,
data
)
{
function
getSlotCallback
(
err
,
data
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
getSlot failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
getSlot failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
...
@@ -559,7 +559,7 @@ Notification.getSlot(slotType, getSlotCallback)
...
@@ -559,7 +559,7 @@ Notification.getSlot(slotType, getSlotCallback)
getSlot(slotType: SlotType): Promise
\<
NotificationSlot
\>
getSlot(slotType: SlotType): Promise
\<
NotificationSlot
\>
获取一个通知通道(Promise形式)。
获取一个
指定类型的
通知通道(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -567,7 +567,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
...
@@ -567,7 +567,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | ---- | ----------------------------------------------------------- |
| -------- | -------- | ---- | ----------------------------------------------------------- |
| slotType |
[
SlotType
](
#slottype
)
| 是 | 通知渠道类型
,
目前分为社交通信、服务提醒、内容咨询和其他类型。 |
| slotType |
[
SlotType
](
#slottype
)
| 是 | 通知渠道类型
,
目前分为社交通信、服务提醒、内容咨询和其他类型。 |
**返回值:**
**返回值:**
...
@@ -580,7 +580,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
...
@@ -580,7 +580,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
```
js
```
js
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
getSlot
(
slotType
).
then
((
data
)
=>
{
Notification
.
getSlot
(
slotType
).
then
((
data
)
=>
{
console
.
info
(
"
getSlot sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getSlot suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -598,13 +598,13 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
...
@@ -598,13 +598,13 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------- |
| -------- | --------------------------------- | ---- | -------------------- |
| callback | AsyncCallback
\<
Array
\<
[
NotificationSlot
](
#notificationslot
)
\>\>
| 是 |
表示被指定的回调方法
。 |
| callback | AsyncCallback
\<
Array
\<
[
NotificationSlot
](
#notificationslot
)
\>\>
| 是 |
以callback形式返回获取此应用程序的所有通知通道的结果
。 |
**示例:**
**示例:**
```
js
```
js
//getSlots回调
//
getSlots回调
function
getSlotsCallback
(
err
,
data
)
{
function
getSlotsCallback
(
err
,
data
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
getSlots failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
getSlots failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
...
@@ -634,7 +634,7 @@ getSlots(): Promise\<Array\<NotificationSlot\>>
...
@@ -634,7 +634,7 @@ getSlots(): Promise\<Array\<NotificationSlot\>>
```
js
```
js
Notification
.
getSlots
().
then
((
data
)
=>
{
Notification
.
getSlots
().
then
((
data
)
=>
{
console
.
info
(
"
getSlots sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getSlots suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -644,7 +644,7 @@ Notification.getSlots().then((data) => {
...
@@ -644,7 +644,7 @@ Notification.getSlots().then((data) => {
removeSlot(slotType: SlotType, callback: AsyncCallback
\<
void
\>
): void
removeSlot(slotType: SlotType, callback: AsyncCallback
\<
void
\>
): void
根据通知通道类型删除创建
的通知通道(callback形式)。
删除指定类型
的通知通道(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -658,7 +658,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
...
@@ -658,7 +658,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
**示例:**
**示例:**
```
js
```
js
//removeSlot回调
//
removeSlot回调
function
removeSlotCallback
(
err
)
{
function
removeSlotCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
removeSlot failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
removeSlot failed
"
+
JSON
.
stringify
(
err
));
...
@@ -676,7 +676,7 @@ Notification.removeSlot(slotType,removeSlotCallback)
...
@@ -676,7 +676,7 @@ Notification.removeSlot(slotType,removeSlotCallback)
removeSlot(slotType: SlotType): Promise
\<
void
\>
removeSlot(slotType: SlotType): Promise
\<
void
\>
根据通知通道类型删除创建
的通知通道(Promise形式)。
删除指定类型
的通知通道(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -691,7 +691,7 @@ removeSlot(slotType: SlotType): Promise\<void\>
...
@@ -691,7 +691,7 @@ removeSlot(slotType: SlotType): Promise\<void\>
```
js
```
js
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
removeSlot
(
slotType
).
then
(()
=>
{
Notification
.
removeSlot
(
slotType
).
then
(()
=>
{
console
.
info
(
"
removeSlot sucess
"
);
console
.
info
(
"
removeSlot suc
c
ess
"
);
});
});
```
```
...
@@ -738,7 +738,7 @@ removeAllSlots(): Promise\<void\>
...
@@ -738,7 +738,7 @@ removeAllSlots(): Promise\<void\>
```
js
```
js
Notification
.
removeAllSlots
().
then
(()
=>
{
Notification
.
removeAllSlots
().
then
(()
=>
{
console
.
info
(
"
removeAllSlots sucess
"
);
console
.
info
(
"
removeAllSlots suc
c
ess
"
);
});
});
```
```
...
@@ -761,13 +761,13 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
...
@@ -761,13 +761,13 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ---------------- |
| ---------- | ------------------------- | ---- | ---------------- |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 是 |
订阅信息。
|
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 是 |
通知订阅信息。
|
| callback | AsyncCallback
\<
void
\>
| 是 | 订阅动作回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 订阅动作回调函数。 |
**示例:**
**示例:**
```
js
```
js
//subscribe回调
//
subscribe回调
function
subscribeCallback
(
err
)
{
function
subscribeCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
subscribe failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
subscribe failed
"
+
JSON
.
stringify
(
err
));
...
@@ -782,7 +782,7 @@ var subscriber = {
...
@@ -782,7 +782,7 @@ var subscriber = {
onConsume
:
onConsumeCallback
onConsume
:
onConsumeCallback
}
}
var
info
=
{
var
info
=
{
bundleNames
:
[
"
bundleName1
"
,
"
bundleName2
"
]
bundleNames
:
[
"
bundleName1
"
,
"
bundleName2
"
]
}
}
Notification
.
subscribe
(
subscriber
,
info
,
subscribeCallback
);
Notification
.
subscribe
(
subscriber
,
info
,
subscribeCallback
);
```
```
...
@@ -793,7 +793,7 @@ Notification.subscribe(subscriber, info, subscribeCallback);
...
@@ -793,7 +793,7 @@ Notification.subscribe(subscriber, info, subscribeCallback);
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback
\<
void
\>
): void
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback
\<
void
\>
): void
订阅
通知并指定订阅信息
(callback形式)。
订阅
当前用户下所有应用的通知
(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -846,7 +846,7 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
...
@@ -846,7 +846,7 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------ |
| ---------- | ------------------------- | ---- | ------------ |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 否 |
订阅信息。
|
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 否 |
通知订阅信息。
|
**示例:**
**示例:**
...
@@ -858,7 +858,7 @@ var subscriber = {
...
@@ -858,7 +858,7 @@ var subscriber = {
onConsume
:
onConsumeCallback
onConsume
:
onConsumeCallback
};
};
Notification
.
subscribe
(
subscriber
).
then
(()
=>
{
Notification
.
subscribe
(
subscriber
).
then
(()
=>
{
console
.
info
(
"
subscribe sucess
"
);
console
.
info
(
"
subscribe suc
c
ess
"
);
});
});
```
```
...
@@ -893,11 +893,11 @@ function unsubscribeCallback(err) {
...
@@ -893,11 +893,11 @@ function unsubscribeCallback(err) {
console
.
info
(
"
unsubscribe success
"
);
console
.
info
(
"
unsubscribe success
"
);
}
}
}
}
function
on
Cancel
Callback
(
data
)
{
function
on
Disconnect
Callback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
}
}
var
subscriber
=
{
var
subscriber
=
{
on
Cancel
:
onCancel
Callback
on
Disconnect
:
onDisconnect
Callback
}
}
Notification
.
unsubscribe
(
subscriber
,
unsubscribeCallback
);
Notification
.
unsubscribe
(
subscriber
,
unsubscribeCallback
);
```
```
...
@@ -925,14 +925,14 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
...
@@ -925,14 +925,14 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**示例:**
**示例:**
```
js
```
js
function
on
Cancel
Callback
(
data
)
{
function
on
Disconnect
Callback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
}
}
var
subscriber
=
{
var
subscriber
=
{
on
Cancel
:
onCancel
Callback
on
Disconnect
:
onDisconnect
Callback
};
};
Notification
.
unsubscribe
(
subscriber
).
then
(()
=>
{
Notification
.
unsubscribe
(
subscriber
).
then
(()
=>
{
console
.
info
(
"
unsubscribe sucess
"
);
console
.
info
(
"
unsubscribe suc
c
ess
"
);
});
});
```
```
...
@@ -942,7 +942,7 @@ Notification.unsubscribe(subscriber).then(() => {
...
@@ -942,7 +942,7 @@ Notification.unsubscribe(subscriber).then(() => {
enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
设定指定
包
的通知使能状态(Callback形式)。
设定指定
应用
的通知使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -954,7 +954,7 @@ enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallbac
...
@@ -954,7 +954,7 @@ enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
包信息。
|
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的包信息。
|
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知使能回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知使能回调函数。 |
...
@@ -980,7 +980,7 @@ Notification.enableNotification(bundle, false, enableNotificationCallback);
...
@@ -980,7 +980,7 @@ Notification.enableNotification(bundle, false, enableNotificationCallback);
enableNotification(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
enableNotification(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
设定指定
包
的通知使能状态(Promise形式)。
设定指定
应用
的通知使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -992,7 +992,7 @@ enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\>
...
@@ -992,7 +992,7 @@ enableNotification(bundle: BundleOption, enable: boolean): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
**示例:**
**示例:**
...
@@ -1002,7 +1002,7 @@ var bundle = {
...
@@ -1002,7 +1002,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
enableNotification
(
bundle
,
false
).
then
(()
=>
{
Notification
.
enableNotification
(
bundle
,
false
).
then
(()
=>
{
console
.
info
(
"
enableNotification sucess
"
);
console
.
info
(
"
enableNotification suc
c
ess
"
);
});
});
```
```
...
@@ -1012,7 +1012,7 @@ Notification.enableNotification(bundle, false).then(() => {
...
@@ -1012,7 +1012,7 @@ Notification.enableNotification(bundle, false).then(() => {
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
获取指定
包
的通知使能状态(Callback形式)。
获取指定
应用
的通知使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1024,7 +1024,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
...
@@ -1024,7 +1024,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
| -------- | --------------------- | ---- | ------------------------ |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
包信息。
|
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的包信息。
|
| callback | AsyncCallback
\<
void
\>
| 是 | 获取通知使能状态回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 获取通知使能状态回调函数。 |
**示例:**
**示例:**
...
@@ -1049,7 +1049,7 @@ Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
...
@@ -1049,7 +1049,7 @@ Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
isNotificationEnabled(bundle: BundleOption): Promise
\<
boolean
\>
isNotificationEnabled(bundle: BundleOption): Promise
\<
boolean
\>
获取指定
包
的通知使能状态(Promise形式)。
获取指定
应用
的通知使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1061,13 +1061,13 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
...
@@ -1061,13 +1061,13 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------
----------------------------------------- | ---------
--------------------------------------------------- |
| ------------------
|
--------------------------------------------------- |
| Promise
\<
boolean
\>
| 以Promise形式返回获取指定
包
的通知使能状态的结果。 |
| Promise
\<
boolean
\>
| 以Promise形式返回获取指定
应用
的通知使能状态的结果。 |
**示例:**
**示例:**
...
@@ -1076,7 +1076,7 @@ var bundle = {
...
@@ -1076,7 +1076,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
isNotificationEnabled
(
bundle
).
then
((
data
)
=>
{
Notification
.
isNotificationEnabled
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
isNotificationEnabled sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isNotificationEnabled suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1132,7 +1132,7 @@ isNotificationEnabled(): Promise\<boolean\>
...
@@ -1132,7 +1132,7 @@ isNotificationEnabled(): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
**返回值:**
**返回值:**
...
@@ -1144,7 +1144,7 @@ isNotificationEnabled(): Promise\<boolean\>
...
@@ -1144,7 +1144,7 @@ isNotificationEnabled(): Promise\<boolean\>
```
js
```
js
Notification
.
isNotificationEnabled
().
then
((
data
)
=>
{
Notification
.
isNotificationEnabled
().
then
((
data
)
=>
{
console
.
info
(
"
isNotificationEnabled sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isNotificationEnabled suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1154,7 +1154,7 @@ Notification.isNotificationEnabled().then((data) => {
...
@@ -1154,7 +1154,7 @@ Notification.isNotificationEnabled().then((data) => {
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
设定指定
包
的角标使能状态(Callback形式)。
设定指定
应用
的角标使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1166,7 +1166,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
...
@@ -1166,7 +1166,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定角标使能回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定角标使能回调函数。 |
...
@@ -1192,7 +1192,7 @@ Notification.displayBadge(bundle, false, displayBadgeCallback);
...
@@ -1192,7 +1192,7 @@ Notification.displayBadge(bundle, false, displayBadgeCallback);
displayBadge(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
displayBadge(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
设定指定
包
的角标使能状态(Promise形式)。
设定指定
应用
的角标使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1204,7 +1204,7 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
...
@@ -1204,7 +1204,7 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
**示例:**
**示例:**
...
@@ -1214,7 +1214,7 @@ var bundle = {
...
@@ -1214,7 +1214,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
displayBadge
(
bundle
,
false
).
then
(()
=>
{
Notification
.
displayBadge
(
bundle
,
false
).
then
(()
=>
{
console
.
info
(
"
displayBadge sucess
"
);
console
.
info
(
"
displayBadge suc
c
ess
"
);
});
});
```
```
...
@@ -1224,7 +1224,7 @@ Notification.displayBadge(bundle, false).then(() => {
...
@@ -1224,7 +1224,7 @@ Notification.displayBadge(bundle, false).then(() => {
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
获取指定
包
的角标使能状态(Callback形式)。
获取指定
应用
的角标使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1236,7 +1236,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
...
@@ -1236,7 +1236,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
| -------- | --------------------- | ---- | ------------------------ |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 获取角标使能状态回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 获取角标使能状态回调函数。 |
**示例:**
**示例:**
...
@@ -1261,7 +1261,7 @@ Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
...
@@ -1261,7 +1261,7 @@ Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
isBadgeDisplayed(bundle: BundleOption): Promise
\<
boolean
\>
isBadgeDisplayed(bundle: BundleOption): Promise
\<
boolean
\>
获取指定
包
的角标使能状态(Promise形式)。
获取指定
应用
的角标使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1273,13 +1273,13 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
...
@@ -1273,13 +1273,13 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise
\<
boolean
\>
| 以Promise形式返回获取指定
包
的角标使能状态。 |
| Promise
\<
boolean
\>
| 以Promise形式返回获取指定
应用
的角标使能状态。 |
**示例:**
**示例:**
...
@@ -1288,7 +1288,7 @@ var bundle = {
...
@@ -1288,7 +1288,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
isBadgeDisplayed
(
bundle
).
then
((
data
)
=>
{
Notification
.
isBadgeDisplayed
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
isBadgeDisplayed sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isBadgeDisplayed suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1298,7 +1298,7 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
...
@@ -1298,7 +1298,7 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback
\<
void
\>
): void
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback
\<
void
\>
): void
设定指定
包的通知通道状态
(Callback形式)。
设定指定
应用的通知通道
(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1310,7 +1310,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
...
@@ -1310,7 +1310,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| slot |
[
NotificationSlot
](
#notificationslot
)
| 是 | 通知通道。 |
| slot |
[
NotificationSlot
](
#notificationslot
)
| 是 | 通知通道。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知通道回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知通道回调函数。 |
...
@@ -1339,7 +1339,7 @@ Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
...
@@ -1339,7 +1339,7 @@ Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise
\<
void
\>
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise
\<
void
\>
设定指定
包的通知通道状态
(Promise形式)。
设定指定
应用的通知通道
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1351,8 +1351,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
...
@@ -1351,8 +1351,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| slot |
[
NotificationSlot
](
#notificationslot
)
| 是 |
使能状态。
|
| slot |
[
NotificationSlot
](
#notificationslot
)
| 是 |
通知通道。
|
**示例:**
**示例:**
...
@@ -1364,7 +1364,7 @@ var notificationSlot = {
...
@@ -1364,7 +1364,7 @@ var notificationSlot = {
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
Notification
.
setSlotByBundle
(
bundle
,
notificationSlot
).
then
(()
=>
{
Notification
.
setSlotByBundle
(
bundle
,
notificationSlot
).
then
(()
=>
{
console
.
info
(
"
setSlotByBundle sucess
"
);
console
.
info
(
"
setSlotByBundle suc
c
ess
"
);
});
});
```
```
...
@@ -1374,7 +1374,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
...
@@ -1374,7 +1374,7 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback
<Array
\<
NotificationSlot
\
>
>): void
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback
<Array
\<
NotificationSlot
\
>
>): void
获取指定
包的
通知通道(Callback形式)。
获取指定
应用的所有
通知通道(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1386,7 +1386,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
...
@@ -1386,7 +1386,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------- |
| -------- | ---------------------------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| callback | AsyncCallback
<Array
\<[
NotificationSlot
](
#notificationslot
)\
>
> | 是 | 获取通知通道回调函数。 |
| callback | AsyncCallback
<Array
\<[
NotificationSlot
](
#notificationslot
)\
>
> | 是 | 获取通知通道回调函数。 |
**示例:**
**示例:**
...
@@ -1411,7 +1411,7 @@ Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
...
@@ -1411,7 +1411,7 @@ Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
getSlotsByBundle(bundle: BundleOption): Promise
<Array
\<
NotificationSlot
\
>
>
getSlotsByBundle(bundle: BundleOption): Promise
<Array
\<
NotificationSlot
\
>
>
获取指定
包的
通知通道(Promise形式)。
获取指定
应用的所有
通知通道(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1423,13 +1423,13 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
...
@@ -1423,13 +1423,13 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise
<Array
\<[
NotificationSlot
](
#notificationslot
)\
>
> | 以Promise形式返回获取指定
包
的通知通道。 |
| Promise
<Array
\<[
NotificationSlot
](
#notificationslot
)\
>
> | 以Promise形式返回获取指定
应用
的通知通道。 |
**示例:**
**示例:**
...
@@ -1438,7 +1438,7 @@ var bundle = {
...
@@ -1438,7 +1438,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
getSlotsByBundle
(
bundle
).
then
((
data
)
=>
{
Notification
.
getSlotsByBundle
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
getSlotsByBundle sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getSlotsByBundle suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1448,7 +1448,7 @@ Notification.getSlotsByBundle(bundle).then((data) => {
...
@@ -1448,7 +1448,7 @@ Notification.getSlotsByBundle(bundle).then((data) => {
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback
\<
number
\>
): void
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback
\<
number
\>
): void
获取指定
包的通知通道数
(Callback形式)。
获取指定
应用的通知通道数量
(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1460,8 +1460,8 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
...
@@ -1460,8 +1460,8 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- |
| -------- | ------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| callback | AsyncCallback
\<
number
\>
| 是 | 获取通知通道数回调函数。 |
| callback | AsyncCallback
\<
number
\>
| 是 | 获取通知通道数
量
回调函数。 |
**示例:**
**示例:**
...
@@ -1485,7 +1485,7 @@ Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
...
@@ -1485,7 +1485,7 @@ Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
getSlotNumByBundle(bundle: BundleOption): Promise
\<
number
\>
getSlotNumByBundle(bundle: BundleOption): Promise
\<
number
\>
获取指定
包的通知通道数
(Promise形式)。
获取指定
应用的通知通道数量
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1497,13 +1497,13 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
...
@@ -1497,13 +1497,13 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise
\<
number
\>
| 以Promise形式返回获取指定
包的通知通道数
。 |
| Promise
\<
number
\>
| 以Promise形式返回获取指定
应用的通知通道数量
。 |
**示例:**
**示例:**
...
@@ -1512,7 +1512,7 @@ var bundle = {
...
@@ -1512,7 +1512,7 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
getSlotNumByBundle
(
bundle
).
then
((
data
)
=>
{
Notification
.
getSlotNumByBundle
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
getSlotNumByBundle sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getSlotNumByBundle suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1534,7 +1534,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
...
@@ -1534,7 +1534,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ----------------------------------| ---- | -------------------- |
| --------------- | ----------------------------------| ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
...
@@ -1578,7 +1578,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
...
@@ -1578,7 +1578,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | --------------- | ---- | ---------- |
| --------------- | --------------- | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
...
@@ -1594,7 +1594,7 @@ var notificationKey = {
...
@@ -1594,7 +1594,7 @@ var notificationKey = {
}
}
var
reason
=
Notification
.
RemoveReason
.
CLICK_REASON_REMOVE
;
var
reason
=
Notification
.
RemoveReason
.
CLICK_REASON_REMOVE
;
Notification
.
remove
(
bundle
,
notificationKey
,
reason
).
then
(()
=>
{
Notification
.
remove
(
bundle
,
notificationKey
,
reason
).
then
(()
=>
{
console
.
info
(
"
remove sucess
"
);
console
.
info
(
"
remove suc
c
ess
"
);
});
});
```
```
...
@@ -1616,7 +1616,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
...
@@ -1616,7 +1616,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| -------- | --------------------- | ---- | -------------------- |
| hashCode | string | 是 | 通知唯一ID。
|
| hashCode | string | 是 | 通知唯一ID。
可以通过
[
onConsume
](
#onconsume
)
回调的入参
[
SubscribeCallbackData
](
#subscribecallbackdata
)
获取其内部
[
NotificationRequest
](
#notificationrequest
)
对象中的hashCode。
|
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| reason |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
...
@@ -1663,7 +1663,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
...
@@ -1663,7 +1663,7 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
var
hashCode
=
'
hashCode
'
var
hashCode
=
'
hashCode
'
var
reason
=
Notification
.
RemoveReason
.
CLICK_REASON_REMOVE
;
var
reason
=
Notification
.
RemoveReason
.
CLICK_REASON_REMOVE
;
Notification
.
remove
(
hashCode
,
reason
).
then
(()
=>
{
Notification
.
remove
(
hashCode
,
reason
).
then
(()
=>
{
console
.
info
(
"
remove sucess
"
);
console
.
info
(
"
remove suc
c
ess
"
);
});
});
```
```
...
@@ -1673,7 +1673,7 @@ Notification.remove(hashCode, reason).then(() => {
...
@@ -1673,7 +1673,7 @@ Notification.remove(hashCode, reason).then(() => {
removeAll(bundle: BundleOption, callback: AsyncCallback
\<
void
\>
): void
removeAll(bundle: BundleOption, callback: AsyncCallback
\<
void
\>
): void
删除指定
包
的所有通知(Callback形式)。
删除指定
应用
的所有通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1685,8 +1685,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
...
@@ -1685,8 +1685,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------- |
| -------- | --------------------- | ---- | ---------------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定
应用的
包信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定
包
的所有通知回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定
应用
的所有通知回调函数。 |
**示例:**
**示例:**
...
@@ -1744,7 +1744,7 @@ Notification.removeAll(removeAllCallback);
...
@@ -1744,7 +1744,7 @@ Notification.removeAll(removeAllCallback);
removeAll(bundle?: BundleOption): Promise
\<
void
\>
removeAll(bundle?: BundleOption): Promise
\<
void
\>
删除所有通知(Promise形式)。
删除
指定应用的
所有通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1756,13 +1756,14 @@ removeAll(bundle?: BundleOption): Promise\<void\>
...
@@ -1756,13 +1756,14 @@ removeAll(bundle?: BundleOption): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 否 | 指定包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 否 | 指定
应用的
包信息。 |
**示例:**
**示例:**
```
js
```
js
// 不指定应用时,删除所有通知
Notification
.
removeAll
().
then
(()
=>
{
Notification
.
removeAll
().
then
(()
=>
{
console
.
info
(
"
removeAll sucess
"
);
console
.
info
(
"
removeAll suc
c
ess
"
);
});
});
```
```
...
@@ -1770,7 +1771,7 @@ Notification.removeAll().then(() => {
...
@@ -1770,7 +1771,7 @@ Notification.removeAll().then(() => {
removeAll(userId: number, callback: AsyncCallback
\<
void>): void
removeAll(userId: number, callback: AsyncCallback
\<
void>): void
删除所有通知(callback形式)。
删除
指定用户下的
所有通知(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1782,8 +1783,8 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void
...
@@ -1782,8 +1783,8 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除所有通知回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除
指定用户
所有通知回调函数。 |
**示例:**
**示例:**
...
@@ -1797,7 +1798,6 @@ function removeAllCallback(err) {
...
@@ -1797,7 +1798,6 @@ function removeAllCallback(err) {
}
}
var
userId
=
1
var
userId
=
1
Notification
.
removeAll
(
userId
,
removeAllCallback
);
Notification
.
removeAll
(
userId
,
removeAllCallback
);
```
```
...
@@ -1805,7 +1805,7 @@ Notification.removeAll(userId, removeAllCallback);
...
@@ -1805,7 +1805,7 @@ Notification.removeAll(userId, removeAllCallback);
removeAll(userId: number): Promise
\<
void>
removeAll(userId: number): Promise
\<
void>
删除所有通知(Promise形式)。
删除
指定用户下的
所有通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1817,22 +1817,15 @@ removeAll(userId: number): Promise\<void>
...
@@ -1817,22 +1817,15 @@ removeAll(userId: number): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| ------ | ------------ | ---- | ---------- |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
**示例:**
**示例:**
```
js
```
js
function
removeAllCallback
(
err
)
{
if
(
err
.
code
)
{
console
.
info
(
"
removeAll failed
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
"
removeAll success
"
);
}
}
var
userId
=
1
var
userId
=
1
Notification
.
removeAll
(
userId
).
then
(()
=>
{
Notification
.
removeAll
(
userId
,
removeAllCallback
);
console
.
info
(
"
removeAll success
"
);
});
```
```
...
@@ -1840,7 +1833,7 @@ Notification.removeAll(userId, removeAllCallback);
...
@@ -1840,7 +1833,7 @@ Notification.removeAll(userId, removeAllCallback);
getAllActiveNotifications(callback: AsyncCallback
<Array
\<
NotificationRequest
\
>
>): void
getAllActiveNotifications(callback: AsyncCallback
<Array
\<
NotificationRequest
\
>
>): void
获取
活动
通知(Callback形式)。
获取
当前未删除的所有
通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1874,7 +1867,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
...
@@ -1874,7 +1867,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
getAllActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
getAllActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
获取
活动
通知(Promise形式)。
获取
当前未删除的所有
通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1892,7 +1885,7 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification
...
@@ -1892,7 +1885,7 @@ getAllActiveNotifications(): Promise\<Array\<[NotificationRequest](#notification
```
js
```
js
Notification
.
getAllActiveNotifications
().
then
((
data
)
=>
{
Notification
.
getAllActiveNotifications
().
then
((
data
)
=>
{
console
.
info
(
"
getAllActiveNotifications sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getAllActiveNotifications suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1902,7 +1895,7 @@ Notification.getAllActiveNotifications().then((data) => {
...
@@ -1902,7 +1895,7 @@ Notification.getAllActiveNotifications().then((data) => {
getActiveNotificationCount(callback: AsyncCallback
\<
number
\>
): void
getActiveNotificationCount(callback: AsyncCallback
\<
number
\>
): void
获取当前应用
的活动
通知数(Callback形式)。
获取当前应用
未删除的
通知数(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1910,7 +1903,7 @@ getActiveNotificationCount(callback: AsyncCallback\<number\>): void
...
@@ -1910,7 +1903,7 @@ getActiveNotificationCount(callback: AsyncCallback\<number\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---------------------- |
| -------- | ---------------------- | ---- | ---------------------- |
| callback | AsyncCallback
\<
number
\>
| 是 | 获取
活动
通知数回调函数。 |
| callback | AsyncCallback
\<
number
\>
| 是 | 获取
未删除
通知数回调函数。 |
**示例:**
**示例:**
...
@@ -1932,21 +1925,21 @@ Notification.getActiveNotificationCount(getActiveNotificationCountCallback);
...
@@ -1932,21 +1925,21 @@ Notification.getActiveNotificationCount(getActiveNotificationCountCallback);
getActiveNotificationCount(): Promise
\<
number
\>
getActiveNotificationCount(): Promise
\<
number
\>
获取当前应用
的活动
通知数(Promise形式)。
获取当前应用
未删除的
通知数(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| -----------------
------------------------------------------ | -----------------
------------------------------------------- |
| -----------------
|
------------------------------------------- |
| Promise
\<
number
\>
| 以Promise形式返回获取当前应用
的活动
通知数。 |
| Promise
\<
number
\>
| 以Promise形式返回获取当前应用
未删除
通知数。 |
**示例:**
**示例:**
```
js
```
js
Notification
.
getActiveNotificationCount
().
then
((
data
)
=>
{
Notification
.
getActiveNotificationCount
().
then
((
data
)
=>
{
console
.
info
(
"
getActiveNotificationCount sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getActiveNotificationCount suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -1956,7 +1949,7 @@ Notification.getActiveNotificationCount().then((data) => {
...
@@ -1956,7 +1949,7 @@ Notification.getActiveNotificationCount().then((data) => {
getActiveNotifications(callback: AsyncCallback
<Array
\<
NotificationRequest
\
>
>): void
getActiveNotifications(callback: AsyncCallback
<Array
\<
NotificationRequest
\
>
>): void
获取当前应用
的活动通知
(Callback形式)。
获取当前应用
未删除的通知列表
(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -1964,7 +1957,7 @@ getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): v
...
@@ -1964,7 +1957,7 @@ getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): v
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
| callback | AsyncCallback
<Array
\<[
NotificationRequest
](
#notificationrequest
)\
>
> | 是 | 获取当前应用
的活动通知
回调函数。 |
| callback | AsyncCallback
<Array
\<[
NotificationRequest
](
#notificationrequest
)\
>
> | 是 | 获取当前应用
通知列表
回调函数。 |
**示例:**
**示例:**
...
@@ -1986,21 +1979,21 @@ Notification.getActiveNotifications(getActiveNotificationsCallback);
...
@@ -1986,21 +1979,21 @@ Notification.getActiveNotifications(getActiveNotificationsCallback);
getActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
getActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
获取当前应用
的活动通知
(Promise形式)。
获取当前应用
未删除的通知列表
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| -----------------------------------------------------------
| ---------------------
--------------------------------------- |
| -----------------------------------------------------------
- |
--------------------------------------- |
| Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
| 以Promise形式返回获取当前应用
的活动通知
。 |
| Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
| 以Promise形式返回获取当前应用
通知列表
。 |
**示例:**
**示例:**
```
js
```
js
Notification
.
getActiveNotifications
().
then
((
data
)
=>
{
Notification
.
getActiveNotifications
().
then
((
data
)
=>
{
console
.
info
(
"
removeGroupByBundle sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
removeGroupByBundle suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2010,7 +2003,7 @@ Notification.getActiveNotifications().then((data) => {
...
@@ -2010,7 +2003,7 @@ Notification.getActiveNotifications().then((data) => {
cancelGroup(groupName: string, callback: AsyncCallback
\<
void
\>
): void
cancelGroup(groupName: string, callback: AsyncCallback
\<
void
\>
): void
取消本应用指定组通知(Callback形式)。
取消本应用指定组
下的
通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2018,8 +2011,8 @@ cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
...
@@ -2018,8 +2011,8 @@ cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- |
| --------- | --------------------- | ---- | ---------------------------- |
| groupName | string | 是 |
指定通知组名称。
|
| groupName | string | 是 |
通知组名称,此名称需要在发布通知时通过
[
NotificationRequest
](
#notificationrequest
)
对象指定。
|
| callback | AsyncCallback
\<
void
\>
| 是 | 取消本应用指定组
通知
回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 取消本应用指定组
下通知的
回调函数。 |
**示例:**
**示例:**
...
@@ -2043,7 +2036,7 @@ Notification.cancelGroup(groupName, cancelGroupCallback);
...
@@ -2043,7 +2036,7 @@ Notification.cancelGroup(groupName, cancelGroupCallback);
cancelGroup(groupName: string): Promise
\<
void
\>
cancelGroup(groupName: string): Promise
\<
void
\>
取消本应用指定组通知(Promise形式)。
取消本应用指定组
下的
通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2051,14 +2044,14 @@ cancelGroup(groupName: string): Promise\<void\>
...
@@ -2051,14 +2044,14 @@ cancelGroup(groupName: string): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | -------------- |
| --------- | ------ | ---- | -------------- |
| groupName | string | 是 |
指定
通知组名称。 |
| groupName | string | 是 | 通知组名称。 |
**示例:**
**示例:**
```
js
```
js
var
groupName
=
"
GroupName
"
;
var
groupName
=
"
GroupName
"
;
Notification
.
cancelGroup
(
groupName
).
then
(()
=>
{
Notification
.
cancelGroup
(
groupName
).
then
(()
=>
{
console
.
info
(
"
cancelGroup sucess
"
);
console
.
info
(
"
cancelGroup suc
c
ess
"
);
});
});
```
```
...
@@ -2068,7 +2061,7 @@ Notification.cancelGroup(groupName).then(() => {
...
@@ -2068,7 +2061,7 @@ Notification.cancelGroup(groupName).then(() => {
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback
\<
void
\>
): void
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback
\<
void
\>
): void
删除指定应用
指定组
通知(Callback形式)。
删除指定应用
的指定组下的
通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2080,9 +2073,9 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
...
@@ -2080,9 +2073,9 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- |
| --------- | --------------------- | ---- | ---------------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| groupName | string | 是 |
指定
通知组名称。 |
| groupName | string | 是 | 通知组名称。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除
本应用指定组通知
回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除
指定应用指定组下通知的
回调函数。 |
**示例:**
**示例:**
...
@@ -2107,7 +2100,7 @@ Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCal
...
@@ -2107,7 +2100,7 @@ Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCal
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise
\<
void
\>
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise
\<
void
\>
删除指定应用
指定组
通知(Promise形式)。
删除指定应用
的指定组下的
通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2119,8 +2112,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
...
@@ -2119,8 +2112,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------ | ---- | -------------- |
| --------- | ------------ | ---- | -------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| groupName | string | 是 |
指定
通知组名称。 |
| groupName | string | 是 | 通知组名称。 |
**示例:**
**示例:**
...
@@ -2128,7 +2121,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
...
@@ -2128,7 +2121,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
var
bundleOption
=
{
bundle
:
"
Bundle
"
};
var
bundleOption
=
{
bundle
:
"
Bundle
"
};
var
groupName
=
"
GroupName
"
;
var
groupName
=
"
GroupName
"
;
Notification
.
removeGroupByBundle
(
bundleOption
,
groupName
).
then
(()
=>
{
Notification
.
removeGroupByBundle
(
bundleOption
,
groupName
).
then
(()
=>
{
console
.
info
(
"
removeGroupByBundle sucess
"
);
console
.
info
(
"
removeGroupByBundle suc
c
ess
"
);
});
});
```
```
...
@@ -2179,7 +2172,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
...
@@ -2179,7 +2172,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
setDoNotDisturbDate(date: DoNotDisturbDate): Promise
\<
void
\>
setDoNotDisturbDate(date: DoNotDisturbDate): Promise
\<
void
\>
设置免打扰时间
接口
(Promise形式)。
设置免打扰时间(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2202,7 +2195,7 @@ var doNotDisturbDate = {
...
@@ -2202,7 +2195,7 @@ var doNotDisturbDate = {
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
}
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
).
then
(()
=>
{
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
).
then
(()
=>
{
console
.
info
(
"
setDoNotDisturbDate sucess
"
);
console
.
info
(
"
setDoNotDisturbDate suc
c
ess
"
);
});
});
```
```
...
@@ -2224,7 +2217,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
...
@@ -2224,7 +2217,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------- |
| -------- | --------------------- | ---- | ---------------------- |
| date |
[
DoNotDisturbDate
](
#donotdisturbdate8
)
| 是 | 免打扰时间选项。 |
| date |
[
DoNotDisturbDate
](
#donotdisturbdate8
)
| 是 | 免打扰时间选项。 |
| userId | number | 是 | 设置免打扰
事件
的用户ID。 |
| userId | number | 是 | 设置免打扰
时间
的用户ID。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置免打扰时间回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置免打扰时间回调函数。 |
**示例:**
**示例:**
...
@@ -2245,7 +2238,6 @@ var doNotDisturbDate = {
...
@@ -2245,7 +2238,6 @@ var doNotDisturbDate = {
}
}
var
userId
=
1
var
userId
=
1
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
,
setDoNotDisturbDateCallback
);
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
,
setDoNotDisturbDateCallback
);
```
```
...
@@ -2255,7 +2247,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCa
...
@@ -2255,7 +2247,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCa
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise
\<
void
\>
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise
\<
void
\>
指定用户设置免打扰时间
接口
(Promise形式)。
指定用户设置免打扰时间(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2268,7 +2260,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
...
@@ -2268,7 +2260,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ---------------- | ---- | -------------- |
| ------ | ---------------- | ---- | -------------- |
| date |
[
DoNotDisturbDate
](
#donotdisturbdate8
)
| 是 | 免打扰时间选项。 |
| date |
[
DoNotDisturbDate
](
#donotdisturbdate8
)
| 是 | 免打扰时间选项。 |
| userId | number | 是 | 设置免打扰
事件
的用户ID。 |
| userId | number | 是 | 设置免打扰
时间
的用户ID。 |
**示例:**
**示例:**
...
@@ -2282,7 +2274,7 @@ var doNotDisturbDate = {
...
@@ -2282,7 +2274,7 @@ var doNotDisturbDate = {
var
userId
=
1
var
userId
=
1
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
).
then
(()
=>
{
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
).
then
(()
=>
{
console
.
info
(
"
setDoNotDisturbDate sucess
"
);
console
.
info
(
"
setDoNotDisturbDate suc
c
ess
"
);
});
});
```
```
...
@@ -2291,7 +2283,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
...
@@ -2291,7 +2283,7 @@ Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
getDoNotDisturbDate(callback: AsyncCallback
\<
DoNotDisturbDate
\>
): void
getDoNotDisturbDate(callback: AsyncCallback
\<
DoNotDisturbDate
\>
): void
查询免打扰时间
接口
(Callback形式)。
查询免打扰时间(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2308,7 +2300,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
...
@@ -2308,7 +2300,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
**示例:**
**示例:**
```
js
```
js
function
getDoNotDisturbDateCallback
(
err
,
data
)
{
function
getDoNotDisturbDateCallback
(
err
,
data
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
getDoNotDisturbDate failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
getDoNotDisturbDate failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
...
@@ -2325,7 +2317,7 @@ Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback);
...
@@ -2325,7 +2317,7 @@ Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback);
getDoNotDisturbDate(): Promise
\<
DoNotDisturbDate
\>
getDoNotDisturbDate(): Promise
\<
DoNotDisturbDate
\>
查询免打扰时间
接口
(Promise形式)。
查询免打扰时间(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2336,14 +2328,14 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
...
@@ -2336,14 +2328,14 @@ getDoNotDisturbDate(): Promise\<DoNotDisturbDate\>
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| -------------------------------------------------
---------- | -------------------
----------------------------------------- |
| -------------------------------------------------
|
----------------------------------------- |
| Promise
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 以Promise形式返回获取查询
免打扰时间接口
。 |
| Promise
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 以Promise形式返回获取查询
到的免打扰时间
。 |
**示例:**
**示例:**
```
js
```
js
Notification
.
getDoNotDisturbDate
().
then
((
data
)
=>
{
Notification
.
getDoNotDisturbDate
().
then
((
data
)
=>
{
console
.
info
(
"
getDoNotDisturbDate sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getDoNotDisturbDate suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2352,7 +2344,7 @@ Notification.getDoNotDisturbDate().then((data) => {
...
@@ -2352,7 +2344,7 @@ Notification.getDoNotDisturbDate().then((data) => {
getDoNotDisturbDate(userId: number, callback: AsyncCallback
\<
DoNotDisturbDate
\>
): void
getDoNotDisturbDate(userId: number, callback: AsyncCallback
\<
DoNotDisturbDate
\>
): void
指定用户查询免打扰时间接口
(Callback形式)。
查询指定用户的免打扰时间
(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2365,7 +2357,7 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
...
@@ -2365,7 +2357,7 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ---------------------- |
| -------- | --------------------------------- | ---- | ---------------------- |
| callback | AsyncCallback
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 是 | 查询免打扰时间回调函数。 |
| callback | AsyncCallback
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 是 | 查询免打扰时间回调函数。 |
| userId | number | 是 |
设置免打扰事件的
用户ID。 |
| userId | number | 是 | 用户ID。 |
**示例:**
**示例:**
...
@@ -2389,7 +2381,7 @@ Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
...
@@ -2389,7 +2381,7 @@ Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
getDoNotDisturbDate(userId: number): Promise
\<
DoNotDisturbDate
\>
getDoNotDisturbDate(userId: number): Promise
\<
DoNotDisturbDate
\>
指定用户查询免打扰时间接口
(Promise形式)。
查询指定用户的免打扰时间
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2401,13 +2393,13 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
...
@@ -2401,13 +2393,13 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ---------------------- |
| -------- | --------------------------------- | ---- | ---------------------- |
| userId | number | 是 |
设置免打扰事件的
用户ID。 |
| userId | number | 是 | 用户ID。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| -------------------------------------------------
---------- | -------------------
----------------------------------------- |
| -------------------------------------------------
|
----------------------------------------- |
| Promise
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 以Promise形式返回获取查询
免打扰时间接口
。 |
| Promise
\<
[
DoNotDisturbDate
](
#donotdisturbdate8
)
\>
| 以Promise形式返回获取查询
到的免打扰时间
。 |
**示例:**
**示例:**
...
@@ -2415,7 +2407,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
...
@@ -2415,7 +2407,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
var
userId
=
1
var
userId
=
1
Notification
.
getDoNotDisturbDate
(
userId
).
then
((
data
)
=>
{
Notification
.
getDoNotDisturbDate
(
userId
).
then
((
data
)
=>
{
console
.
info
(
"
getDoNotDisturbDate sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getDoNotDisturbDate suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2424,7 +2416,7 @@ Notification.getDoNotDisturbDate(userId).then((data) => {
...
@@ -2424,7 +2416,7 @@ Notification.getDoNotDisturbDate(userId).then((data) => {
supportDoNotDisturbMode(callback: AsyncCallback
\<
boolean
\>
): void
supportDoNotDisturbMode(callback: AsyncCallback
\<
boolean
\>
): void
查询是否支持
勿扰模式
功能(Callback形式)。
查询是否支持
免打扰
功能(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2436,7 +2428,7 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
...
@@ -2436,7 +2428,7 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------------- |
| -------- | ------------------------ | ---- | -------------------------------- |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 查询是否支持
勿扰模式
功能回调函数。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 查询是否支持
免打扰
功能回调函数。 |
**示例:**
**示例:**
...
@@ -2458,7 +2450,7 @@ Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback);
...
@@ -2458,7 +2450,7 @@ Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback);
supportDoNotDisturbMode(): Promise
\<
boolean
\>
supportDoNotDisturbMode(): Promise
\<
boolean
\>
查询是否支持
勿扰模式
功能(Promise形式)。
查询是否支持
免打扰
功能(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2470,13 +2462,13 @@ supportDoNotDisturbMode(): Promise\<boolean\>
...
@@ -2470,13 +2462,13 @@ supportDoNotDisturbMode(): Promise\<boolean\>
| 类型 | 说明 |
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise
\<
boolean
\>
| 以Promise形式返回获取是否支持
勿扰模式
功能的结果。 |
| Promise
\<
boolean
\>
| 以Promise形式返回获取是否支持
免打扰
功能的结果。 |
**示例:**
**示例:**
```
js
```
js
Notification
.
supportDoNotDisturbMode
().
then
((
data
)
=>
{
Notification
.
supportDoNotDisturbMode
().
then
((
data
)
=>
{
console
.
info
(
"
supportDoNotDisturbMode sucess, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
supportDoNotDisturbMode suc
c
ess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2567,7 +2559,7 @@ function requestEnableNotificationCallback(err) {
...
@@ -2567,7 +2559,7 @@ function requestEnableNotificationCallback(err) {
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
requestEnableNotification failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
requestEnableNotification failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
console
.
info
(
"
requestEnableNotification success
"
);
}
}
};
};
...
@@ -2587,10 +2579,9 @@ requestEnableNotification(): Promise\<void\>
...
@@ -2587,10 +2579,9 @@ requestEnableNotification(): Promise\<void\>
**示例:**
**示例:**
```
javascript
```
javascript
Notification
.
requestEnableNotification
()
Notification
.
requestEnableNotification
().
then
(()
=>
{
.
then
(()
=>
{
console
.
info
(
"
requestEnableNotification success
"
);
console
.
info
(
"
requestEnableNotification sucess
"
);
});
});
```
```
...
@@ -2610,7 +2601,7 @@ enableDistributed(enable: boolean, callback: AsyncCallback\<void\>): void
...
@@ -2610,7 +2601,7 @@ enableDistributed(enable: boolean, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| -------- | ------------------------ | ---- | -------------------------- |
| enable | boolean | 是 | 是否支持。
<br/>
true 支持。
<br/>
false 不支持。
|
| enable | boolean | 是 | 是否支持。
|
| callback | AsyncCallback
\<
void
\>
| 是 | 设置设备是否支持分布式通知的回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置设备是否支持分布式通知的回调函数。 |
**示例:**
**示例:**
...
@@ -2647,17 +2638,15 @@ enableDistributed(enable: boolean): Promise\<void>
...
@@ -2647,17 +2638,15 @@ enableDistributed(enable: boolean): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| -------- | ------------------------ | ---- | -------------------------- |
| enable | boolean | 是 | 是否支持。
<br/>
true 支持。
<br/>
false 不支持。
|
| enable | boolean | 是 | 是否支持。
|
**示例:**
**示例:**
```
javascript
```
javascript
var
enable
=
true
var
enable
=
true
Notification
.
enableDistributed
(
enable
).
then
(()
=>
{
Notification
.
enableDistributed
(
enable
)
console
.
info
(
"
enableDistributed success
"
);
.
then
(()
=>
{
});
console
.
info
(
"
enableDistributed sucess
"
);
});
```
```
...
@@ -2665,7 +2654,7 @@ Notification.enableDistributed(enable)
...
@@ -2665,7 +2654,7 @@ Notification.enableDistributed(enable)
isDistributedEnabled(callback: AsyncCallback
\<
boolean>): void
isDistributedEnabled(callback: AsyncCallback
\<
boolean>): void
获取
设备是否支持分布式通知(Callback形式)。
查询
设备是否支持分布式通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2695,23 +2684,22 @@ Notification.isDistributedEnabled(isDistributedEnabledCallback);
...
@@ -2695,23 +2684,22 @@ Notification.isDistributedEnabled(isDistributedEnabledCallback);
isDistributedEnabled(): Promise
\<
boolean>
isDistributedEnabled(): Promise
\<
boolean>
获取
设备是否支持分布式通知(Promise形式)。
查询
设备是否支持分布式通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------ | --------------- |
| ------------------ | ---------------
------------------------------
|
| Promise
\<
boolean
\>
| Promise方式返回设备是否支持分布式通知的结果。
<br/>
true 支持。
<br/>
false 不支持。
|
| Promise
\<
boolean
\>
| Promise方式返回设备是否支持分布式通知的结果。 |
**示例:**
**示例:**
```
javascript
```
javascript
Notification
.
isDistributedEnabled
()
Notification
.
isDistributedEnabled
().
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
"
isDistributedEnabled success, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isDistributedEnabled sucess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2719,7 +2707,7 @@ Notification.isDistributedEnabled()
...
@@ -2719,7 +2707,7 @@ Notification.isDistributedEnabled()
enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void>): void
enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void>): void
根据应用的包设置应用程序
是否支持分布式通知(Callback形式)。
设置指定应用
是否支持分布式通知(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2731,7 +2719,7 @@ enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: Async
...
@@ -2731,7 +2719,7 @@ enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: Async
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 应用的包
。
|
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 应用的包
信息。
|
| enable | boolean | 是 | 是否支持。 |
| enable | boolean | 是 | 是否支持。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 应用程序是否支持分布式通知的回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 应用程序是否支持分布式通知的回调函数。 |
...
@@ -2761,7 +2749,7 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle
...
@@ -2761,7 +2749,7 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle
enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise
\<
void>
enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise
\<
void>
根据应用的包设置应用程序
是否支持分布式通知(Promise形式)。
设置指定应用
是否支持分布式通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2784,11 +2772,9 @@ var bundle = {
...
@@ -2784,11 +2772,9 @@ var bundle = {
}
}
var
enable
=
true
var
enable
=
true
Notification
.
enableDistributedByBundle
(
bundle
,
enable
).
then
(()
=>
{
Notification
.
enableDistributedByBundle
(
bundle
,
enable
)
console
.
info
(
"
enableDistributedByBundle success
"
);
.
then
(()
=>
{
});
console
.
info
(
"
enableDistributedByBundle sucess
"
);
});
```
```
## Notification.isDistributedEnabledByBundle<sup>8+</sup>
## Notification.isDistributedEnabledByBundle<sup>8+</sup>
...
@@ -2808,7 +2794,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
...
@@ -2808,7 +2794,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 应用的包。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 应用的包。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
应用程序
是否支持分布式通知的回调函数。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
查询指定应用
是否支持分布式通知的回调函数。 |
**示例:**
**示例:**
...
@@ -2834,7 +2820,7 @@ Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCa
...
@@ -2834,7 +2820,7 @@ Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCa
isDistributedEnabledByBundle(bundle: BundleOption): Promise
\<
boolean>
isDistributedEnabledByBundle(bundle: BundleOption): Promise
\<
boolean>
根据应用的包获取应用程序
是否支持分布式通知(Promise形式)。
查询指定应用
是否支持分布式通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -2851,8 +2837,8 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
...
@@ -2851,8 +2837,8 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------ | --------------- |
| ------------------ | ---------------
----------------------------------
|
| Promise
\<
boolean
\>
| Promise方式返回
应用程序是否支持分布式通知的结果。
<br/>
true 支持。
<br/>
false 不支持
。 |
| Promise
\<
boolean
\>
| Promise方式返回
指定应用是否支持分布式通知的结果
。 |
**示例:**
**示例:**
...
@@ -2861,10 +2847,9 @@ var bundle = {
...
@@ -2861,10 +2847,9 @@ var bundle = {
bundle
:
"
bundleName1
"
,
bundle
:
"
bundleName1
"
,
}
}
Notification
.
isDistributedEnabledByBundle
(
bundle
)
Notification
.
isDistributedEnabledByBundle
(
bundle
).
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
"
isDistributedEnabledByBundle success, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isDistributedEnabledByBundle sucess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2884,7 +2869,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
...
@@ -2884,7 +2869,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------------- |
| -------- | --------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback
\<
[
DeviceRemindType
](
#deviceremindtype8
)
\>
| 是 | 获取通知
的
提醒方式的回调函数。 |
| callback | AsyncCallback
\<
[
DeviceRemindType
](
#deviceremindtype8
)
\>
| 是 | 获取通知提醒方式的回调函数。 |
**示例:**
**示例:**
...
@@ -2918,15 +2903,14 @@ getDeviceRemindType(): Promise\<DeviceRemindType\>
...
@@ -2918,15 +2903,14 @@ getDeviceRemindType(): Promise\<DeviceRemindType\>
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------ | --------------- |
| ------------------ | --------------- |
| Promise
\<
[
DeviceRemindType
](
#deviceremindtype8
)
\>
| Promise方式返回
通知的
提醒方式的结果。 |
| Promise
\<
[
DeviceRemindType
](
#deviceremindtype8
)
\>
| Promise方式返回
获取通知
提醒方式的结果。 |
**示例:**
**示例:**
```
javascript
```
javascript
Notification
.
getDeviceRemindType
()
Notification
.
getDeviceRemindType
().
then
((
data
)
=>
{
.
then
((
data
)
=>
{
console
.
info
(
"
getDeviceRemindType success, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
getDeviceRemindType sucess, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -2945,17 +2929,17 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
...
@@ -2945,17 +2929,17 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
**参数:**
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------------- | ---- | ----------------------------------------
-----
|
| -------------------- | ------------------------------------------- | ---- | ---------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 |
接收通知用户的Id。
|
| userId | number | 是 |
用户ID。
|
| callback | AsyncCallback | 是 | 发布代理通知的回调方法。 |
| callback | AsyncCallback | 是 | 发布代理通知的回调方法。 |
**示例:**
**示例:**
```
js
```
js
//publishAsBundle回调
//
publishAsBundle回调
function
publishAsBundleC
allback
(
err
)
{
function
c
allback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
publishAsBundle failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
publishAsBundle failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
...
@@ -2964,10 +2948,10 @@ function publishAsBundleCallback(err) {
...
@@ -2964,10 +2948,10 @@ function publishAsBundleCallback(err) {
}
}
// 被代理应用的包名
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
//
接收通知的
用户ID
// 用户ID
let
userId
=
100
let
userId
=
100
//
通知
Request对象
//
Notification
Request对象
let
notificationR
equest
=
{
let
r
equest
=
{
id
:
1
,
id
:
1
,
content
:
{
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
@@ -2979,7 +2963,7 @@ let notificationRequest = {
...
@@ -2979,7 +2963,7 @@ let notificationRequest = {
}
}
}
}
Notification
.
publishAsBundle
(
notificationRequest
,
representativeBundle
,
userId
,
publishAsBundleC
allback
);
Notification
.
publishAsBundle
(
request
,
representativeBundle
,
userId
,
c
allback
);
```
```
## Notification.publishAsBundle<sup>9+</sup>
## Notification.publishAsBundle<sup>9+</sup>
...
@@ -2999,19 +2983,19 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
...
@@ -2999,19 +2983,19 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
| -------------------- | ------------------------------------------- | ---- | --------------------------------------------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
设置要发布通知内容的NotificationRequest对象
。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 |
用于设置要发布通知的内容和相关配置信息
。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
**示例:**
**示例:**
```
js
```
js
// 被代理应用的包名
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
//
接收通知的
用户ID
// 用户ID
let
userId
=
100
let
userId
=
100
//
通知
Request对象
//
Notification
Request对象
var
notificationR
equest
=
{
var
r
equest
=
{
id
:
1
,
id
:
1
,
content
:
{
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
@@ -3023,8 +3007,8 @@ var notificationRequest = {
...
@@ -3023,8 +3007,8 @@ var notificationRequest = {
}
}
}
}
Notification
.
publishAsBundle
(
notificationR
equest
,
representativeBundle
,
userId
).
then
(()
=>
{
Notification
.
publishAsBundle
(
r
equest
,
representativeBundle
,
userId
).
then
(()
=>
{
console
.
info
(
"
publishAsBundle sucess
"
);
console
.
info
(
"
publishAsBundle suc
c
ess
"
);
});
});
```
```
...
@@ -3048,13 +3032,13 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
...
@@ -3048,13 +3032,13 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
| -------------------- | ------------- | ---- | ------------------------ |
| -------------------- | ------------- | ---- | ------------------------ |
| id | number | 是 | 通知ID。 |
| id | number | 是 | 通知ID。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
| callback | AsyncCallback | 是 | 取消代理通知的回调方法。 |
| callback | AsyncCallback | 是 | 取消代理通知的回调方法。 |
**示例:**
**示例:**
```
js
```
js
//cancelAsBundle
//
cancelAsBundle
function
cancelAsBundleCallback
(
err
)
{
function
cancelAsBundleCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
cancelAsBundle failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
cancelAsBundle failed
"
+
JSON
.
stringify
(
err
));
...
@@ -3064,7 +3048,7 @@ function cancelAsBundleCallback(err) {
...
@@ -3064,7 +3048,7 @@ function cancelAsBundleCallback(err) {
}
}
// 被代理应用的包名
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
//
接收通知的
用户ID
// 用户ID
let
userId
=
100
let
userId
=
100
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
,
cancelAsBundleCallback
);
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
,
cancelAsBundleCallback
);
...
@@ -3074,7 +3058,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb
...
@@ -3074,7 +3058,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallb
cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise
\<
void
\>
cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise
\<
void
\>
发布
代理通知(Promise形式)。
代理通知(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3090,14 +3074,14 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
...
@@ -3090,14 +3074,14 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
| -------------------- | ------ | ---- | ------------------ |
| -------------------- | ------ | ---- | ------------------ |
| id | number | 是 | 通知ID。 |
| id | number | 是 | 通知ID。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| representativeBundle | string | 是 | 被代理应用的包名。 |
| userId | number | 是 |
接收通知用户的Id
。 |
| userId | number | 是 |
用户ID
。 |
**示例:**
**示例:**
```
js
```
js
// 被代理应用的包名
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
//
接收通知的
用户ID
// 用户ID
let
userId
=
100
let
userId
=
100
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
).
then
(()
=>
{
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
).
then
(()
=>
{
...
@@ -3109,7 +3093,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
...
@@ -3109,7 +3093,7 @@ Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback
\<
void>): void
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback
\<
void>): void
设
定指定类型的渠道
使能状态(Callback形式)。
设
置指定应用的指定渠道类型的
使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3121,15 +3105,15 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, ca
...
@@ -3121,15 +3105,15 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean, ca
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- |
| -------- | ----------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 指定渠道类型。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 指定渠道类型。 |
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设
定
渠道使能回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设
置
渠道使能回调函数。 |
**示例:**
**示例:**
```
js
```
js
//enableNotificationSlot
//
enableNotificationSlot
function
enableSlotCallback
(
err
)
{
function
enableSlotCallback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
enableNotificationSlot failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
enableNotificationSlot failed
"
+
JSON
.
stringify
(
err
));
...
@@ -3149,7 +3133,7 @@ Notification.enableNotificationSlot(
...
@@ -3149,7 +3133,7 @@ Notification.enableNotificationSlot(
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise
\<
void>
enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise
\<
void>
设
定指定类型的渠道
使能状态(Promise形式)。
设
置指定应用的指定渠道类型的
使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3161,27 +3145,25 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): P
...
@@ -3161,27 +3145,25 @@ enableNotificationSlot(bundle: BundleOption, type: SlotType, enable: boolean): P
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 |
指定
渠道类型。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
| enable | boolean | 是 | 使能状态。 |
| enable | boolean | 是 | 使能状态。 |
**示例:**
**示例:**
```
js
```
js
//enableNotificationSlot
// enableNotificationSlot
Notification
.
enableNotificationSlot
(
Notification
.
enableNotificationSlot
({
bundle
:
"
ohos.samples.notification
"
,
},
{
bundle
:
"
ohos.samples.notification
"
,
},
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
,
true
).
then
(()
=>
{
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
,
console
.
info
(
"
enableNotificationSlot success
"
);
true
).
then
(()
=>
{
});
console
.
info
(
"
enableNotificationSlot sucess
"
);
});
```
```
## Notification.isNotificationSlotEnabled <sup>9+</sup>
## Notification.isNotificationSlotEnabled <sup>9+</sup>
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback
\<
boolean
\>
): void
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback
\<
boolean
\>
): void
获取指定
类型的渠道
使能状态(Callback形式)。
获取指定
应用的指定渠道类型的
使能状态(Callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3193,14 +3175,14 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
...
@@ -3193,14 +3175,14 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- |
| -------- | ----------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 |
指定
渠道类型。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
设定渠道使能
回调函数。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
获取渠道使能状态
回调函数。 |
**示例:**
**示例:**
```
js
```
js
//isNotificationSlotEnabled
//
isNotificationSlotEnabled
function
getEnableSlotCallback
(
err
,
data
)
{
function
getEnableSlotCallback
(
err
,
data
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
isNotificationSlotEnabled failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
isNotificationSlotEnabled failed
"
+
JSON
.
stringify
(
err
));
...
@@ -3219,7 +3201,7 @@ Notification.isNotificationSlotEnabled(
...
@@ -3219,7 +3201,7 @@ Notification.isNotificationSlotEnabled(
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise
\<
boolean
\>
isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise
\<
boolean
\>
获取指定
类型的渠道
使能状态(Promise形式)。
获取指定
应用的指定渠道类型的
使能状态(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3231,25 +3213,23 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea
...
@@ -3231,25 +3213,23 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
指定
包信息。 |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 |
应用的
包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 |
指定
渠道类型。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------
----------------------------------------- | -----------------------------
------------------------------- |
| ------------------
|
------------------------------- |
| Promise
\<
boolean
\>
| 以Promise形式返回
指定类型的
渠道使能状态。 |
| Promise
\<
boolean
\>
| 以Promise形式返回渠道使能状态。 |
**示例:**
**示例:**
```
js
```
js
//isNotificationSlotEnabled
// isNotificationSlotEnabled
Notification
.
isNotificationSlotEnabled
(
Notification
.
isNotificationSlotEnabled
({
bundle
:
"
ohos.samples.notification
"
,
},
{
bundle
:
"
ohos.samples.notification
"
,
},
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
((
data
)
=>
{
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
).
then
((
data
)
=>
{
console
.
info
(
"
isNotificationSlotEnabled success, data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
isNotificationSlotEnabled success, data:
"
+
JSON
.
stringify
(
data
));
});
});
```
```
...
@@ -3269,8 +3249,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
...
@@ -3269,8 +3249,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户I
d
。 |
| userId | number | 是 | 用户I
D
。 |
| enable | boolean | 是 | 是否启用。
<br>
true:启用。
<br>
false:禁用。
|
| enable | boolean | 是 | 是否启用。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置是否将通知同步到未安装应用程序的设备的回调函数。 |
**示例:**
**示例:**
...
@@ -3279,7 +3259,7 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
...
@@ -3279,7 +3259,7 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback:
let
userId
=
100
;
let
userId
=
100
;
let
enable
=
true
;
let
enable
=
true
;
function
setSyncNotificationEnabledWithoutAppC
allback
(
err
)
{
function
c
allback
(
err
)
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
info
(
"
setSyncNotificationEnabledWithoutApp failed
"
+
JSON
.
stringify
(
err
));
console
.
info
(
"
setSyncNotificationEnabledWithoutApp failed
"
+
JSON
.
stringify
(
err
));
}
else
{
}
else
{
...
@@ -3287,7 +3267,7 @@ function setSyncNotificationEnabledWithoutAppCallback(err) {
...
@@ -3287,7 +3267,7 @@ function setSyncNotificationEnabledWithoutAppCallback(err) {
}
}
}
}
Notification
.
setSyncNotificationEnabledWithoutApp
(
userId
,
enable
,
setSyncNotificationEnabledWithoutAppC
allback
);
Notification
.
setSyncNotificationEnabledWithoutApp
(
userId
,
enable
,
c
allback
);
```
```
...
@@ -3307,8 +3287,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
...
@@ -3307,8 +3287,8 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户I
d
。 |
| userId | number | 是 | 用户I
D
。 |
| enable | boolean | 是 | 是否启用。
<br>
true:启用。
<br>
false:禁用。
|
| enable | boolean | 是 | 是否启用。 |
**返回值:**
**返回值:**
...
@@ -3322,13 +3302,11 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
...
@@ -3322,13 +3302,11 @@ setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<
let
userId
=
100
;
let
userId
=
100
;
let
enable
=
true
;
let
enable
=
true
;
Notification
.
setSyncNotificationEnabledWithoutApp
(
userId
,
enable
)
Notification
.
setSyncNotificationEnabledWithoutApp
(
userId
,
enable
).
then
(()
=>
{
.
then
(()
=>
{
console
.
info
(
'
setSyncNotificationEnabledWithoutApp success
'
);
console
.
info
(
'
setSyncNotificationEnabledWithoutApp
'
);
}).
catch
((
err
)
=>
{
})
console
.
info
(
'
setSyncNotificationEnabledWithoutApp, err:
'
+
JSON
.
stringify
(
err
));
.
catch
((
err
)
=>
{
});
console
.
info
(
'
setSyncNotificationEnabledWithoutApp, err:
'
,
err
);
});
```
```
...
@@ -3336,7 +3314,7 @@ Notification.setSyncNotificationEnabledWithoutApp(userId, enable)
...
@@ -3336,7 +3314,7 @@ Notification.setSyncNotificationEnabledWithoutApp(userId, enable)
getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback
\<
boolean>): void
getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback
\<
boolean>): void
获取
是否同步通知到未安装应用程序的设备
(callback形式)。
获取
同步通知到未安装应用程序设备的开关是否开启
(callback形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3348,19 +3326,19 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo
...
@@ -3348,19 +3326,19 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户I
d
。 |
| userId | number | 是 | 用户I
D
。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
设置是否将通知同步到未安装应用程序的设备的回调函数。
<br>
true: 是。
<br>
false: 否
。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 |
获取同步通知到未安装应用程序设备的开关是否开启的回调函数
。 |
**示例:**
**示例:**
```
js
```
js
let
userId
=
100
;
let
userId
=
100
;
function
getSyncNotificationEnabledWithoutAppCallback
(
data
,
err
)
{
function
getSyncNotificationEnabledWithoutAppCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, err
'
+
err
);
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, err
:
'
+
err
);
}
else
{
}
else
{
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, data
'
+
data
);
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, data
:
'
+
data
);
}
}
}
}
...
@@ -3372,7 +3350,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEna
...
@@ -3372,7 +3350,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEna
getSyncNotificationEnabledWithoutApp(userId: number): Promise
\<
boolean>
getSyncNotificationEnabledWithoutApp(userId: number): Promise
\<
boolean>
获取
是否同步通知到未安装应用程序的设备
(Promise形式)。
获取
同步通知到未安装应用程序设备的开关是否开启
(Promise形式)。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3384,33 +3362,30 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
...
@@ -3384,33 +3362,30 @@ getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| ------ | ----------------------------- | ---- | -------------- |
| userId | number | 是 | 用户I
d
。 |
| userId | number | 是 | 用户I
D
。 |
**返回值:**
**返回值:**
| 类型 | 说明 |
| 类型 | 说明 |
| ------------------
-----------------------------------------
| ------------------------------------------------------------ |
| ------------------ | ------------------------------------------------------------ |
| Promise
\<
boolean
\>
| 以Promise形式返回获取
是否同步通知到未安装应用程序的设备的结果。
<br>
true: 是。
<br>
false: 否
。 |
| Promise
\<
boolean
\>
| 以Promise形式返回获取
同步通知到未安装应用程序设备的开关是否开启的结果
。 |
**示例:**
**示例:**
```
js
```
js
let
userId
=
100
;
let
userId
=
100
;
Notification
.
getSyncNotificationEnabledWithoutApp
(
userId
).
then
((
data
)
=>
{
Notification
.
getSyncNotificationEnabledWithoutApp
(
userId
)
console
.
info
(
'
getSyncNotificationEnabledWithoutApp, data:
'
+
data
);
.
then
((
data
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
'
getSyncNotificationEnabledWithoutApp, data:
'
,
data
);
console
.
info
(
'
getSyncNotificationEnabledWithoutApp, err:
'
+
err
);
})
});
.
catch
((
err
)
=>
{
console
.
info
(
'
getSyncNotificationEnabledWithoutApp, err:
'
,
err
);
});
```
```
## NotificationSubscriber
## NotificationSubscriber
提供订阅者接收到新通知或取消通知时
的回调方法。
作为订阅通知接口
[
subscribe
](
#notificationsubscribe
)
的入参,提供订阅者接收到新通知、取消通知等
的回调方法。
**系统API**
:此接口为系统接口,三方应用不支持调用。
**系统API**
:此接口为系统接口,三方应用不支持调用。
...
@@ -3418,7 +3393,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
...
@@ -3418,7 +3393,7 @@ Notification.getSyncNotificationEnabledWithoutApp(userId)
onConsume?: (data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
onConsume?: (data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
接收
通知
回调函数。
接收
到新通知的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3428,7 +3403,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
...
@@ -3428,7 +3403,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 |
回调返回
接收到的通知信息。 |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 |
新
接收到的通知信息。 |
**示例:**
**示例:**
...
@@ -3442,7 +3417,6 @@ function subscribeCallback(err) {
...
@@ -3442,7 +3417,6 @@ function subscribeCallback(err) {
};
};
function
onConsumeCallback
(
data
)
{
function
onConsumeCallback
(
data
)
{
console
.
info
(
'
===> onConsume in test
'
);
let
req
=
data
.
request
;
let
req
=
data
.
request
;
console
.
info
(
'
===> onConsume callback req.id:
'
+
req
.
id
);
console
.
info
(
'
===> onConsume callback req.id:
'
+
req
.
id
);
};
};
...
@@ -3458,7 +3432,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3458,7 +3432,7 @@ Notification.subscribe(subscriber, subscribeCallback);
onCancel?:(data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
onCancel?:(data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
删除通知
回调函数。
取消通知的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3468,7 +3442,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
...
@@ -3468,7 +3442,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 |
回调返回接收到
的通知信息。 |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 |
需要取消
的通知信息。 |
**示例:**
**示例:**
...
@@ -3482,7 +3456,6 @@ function subscribeCallback(err) {
...
@@ -3482,7 +3456,6 @@ function subscribeCallback(err) {
};
};
function
onCancelCallback
(
data
)
{
function
onCancelCallback
(
data
)
{
console
.
info
(
'
===> onCancel in test
'
);
let
req
=
data
.
request
;
let
req
=
data
.
request
;
console
.
info
(
'
===> onCancel callback req.id:
'
+
req
.
id
);
console
.
info
(
'
===> onCancel callback req.id:
'
+
req
.
id
);
}
}
...
@@ -3498,7 +3471,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3498,7 +3471,7 @@ Notification.subscribe(subscriber, subscribeCallback);
onUpdate?:(data:
[
NotificationSortingMap
](
#notificationsortingmap
)
) => void
onUpdate?:(data:
[
NotificationSortingMap
](
#notificationsortingmap
)
) => void
更新通知排序回调函数。
更新通知排序
的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3508,7 +3481,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
...
@@ -3508,7 +3481,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 |
回调返回接收到的通知信息
。 |
| data |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 |
最新的通知排序列表
。 |
**示例:**
**示例:**
...
@@ -3521,8 +3494,8 @@ function subscribeCallback(err) {
...
@@ -3521,8 +3494,8 @@ function subscribeCallback(err) {
}
}
};
};
function
onUpdateCallback
()
{
function
onUpdateCallback
(
map
)
{
console
.
info
(
'
===> onUpdate
in test
'
);
console
.
info
(
'
===> onUpdate
Callback map:
'
+
JSON
.
stringify
(
map
)
);
}
}
var
subscriber
=
{
var
subscriber
=
{
...
@@ -3536,7 +3509,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3536,7 +3509,7 @@ Notification.subscribe(subscriber, subscribeCallback);
onConnect?:() => void
onConnect?:() => void
注册订阅
回调函数。
订阅完成的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3568,7 +3541,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3568,7 +3541,7 @@ Notification.subscribe(subscriber, subscribeCallback);
onDisconnect?:() => void
onDisconnect?:() => void
取消订阅回调函数。
取消订阅
的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3584,16 +3557,30 @@ function subscribeCallback(err) {
...
@@ -3584,16 +3557,30 @@ function subscribeCallback(err) {
console
.
info
(
"
subscribeCallback
"
);
console
.
info
(
"
subscribeCallback
"
);
}
}
};
};
function
unsubscribeCallback
(
err
)
{
if
(
err
.
code
)
{
console
.
info
(
"
unsubscribe failed
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
info
(
"
unsubscribeCallback
"
);
}
};
function
onConnectCallback
()
{
console
.
info
(
'
===> onConnect in test
'
);
}
function
onDisconnectCallback
()
{
function
onDisconnectCallback
()
{
console
.
info
(
'
===> onDisconnect in test
'
);
console
.
info
(
'
===> onDisconnect in test
'
);
}
}
var
subscriber
=
{
var
subscriber
=
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
onDisconnect
:
onDisconnectCallback
};
};
// 订阅通知后会收到onConnect回调
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
// 取消订阅后会收到onDisconnect回调
Notification
.
unsubscribe
(
subscriber
,
unsubscribeCallback
);
```
```
### onDestroy
### onDestroy
...
@@ -3632,7 +3619,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3632,7 +3619,7 @@ Notification.subscribe(subscriber, subscribeCallback);
onDoNotDisturbDateChange?:(mode: notification.
[
DoNotDisturbDate
](
#donotdisturbdate8
)
) => void
onDoNotDisturbDateChange?:(mode: notification.
[
DoNotDisturbDate
](
#donotdisturbdate8
)
) => void
免打扰时间选项
变更
回调函数。
免打扰时间选项
发生变更时的
回调函数。
**系统能力**
:SystemCapability.Notification.Notification
**系统能力**
:SystemCapability.Notification.Notification
...
@@ -3654,15 +3641,24 @@ function subscribeCallback(err) {
...
@@ -3654,15 +3641,24 @@ function subscribeCallback(err) {
}
}
};
};
function
onDoNotDisturbDateChangeCallback
()
{
function
onDoNotDisturbDateChangeCallback
(
mode
)
{
console
.
info
(
'
===> onDoNotDisturbDateChange
in test
'
);
console
.
info
(
'
===> onDoNotDisturbDateChange
:
'
+
mode
);
}
}
var
subscriber
=
{
var
subscriber
=
{
onDoNotDisturbDateChange
:
onDoNotDisturbDateChangeCallback
onDoNotDisturbDateChange
:
onDoNotDisturbDateChangeCallback
};
};
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
var
doNotDisturbDate
=
{
type
:
Notification
.
DoNotDisturbType
.
TYPE_ONCE
,
begin
:
new
Date
(),
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
// 设置一个新的免打扰时间选项时触发onDoNotDisturbDateChange回调
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
).
then
(()
=>
{
console
.
info
(
"
setDoNotDisturbDate sucess
"
);
});
```
```
...
@@ -3694,16 +3690,23 @@ function subscribeCallback(err) {
...
@@ -3694,16 +3690,23 @@ function subscribeCallback(err) {
};
};
function
onEnabledNotificationChangedCallback
(
callbackData
)
{
function
onEnabledNotificationChangedCallback
(
callbackData
)
{
console
.
info
(
"
bundle:
"
,
callbackData
.
bundle
);
console
.
info
(
"
bundle:
"
+
callbackData
.
bundle
);
console
.
info
(
"
uid:
"
,
callbackData
.
uid
);
console
.
info
(
"
uid:
"
+
callbackData
.
uid
);
console
.
info
(
"
enable:
"
,
callbackData
.
enable
);
console
.
info
(
"
enable:
"
+
callbackData
.
enable
);
};
};
var
subscriber
=
{
var
subscriber
=
{
onEnabledNotificationChanged
:
onEnabledNotificationChangedCallback
onEnabledNotificationChanged
:
onEnabledNotificationChangedCallback
};
};
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
var
bundle
=
{
bundle
:
"
bundleName1
"
,
}
// 设置指定应用通知使能状态触发onEnabledNotificationChanged回调
Notification
.
enableNotification
(
bundle
,
false
).
then
(()
=>
{
console
.
info
(
"
enableNotification sucess
"
);
});
```
```
## SubscribeCallbackData
## SubscribeCallbackData
...
@@ -3715,7 +3718,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3715,7 +3718,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------- | ------------------------------------------------- | ---- | --- | -------- |
| --------------- | ------------------------------------------------- | ---- | --- | -------- |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 | 否 | 通知内容。 |
| request |
[
NotificationRequest
](
#notificationrequest
)
| 是 | 否 | 通知内容。 |
| sortingMap |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 | 否 | 排序信息。 |
| sortingMap |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 | 否 |
通知
排序信息。 |
| reason | number | 是 | 否 | 删除原因。 |
| reason | number | 是 | 否 | 删除原因。 |
| sound | string | 是 | 否 | 通知声音。 |
| sound | string | 是 | 否 | 通知声音。 |
| vibrationValues | Array
\<
number
\>
| 是 | 否 | 通知震动。 |
| vibrationValues | Array
\<
number
\>
| 是 | 否 | 通知震动。 |
...
@@ -3741,12 +3744,10 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3741,12 +3744,10 @@ Notification.subscribe(subscriber, subscribeCallback);
**系统API**
:此接口为系统接口,三方应用不支持调用。
**系统API**
:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- ------------------------------------- || ---- | --- | ------------------------ |
| ----- | -------------------------------------- | ---- | ---- | ---------------------- |
| type |
[
DoNotDisturbType
](
#donotdisturbtype8
)
| 是 | 否 | 指定免打扰设置的时间类型。 |
| type |
[
DoNotDisturbType
](
#donotdisturbtype8
)
| 是 | 是 | 免打扰设置的时间类型。 |
| begin | Date | 是 | 否 | 指定免打扰设置的起点时间。 |
| begin | Date | 是 | 是 | 免打扰设置的起点时间。 |
| end | Date | 是 | 否 | 指定免打扰设置的终点时间。 |
| end | Date | 是 | 是 | 免打扰设置的终点时间。 |
## DoNotDisturbType<sup>8+</sup>
## DoNotDisturbType<sup>8+</sup>
...
@@ -3793,8 +3794,8 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3793,8 +3794,8 @@ Notification.subscribe(subscriber, subscribeCallback);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ |---- | --- | ------ |
| ------ | ------ |---- | --- | ------ |
| bundle | string | 是 | 是 |
包名。
|
| bundle | string | 是 | 是 |
应用的包信息。
|
| uid | number | 是 | 是 | 用户
id
。 |
| uid | number | 是 | 是 | 用户
ID
。 |
...
@@ -3830,7 +3831,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3830,7 +3831,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------- | ----------------------------------------------- | --- | ---- | ------------------------- |
| --------- | ----------------------------------------------- | --- | ---- | ------------------------- |
| title | string | 是 | 是 | 按钮标题。 |
| title | string | 是 | 是 | 按钮标题。 |
| wantAgent |
WantAgent
| 是 | 是 | 点击按钮时触发的WantAgent。 |
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 是 | 点击按钮时触发的WantAgent。 |
| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 |
| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 |
| userInput
<sup>
8+
</sup>
|
[
NotificationUserInput
](
#notificationuserinput8
)
| 是 | 是 | 用户输入对象实例。 |
| userInput
<sup>
8+
</sup>
|
[
NotificationUserInput
](
#notificationuserinput8
)
| 是 | 是 | 用户输入对象实例。 |
...
@@ -3845,7 +3846,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3845,7 +3846,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| -------------- | ------ | ---- | ---- | ---------------------------------- |
| -------------- | ------ | ---- | ---- | ---------------------------------- |
| title | string | 是 | 是 | 通知标题。 |
| title | string | 是 | 是 | 通知标题。 |
| text | string | 是 | 是 | 通知内容。 |
| text | string | 是 | 是 | 通知内容。 |
| additionalText | string | 是 | 是 | 通知
次要
内容,是对通知内容的补充。 |
| additionalText | string | 是 | 是 | 通知
附加
内容,是对通知内容的补充。 |
## NotificationLongTextContent
## NotificationLongTextContent
...
@@ -3858,7 +3859,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3858,7 +3859,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| -------------- | ------ | ---- | --- | -------------------------------- |
| -------------- | ------ | ---- | --- | -------------------------------- |
| title | string | 是 | 是 | 通知标题。 |
| title | string | 是 | 是 | 通知标题。 |
| text | string | 是 | 是 | 通知内容。 |
| text | string | 是 | 是 | 通知内容。 |
| additionalText | string | 是 | 是 | 通知
次要
内容,是对通知内容的补充。 |
| additionalText | string | 是 | 是 | 通知
附加
内容,是对通知内容的补充。 |
| longText | string | 是 | 是 | 通知的长文本。 |
| longText | string | 是 | 是 | 通知的长文本。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
...
@@ -3874,7 +3875,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3874,7 +3875,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| -------------- | --------------- | --- | --- | -------------------------------- |
| -------------- | --------------- | --- | --- | -------------------------------- |
| title | string | 是 | 是 | 通知标题。 |
| title | string | 是 | 是 | 通知标题。 |
| text | string | 是 | 是 | 通知内容。 |
| text | string | 是 | 是 | 通知内容。 |
| additionalText | string | 是 | 是 | 通知
次要
内容,是对通知内容的补充。 |
| additionalText | string | 是 | 是 | 通知
附加
内容,是对通知内容的补充。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| longTitle | string | 是 | 是 | 通知展开时的标题。 |
| longTitle | string | 是 | 是 | 通知展开时的标题。 |
| lines | Array
\<
string
\>
| 是 | 是 | 通知的多行文本。 |
| lines | Array
\<
string
\>
| 是 | 是 | 通知的多行文本。 |
...
@@ -3890,10 +3891,10 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3890,10 +3891,10 @@ Notification.subscribe(subscriber, subscribeCallback);
| -------------- | -------------- | ---- | --- | -------------------------------- |
| -------------- | -------------- | ---- | --- | -------------------------------- |
| title | string | 是 | 是 | 通知标题。 |
| title | string | 是 | 是 | 通知标题。 |
| text | string | 是 | 是 | 通知内容。 |
| text | string | 是 | 是 | 通知内容。 |
| additionalText | string | 是 | 是 | 通知
次要
内容,是对通知内容的补充。 |
| additionalText | string | 是 | 是 | 通知
附加
内容,是对通知内容的补充。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
| picture |
image.PixelMap
| 是 | 是 | 通知的图片内容。 |
| picture |
[
image.PixelMap
](
js-apis-image.md#pixelmap7
)
| 是 | 是 | 通知的图片内容。 |
## NotificationContent
## NotificationContent
...
@@ -3934,8 +3935,8 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3934,8 +3935,8 @@ Notification.subscribe(subscriber, subscribeCallback);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------- | ---------------------- | ---- | ---- | --------------------------------- |
| ---------------- | ---------------------- | ---- | ---- | --------------------------------- |
| soundEnabled |
NotificationFlagStatus
| 是 | 否 | 是否启用声音提示。 |
| soundEnabled |
[
NotificationFlagStatus
](
#notificationflagstatus8
)
| 是 | 否 | 是否启用声音提示。 |
| vibrationEnabled |
NotificationFlagStatus
| 是 | 否 | 是否启用振动提醒功能。 |
| vibrationEnabled |
[
NotificationFlagStatus
](
#notificationflagstatus8
)
| 是 | 否 | 是否启用振动提醒功能。 |
## NotificationRequest
## NotificationRequest
...
@@ -3954,11 +3955,11 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3954,11 +3955,11 @@ Notification.subscribe(subscriber, subscribeCallback);
| deliveryTime | number | 是 | 是 | 通知发送时间。 |
| deliveryTime | number | 是 | 是 | 通知发送时间。 |
| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 |
| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 |
| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 |
| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 |
| wantAgent |
WantAgent
| 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 |
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 |
| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 |
| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 |
| color | number | 是 | 是 | 通知背景颜色。
暂不支持。
|
| color | number | 是 | 是 | 通知背景颜色。
预留能力,暂未支持。
|
| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。
暂不支持。
|
| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。
预留能力,暂未支持。
|
| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知
警报
。 |
| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知
提醒
。 |
| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 |
| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 |
| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 |
| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 |
| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 |
| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 |
...
@@ -3966,8 +3967,8 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3966,8 +3967,8 @@ Notification.subscribe(subscriber, subscribeCallback);
| badgeIconStyle | number | 是 | 是 | 通知角标类型。 |
| badgeIconStyle | number | 是 | 是 | 通知角标类型。 |
| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 |
| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 |
| actionButtons | Array
\<
[
NotificationActionButton
](
#notificationactionbutton
)
\>
| 是 | 是 | 通知按钮,最多两个按钮。 |
| actionButtons | Array
\<
[
NotificationActionButton
](
#notificationactionbutton
)
\>
| 是 | 是 | 通知按钮,最多两个按钮。 |
| smallIcon |
PixelMap | 是 | 是 | 通知小图标。(可选字段,大小不超过30KB)
|
| smallIcon |
[
image.PixelMap
](
js-apis-image.md#pixelmap7
)
| 是 | 是 | 通知小图标。可选字段,大小不超过30KB。
|
| largeIcon |
PixelMap | 是 | 是 | 通知大图标。(可选字段,大小不超过30KB)
|
| largeIcon |
[
image.PixelMap
](
js-apis-image.md#pixelmap7
)
| 是 | 是 | 通知大图标。可选字段,大小不超过30KB。
|
| creatorBundleName | string | 是 | 否 | 创建通知的包名。 |
| creatorBundleName | string | 是 | 否 | 创建通知的包名。 |
| creatorUid | number | 是 | 否 | 创建通知的UID。 |
| creatorUid | number | 是 | 否 | 创建通知的UID。 |
| creatorPid | number | 是 | 否 | 创建通知的PID。 |
| creatorPid | number | 是 | 否 | 创建通知的PID。 |
...
@@ -3981,7 +3982,7 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3981,7 +3982,7 @@ Notification.subscribe(subscriber, subscribeCallback);
| distributedOption
<sup>
8+
</sup>
|
[
DistributedOptions
](
#distributedoptions8
)
| 是 | 是 | 分布式通知的选项。 |
| distributedOption
<sup>
8+
</sup>
|
[
DistributedOptions
](
#distributedoptions8
)
| 是 | 是 | 分布式通知的选项。 |
| deviceId
<sup>
8+
</sup>
| string | 是 | 否 | 通知源的deviceId。
<br>
**系统API**
: 此接口为系统接口,三方应用不支持调用。 |
| deviceId
<sup>
8+
</sup>
| string | 是 | 否 | 通知源的deviceId。
<br>
**系统API**
: 此接口为系统接口,三方应用不支持调用。 |
| notificationFlags
<sup>
8+
</sup>
|
[
NotificationFlags
](
#notificationflags8
)
| 是 | 否 | 获取NotificationFlags。 |
| notificationFlags
<sup>
8+
</sup>
|
[
NotificationFlags
](
#notificationflags8
)
| 是 | 否 | 获取NotificationFlags。 |
| removalWantAgent
<sup>
9+
</sup>
|
WantAgent
| 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 |
| removalWantAgent
<sup>
9+
</sup>
|
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 |
| badgeNumber
<sup>
9+
</sup>
| number | 是 | 是 | 应用程序图标上显示的通知数。 |
| badgeNumber
<sup>
9+
</sup>
| number | 是 | 是 | 应用程序图标上显示的通知数。 |
## DistributedOptions<sup>8+</sup>
## DistributedOptions<sup>8+</sup>
...
@@ -3993,8 +3994,8 @@ Notification.subscribe(subscriber, subscribeCallback);
...
@@ -3993,8 +3994,8 @@ Notification.subscribe(subscriber, subscribeCallback);
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
| ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
| isDistributed | boolean | 是 | 是 | 是否为分布式通知。 |
| isDistributed | boolean | 是 | 是 | 是否为分布式通知。 |
| supportDisplayDevices | Array
\<
string> | 是 | 是 | 可以同步通知到的设备
类型。
|
| supportDisplayDevices | Array
\<
string> | 是 | 是 | 可以同步通知到的设备
列表。
|
| supportOperateDevices | Array
\<
string> | 是 | 是 | 可以打开通知的设备
。
|
| supportOperateDevices | Array
\<
string> | 是 | 是 | 可以打开通知的设备
列表。
|
| remindType | number | 是 | 否 | 通知的提醒方式。
<br>
**系统API**
: 此接口为系统接口,三方应用不支持调用。 |
| remindType | number | 是 | 否 | 通知的提醒方式。
<br>
**系统API**
: 此接口为系统接口,三方应用不支持调用。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
浏览文件 @
bb8f1a46
...
@@ -3589,7 +3589,7 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo
...
@@ -3589,7 +3589,7 @@ getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<bo
```
js
```
js
let
userId
=
100
;
let
userId
=
100
;
function
getSyncNotificationEnabledWithoutAppCallback
(
data
,
err
)
{
function
getSyncNotificationEnabledWithoutAppCallback
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, err
'
+
err
);
console
.
info
(
'
getSyncNotificationEnabledWithoutAppCallback, err
'
+
err
);
}
else
{
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录