Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b684f59c
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b684f59c
编写于
3月 10, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 10, 2023
浏览文件
操作
浏览文件
下载
差异文件
!15827 fix notification error
Merge pull request !15827 from yuyaozhi/master
上级
755bd099
0d81cf52
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
99 addition
and
177 deletion
+99
-177
zh-cn/application-dev/reference/apis/Readme-CN.md
zh-cn/application-dev/reference/apis/Readme-CN.md
+9
-0
zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md
.../apis/js-apis-inner-notification-notificationCommonDef.md
+16
-14
zh-cn/application-dev/reference/apis/js-apis-notification.md
zh-cn/application-dev/reference/apis/js-apis-notification.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
...ication-dev/reference/apis/js-apis-notificationManager.md
+25
-25
zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md
...ation-dev/reference/apis/js-apis-notificationSubscribe.md
+26
-124
zh-cn/application-dev/reference/apis/js-apis-system-notification.md
...ication-dev/reference/apis/js-apis-system-notification.md
+10
-10
zh-cn/application-dev/website.md
zh-cn/application-dev/website.md
+9
-0
未找到文件。
zh-cn/application-dev/reference/apis/Readme-CN.md
浏览文件 @
b684f59c
...
...
@@ -130,6 +130,15 @@
-
[
CommonEventPublishData
](
js-apis-inner-commonEvent-commonEventPublishData.md
)
-
[
CommonEventSubscriber
](
js-apis-inner-commonEvent-commonEventSubscriber.md
)
-
[
CommonEventSubscribeInfo
](
js-apis-inner-commonEvent-commonEventSubscribeInfo.md
)
-
notification
-
[
NotificationActionButton
](
js-apis-inner-notification-notificationActionButton.md
)
-
[
NotificationCommonDef
](
js-apis-inner-notification-notificationCommonDef.md
)
-
[
NotificationContent
](
js-apis-inner-notification-notificationContent.md
)
-
[
NotificationFlags
](
js-apis-inner-notification-notificationFlags.md
)
-
[
NotificationRequest
](
js-apis-inner-notification-notificationRequest.md
)
-
[
NotificationSlot
](
js-apis-inner-notification-notificationSlot.md
)
-
[
NotificationTemplate
](
js-apis-inner-notification-notificationTemplate.md
)
-
[
NotificationUserInput
](
js-apis-inner-notification-notificationUserInput.md
)
-
包管理
-
[
@ohos.bundle.appControl (appControl模块)
](
js-apis-appControl.md
)
-
[
@ohos.bundle.bundleManager (bundleManager模块)
](
js-apis-bundleManager.md
)
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-notification-
bundleOption
.md
→
zh-cn/application-dev/reference/apis/js-apis-inner-notification-
notificationCommonDef
.md
浏览文件 @
b684f59c
# BundleOption
BundleOption模块为指定应用的包信息。
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 | 必填 | 说明 |
| ------ | ------ |---- | ------ |
| bundle | string | 是 | 应用的包信息。 |
| uid | number | 否 | 用户ID。 |
# NotificationCommonDef
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## BundleOption
BundleOption模块为指定应用的包信息。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 | 必填 | 说明 |
| ------ | ------ |---- | ------ |
| bundle | string | 是 | 应用的包信息。 |
| uid | number | 否 | 用户ID。 |
zh-cn/application-dev/reference/apis/js-apis-notification.md
浏览文件 @
b684f59c
...
...
@@ -853,8 +853,8 @@ function unsubscribeCallback(err) {
console
.
info
(
"
unsubscribe success
"
);
}
}
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
)
);
function
onDisconnectCallback
()
{
console
.
info
(
"
subscribe disconnect
"
);
}
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
...
...
@@ -883,8 +883,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**示例:**
```
js
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
)
);
function
onDisconnectCallback
()
{
console
.
info
(
"
subscribe disconnect
"
);
}
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
...
...
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
浏览文件 @
b684f59c
...
...
@@ -965,7 +965,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知使能回调函数。 |
...
...
@@ -1012,7 +1012,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
**错误码:**
...
...
@@ -1053,7 +1053,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 获取通知使能状态回调函数。 |
**错误码:**
...
...
@@ -1099,7 +1099,7 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
**返回值:**
...
...
@@ -1187,7 +1187,7 @@ isNotificationEnabled(): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
**返回值:**
...
...
@@ -1230,7 +1230,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定角标使能回调函数。 |
...
...
@@ -1277,7 +1277,7 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
**错误码:**
...
...
@@ -1318,7 +1318,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 获取角标使能状态回调函数。 |
**错误码:**
...
...
@@ -1364,7 +1364,7 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
**返回值:**
...
...
@@ -1483,7 +1483,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| slot |
[
NotificationSlot
](
js-apis-inner-notification-notificationSlot.md
)
| 是 | 通知通道。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设定通知通道回调函数。 |
...
...
@@ -1533,7 +1533,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| slot |
[
NotificationSlot
](
js-apis-inner-notification-notificationSlot.md
)
| 是 | 通知通道。 |
**错误码:**
...
...
@@ -1577,7 +1577,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | -------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| callback | AsyncCallback
<Array
\<[
NotificationSlot
](
js-apis-inner-notification-notificationSlot.md
)\
>
> | 是 | 获取通知通道回调函数。 |
**错误码:**
...
...
@@ -1623,7 +1623,7 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
**返回值:**
...
...
@@ -1669,7 +1669,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
| callback | AsyncCallback
\<
number
\>
| 是 | 获取通知通道数量回调函数。 |
**错误码:**
...
...
@@ -1715,7 +1715,7 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 指定应用的包信息。 |
**返回值:**
...
...
@@ -2052,7 +2052,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| groupName | string | 是 | 通知组名称。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定应用指定组下通知的回调函数。 |
...
...
@@ -2100,7 +2100,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------ | ---- | -------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| groupName | string | 是 | 通知组名称。 |
**错误码:**
...
...
@@ -2888,7 +2888,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| enable | boolean | 是 | 是否支持。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 应用程序是否支持分布式通知的回调函数。 |
...
...
@@ -2942,7 +2942,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<vo
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包。 |
| enable | boolean | 是 | 是否支持。 |
**错误码:**
...
...
@@ -2987,7 +2987,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 查询指定应用是否支持分布式通知的回调函数。 |
**错误码:**
...
...
@@ -3036,7 +3036,7 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包。 |
**返回值:**
...
...
@@ -3391,7 +3391,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean,
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 指定渠道类型。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 设置渠道使能回调函数。 |
...
...
@@ -3442,7 +3442,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean)
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
| enable | boolean | 是 | 使能状态。 |
...
...
@@ -3485,7 +3485,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------- | ---- | ---------------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
| callback | AsyncCallback
\<
boolean
\>
| 是 | 获取渠道使能状态回调函数。 |
...
...
@@ -3534,7 +3534,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolea
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------- | ---- | -------------- |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
bundleOption.md
)
| 是 | 应用的包信息。 |
| bundle |
[
BundleOption
](
./js-apis-inner-notification-
notificationCommonDef.md#bundleoption
)
| 是 | 应用的包信息。 |
| type |
[
SlotType
](
#slottype
)
| 是 | 渠道类型。 |
**返回值:**
...
...
zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md
浏览文件 @
b684f59c
...
...
@@ -30,8 +30,8 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ---------------- |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 是 | 通知订阅信息。 |
| subscriber |
[
NotificationSubscriber
](
js-apis-notification.md
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
js-apis-notification.md
#notificationsubscribeinfo
)
| 是 | 通知订阅信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 订阅动作回调函数。 |
**错误码:**
...
...
@@ -83,7 +83,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>):
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | ---------------- |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| subscriber |
[
NotificationSubscriber
](
js-apis-notification.md
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 订阅动作回调函数。 |
**错误码:**
...
...
@@ -133,8 +133,8 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------ |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
#notificationsubscribeinfo
)
| 否 | 通知订阅信息。 |
| subscriber |
[
NotificationSubscriber
](
js-apis-notification.md
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| info |
[
NotificationSubscribeInfo
](
js-apis-notification.md
#notificationsubscribeinfo
)
| 否 | 通知订阅信息。 |
**错误码:**
...
...
@@ -178,7 +178,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>)
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | -------------------- |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| subscriber |
[
NotificationSubscriber
](
js-apis-notification.md
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 取消订阅动作回调函数。 |
**错误码:**
...
...
@@ -201,8 +201,8 @@ function unsubscribeCallback(err) {
console
.
info
(
"
unsubscribe success
"
);
}
}
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
)
);
function
onDisconnectCallback
()
{
console
.
info
(
"
subscribe disconnect
"
);
}
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
...
...
@@ -226,7 +226,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------- | ---- | ------------ |
| subscriber |
[
NotificationSubscriber
](
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
| subscriber |
[
NotificationSubscriber
](
js-apis-notification.md
#notificationsubscriber
)
| 是 | 通知订阅对象。 |
**错误码:**
...
...
@@ -241,8 +241,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
**示例:**
```
js
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
)
);
function
onDisconnectCallback
()
{
console
.
info
(
"
subscribe disconnect
"
);
}
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
...
...
@@ -268,8 +268,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | ----------------------------------| ---- | -------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定应用的包信息。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| bundle |
[
BundleOption
](
js-apis-inner-notification-notificationCommonDef.md
#bundleoption
)
| 是 | 指定应用的包信息。 |
| notificationKey |
[
NotificationKey
](
js-apis-notification.md
#notificationkey
)
| 是 | 通知键值。 |
| reason |
[
RemoveReason
](
#removereason
)
| 是 | 通知删除原因。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
...
...
@@ -324,8 +324,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
| 参数名 | 类型 | 必填 | 说明 |
| --------------- | --------------- | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定应用的包信息。 |
| notificationKey |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| bundle |
[
BundleOption
](
js-apis-inner-notification-notificationCommonDef.md
#bundleoption
)
| 是 | 指定应用的包信息。 |
| notificationKey |
[
NotificationKey
](
(js-apis-notification.md#notificationkey
)
) | 是 | 通知键值。 |
| reason |
[
RemoveReason
](
#removereason
)
| 是 | 通知删除原因。 |
**错误码:**
...
...
@@ -372,7 +372,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
| hashCode | string | 是 | 通知唯一ID。可以通过
[
onConsume
](
#onconsume
)
回调的入参
[
SubscribeCallbackData
](
#subscribecallbackdata
)
获取其内部
[
NotificationRequest
](
#notificationrequest
)
对象中的hashCode。 |
| hashCode | string | 是 | 通知唯一ID。可以通过
[
onConsume
](
#onconsume
)
回调的入参
[
SubscribeCallbackData
](
js-apis-notification.md
#subscribecallbackdata
)
获取其内部
[
NotificationRequest
](
#notificationrequest
)
对象中的hashCode。 |
| reason |
[
RemoveReason
](
#removereason
)
| 是 | 通知删除原因。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
...
...
@@ -459,7 +459,7 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 是 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
(js-apis-inner-notification-notificationCommonDef.md#bundleoption
)
) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback
\<
void
\>
| 是 | 删除指定应用的所有通知回调函数。 |
**错误码:**
...
...
@@ -547,7 +547,7 @@ removeAll(bundle?: BundleOption): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
| bundle |
[
BundleOption
](
#bundleoption
)
| 否 | 指定应用的包信息。 |
| bundle |
[
BundleOption
](
(js-apis-inner-notification-notificationCommonDef.md#bundleoption
)
) | 否 | 指定应用的包信息。 |
**错误码:**
...
...
@@ -668,7 +668,7 @@ notificationSubscribe.removeAll(userId, removeAllCallback);
### onConsume
onConsume?: (data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
onConsume?: (data:
[
SubscribeCallbackData
](
js-apis-notification.md
#subscribecallbackdata
)
) => void
接收到新通知的回调函数。
...
...
@@ -680,7 +680,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 | 新接收到的通知信息。 |
| data |
[
SubscribeCallbackData
](
js-apis-notification.md
#subscribecallbackdata
)
| 是 | 新接收到的通知信息。 |
**示例:**
...
...
@@ -708,7 +708,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
### onCancel
onCancel?:(data:
[
SubscribeCallbackData
](
#subscribecallbackdata
)
) => void
onCancel?:(data:
[
SubscribeCallbackData
](
js-apis-notification.md
#subscribecallbackdata
)
) => void
取消通知的回调函数。
...
...
@@ -720,7 +720,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
SubscribeCallbackData
](
#subscribecallbackdata
)
| 是 | 需要取消的通知信息。 |
| data |
[
SubscribeCallbackData
](
js-apis-notification.md
#subscribecallbackdata
)
| 是 | 需要取消的通知信息。 |
**示例:**
...
...
@@ -748,7 +748,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
### onUpdate
onUpdate?:(data:
[
NotificationSortingMap
](
#notificationsortingmap
)
) => void
onUpdate?:(data:
[
NotificationSortingMap
](
js-apis-notification.md
#notificationsortingmap
)
) => void
更新通知排序的回调函数。
...
...
@@ -760,7 +760,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| data |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 | 最新的通知排序列表。 |
| data |
[
NotificationSortingMap
](
js-apis-notification.md#notificationsortingmap
)
) | 是 | 最新的通知排序列表。 |
**示例:**
...
...
@@ -935,7 +935,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback);
### onEnabledNotificationChanged
onEnabledNotificationChanged?:(callbackData:
[
EnabledNotificationCallbackData
](
#enablednotificationcallbackdata
)
) => void
onEnabledNotificationChanged?:(callbackData:
[
EnabledNotificationCallbackData
](
js-apis-notification.md
#enablednotificationcallbackdata
)
) => void
监听应用通知使能变化。
...
...
@@ -947,7 +947,7 @@ onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](#
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------------------------ | ---- | -------------------------- |
| callback | AsyncCallback
\<
[
EnabledNotificationCallbackData
](
#enablednotificationcallbackdata
)
\>
| 是 | 回调返回监听到的应用信息。 |
| callback | AsyncCallback
\<
[
EnabledNotificationCallbackData
](
js-apis-notification.md
#enablednotificationcallbackdata
)
\>
| 是 | 回调返回监听到的应用信息。 |
**示例:**
...
...
@@ -1013,104 +1013,6 @@ let subscriber = {
notificationSubscribe
.
subscribe
(
subscriber
,
subscribeCallback
);
```
## BundleOption
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ |---- | --- | ------ |
| bundle | string | 是 | 是 | 应用的包信息。 |
| uid | number | 是 | 是 | 用户ID。 |
## NotificationKey
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ------ | ---- | --- | -------- |
| id | number | 是 | 是 | 通知ID。 |
| label | string | 是 | 是 | 通知标签。 |
## SubscribeCallbackData
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
**系统API**
:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| --------------- | ------------------------------------------------- | -------- | -------- | -------- |
| request |
[
NotificationRequest
](
js-apis-notificationManager.md#notificationrequest
)
| 是 | 否 | 通知内容。 |
| sortingMap |
[
NotificationSortingMap
](
#notificationsortingmap
)
| 是 | 否 | 排序信息。 |
| reason | number | 是 | 否 | 删除原因。 |
| sound | string | 是 | 否 | 通知声音。 |
| vibrationValues | Array
\<
number
\>
| 是 | 否 | 通知震动。 |
## EnabledNotificationCallbackData
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
**系统API**
:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 描述 |
| ------ | ------- | ---------------- | ---------------- | ---------------- |
| bundle | string | 是 | 否 | 应用的包名。 |
| uid | number | 是 | 否 | 应用的uid。 |
| enable | boolean | 是 | 否 | 应用通知使能状态。 |
## NotificationSorting
提供有关活动通知的排序信息。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ------------------------------------- | ---- | --- | ------------ |
| slot |
[
NotificationSlot
](
js-apis-notificationManager.md#notificationslot
)
| 是 | 否 | 通知通道内容。 |
| hashCode | string | 是 | 否 | 通知唯一标识。 |
| ranking | number | 是 | 否 | 通知排序序号。 |
## NotificationSortingMap
提供关于已订阅的所有通知中活动通知的排序信息
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
**系统API**
:此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ------------------------------------------------------------ | ---- | --- | ---------------- |
| sortings | {
[
key: string]: [NotificationSorting
](
#notificationsorting
)
} | 是 | 否 | 通知排序信息数组。 |
| sortedHashCode | Array
\<
string
\>
| 是 | 否 | 通知唯一标识数组。 |
## NotificationSubscribeInfo
设置订阅所需通知的发布者的信息。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | --------------- | --- | ---- | ------------------------------- |
| bundleNames | Array
\<
string
\>
| 是 | 是 | 指定订阅哪些包名的APP发来的通知。 |
| userId | number | 是 | 是 | 指定订阅哪个用户下发来的通知。 |
## NotificationUserInput
保存用户输入的通知消息。
**系统能力**
:SystemCapability.Notification.Notification
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ------ | --- | ---- | ----------------------------- |
| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 |
## RemoveReason
...
...
zh-cn/application-dev/reference/apis/js-apis-system-notification.md
浏览文件 @
b684f59c
...
...
@@ -17,22 +17,22 @@ import notification from '@system.notification';
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 |
可读 | 可写 | 必填 | 描述
|
| ----------- | ---------------------------------------------- | ---- | ------------------------- |
------------------------- | ------------------------- |
| bundleName | string | 是
| 是 | 是
| 单击通知后要重定向到的应用程序的Bundle名。 |
| abilityName
| string | 是 | 是
| 是 | 单击通知后要重定向到的应用程序的Ability名称。 |
| uri | string |
是 | 是 |
否 | 要重定向到的页面的uri。 |
| 名称 | 类型 |
必填 | 说明
|
| ----------- | ---------------------------------------------- | ---- | ------------------------- |
| bundleName | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 |
| abilityName
| string
| 是 | 单击通知后要重定向到的应用程序的Ability名称。 |
| uri | string | 否 | 要重定向到的页面的uri。 |
## ShowNotificationOptions
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 |
可读 | 可写 | 必填 | 描述
|
| ------------- | ---------------------------------------------- | ---- | ------------------------- |
------------------------- | ------------------------- |
| contentTitle | string |
是 | 是 |
否 | 通知标题。 |
| contentText | string |
是 | 是 |
否 | 通知内容。 |
| clickAction | ActionResult |
是 | 是 |
否 | 通知被点击后触发的行为。 |
| 名称 | 类型 |
必填 | 说明
|
| ------------- | ---------------------------------------------- | ---- | ------------------------- |
| contentTitle | string | 否 | 通知标题。 |
| contentText | string | 否 | 通知内容。 |
| clickAction | ActionResult | 否 | 通知被点击后触发的行为。 |
## notification.show
...
...
zh-cn/application-dev/website.md
浏览文件 @
b684f59c
...
...
@@ -932,6 +932,15 @@
-
[
CommonEventPublishData
](
reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
)
-
[
CommonEventSubscriber
](
reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
)
-
[
CommonEventSubscribeInfo
](
reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
)
-
notification
-
[
NotificationActionButton
](
reference/apis/js-apis-inner-notification-notificationActionButton.md
)
-
[
NotificationCommonDef
](
reference/apis/js-apis-inner-notification-notificationCommonDef.md
)
-
[
NotificationContent
](
reference/apis/js-apis-inner-notification-notificationContent.md
)
-
[
NotificationFlags
](
reference/apis/js-apis-inner-notification-notificationFlags.md
)
-
[
NotificationRequest
](
reference/apis/js-apis-inner-notification-notificationRequest.md
)
-
[
NotificationSlot
](
reference/apis/js-apis-inner-notification-notificationSlot.md
)
-
[
NotificationTemplate
](
reference/apis/js-apis-inner-notification-notificationTemplate.md
)
-
[
NotificationUserInput
](
reference/apis/js-apis-inner-notification-notificationUserInput.md
)
-
包管理
-
[
@ohos.bundle.appControl (appControl模块)
](
reference/apis/js-apis-appControl.md
)
-
[
@ohos.bundle.bundleManager (bundleManager模块)
](
reference/apis/js-apis-bundleManager.md
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录