diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md index 39d57f1d25afa78d5da0f1720de159cf0df03219..8765e590c1ef0bf111873299455f65a3ee4342a0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md @@ -29,6 +29,8 @@ publish(request: NotificationRequest, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -80,6 +82,8 @@ publish(request: NotificationRequest): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -132,6 +136,8 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -242,6 +250,8 @@ cancel(id: number, label: string, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -280,6 +290,8 @@ cancel(id: number, label?: string): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -312,6 +324,8 @@ cancel(id: number, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -343,6 +357,8 @@ cancelAll(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -379,6 +395,8 @@ cancelAll(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -414,6 +432,8 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -458,6 +478,8 @@ addSlot(slot: NotificationSlot): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -493,6 +515,8 @@ addSlot(type: SlotType, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -529,6 +553,8 @@ addSlot(type: SlotType): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -564,6 +590,8 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -612,6 +640,8 @@ addSlots(slots: Array\): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -651,6 +681,8 @@ getSlot(slotType: SlotType, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -694,6 +726,8 @@ getSlot(slotType: SlotType): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -719,6 +753,8 @@ getSlots(callback: AsyncCallback>): void **参数:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------- | ---- | -------------------- | | callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 | @@ -761,6 +797,8 @@ getSlots(): Promise\> **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -792,6 +830,8 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -829,6 +869,8 @@ removeSlot(slotType: SlotType): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -860,6 +902,8 @@ removeAllSlots(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -889,6 +933,8 @@ removeAllSlots(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -925,6 +971,8 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -969,6 +1017,8 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1008,6 +1058,8 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1057,6 +1109,8 @@ isNotificationEnabled(bundle: BundleOption): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1095,6 +1149,8 @@ isNotificationEnabled(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1141,6 +1197,8 @@ isNotificationEnabled(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1178,6 +1236,8 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1261,6 +1323,8 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1310,6 +1374,8 @@ isBadgeDisplayed(bundle: BundleOption): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1328,6 +1394,79 @@ notificationManager.isBadgeDisplayed(bundle).then((data) => { }); ``` +## notificationManager.setBadgeNumber10+ + +setBadgeNumber(badgeNumber: number): Promise\ + +设定角标个数,在应用的桌面图标上呈现(Promise形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| badgeNumber | number | 是 | 角标个数。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 1600001 | Internal error. | +| 1600002 | Marshalling or unmarshalling error. | +| 1600003 | Failed to connect service. | +| 1600012 | No memory space. | + +**示例:** + +```ts +let badgeNumber = 10 +notificationManager.setBadgeNumber(badgeNumber).then(() => { + console.info("displayBadge success"); +}); +``` + +## notificationManager.setBadgeNumber10+ + +setBadgeNumber(badgeNumber: number, callback: AsyncCallback\): void + +设定角标个数,在应用的桌面图标上呈现(Callback形式)。 + +**系统能力**:SystemCapability.Notification.Notification + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------- | ---- | ------------------ | +| badgeNumber | number | 是 | 角标个数。 | +| callback | AsyncCallback\ | 是 | 设定角标回调函数。 | + +**错误码:** + +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 1600001 | Internal error. | +| 1600002 | Marshalling or unmarshalling error. | +| 1600003 | Failed to connect service. | +| 1600012 | No memory space. | + +**示例:** + +```ts +function setBadgeNumberCallback(err) { + if (err) { + console.info(`displayBadge failed code is ${err.code}, message is ${err.message}`); + } else { + console.info("displayBadge success"); + } +} + +let badgeNumber = 10 +notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); +``` + ## notificationManager.setSlotByBundle setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\): void @@ -1350,6 +1489,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1397,6 +1538,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1439,6 +1582,8 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1527,6 +1674,8 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1576,6 +1725,8 @@ getSlotNumByBundle(bundle: BundleOption): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1655,6 +1806,8 @@ getAllActiveNotifications(): Promise\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1721,6 +1876,8 @@ getActiveNotificationCount(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1751,6 +1908,8 @@ getActiveNotifications(callback: AsyncCallback>): v **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1787,6 +1946,8 @@ getActiveNotifications(): Promise\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1856,6 +2019,8 @@ cancelGroup(groupName: string): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -1893,6 +2058,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1938,6 +2105,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -1976,6 +2145,8 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\): vo **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2022,6 +2193,8 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2064,6 +2237,8 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2114,6 +2289,8 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2158,6 +2335,8 @@ getDoNotDisturbDate(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2198,6 +2377,8 @@ getDoNotDisturbDate(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2234,6 +2415,8 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\) **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2283,6 +2466,8 @@ getDoNotDisturbDate(userId: number): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2361,6 +2546,8 @@ supportDoNotDisturbMode(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2392,6 +2579,8 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\): voi **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2436,6 +2625,8 @@ isSupportTemplate(templateName: string): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2469,6 +2660,8 @@ requestEnableNotification(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2499,6 +2692,8 @@ requestEnableNotification(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2536,6 +2731,8 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2579,6 +2776,8 @@ setDistributedEnable(enable: boolean): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2613,6 +2812,8 @@ isDistributedEnabled(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2652,6 +2853,8 @@ isDistributedEnabled(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2691,6 +2894,8 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2742,6 +2947,8 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -2878,6 +3089,8 @@ getDeviceRemindType(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2918,6 +3131,8 @@ getDeviceRemindType(): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -2956,6 +3171,8 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -3020,6 +3237,8 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | | 1600001 | Internal error. | @@ -3080,6 +3299,8 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3131,6 +3352,8 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3175,6 +3398,8 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3223,6 +3448,8 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3264,6 +3491,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -3316,6 +3545,8 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -3737,7 +3976,7 @@ notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data) => | label | string | 是 | 是 | 通知标签。 | | badgeIconStyle | number | 是 | 是 | 通知角标类型。 | | showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 | -| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 是 | 是 | 通知按钮,最多两个按钮。 | +| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 是 | 是 | 通知按钮,最多三个按钮。 | | smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 | | largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 | | creatorBundleName | string | 是 | 否 | 创建通知的包名。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md index fe34687d9e47b8b912a7e24f66a32193f6c61455..868c70f3f7828b5d55fba84f489b460be9cef06e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md @@ -36,6 +36,8 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -86,6 +88,8 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -134,6 +138,8 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -177,6 +183,8 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -222,6 +230,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -265,6 +275,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -318,6 +330,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -364,6 +378,8 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -408,6 +424,8 @@ remove(hashCode: string, reason: RemoveReason): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -446,6 +464,8 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -489,6 +509,8 @@ removeAll(callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -529,6 +551,8 @@ removeAll(bundle?: BundleOption): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 1600001 | Internal error. | @@ -566,6 +590,8 @@ removeAll(userId: number, callback: AsyncCallback\): void **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -609,6 +635,8 @@ removeAll(userId: number): Promise\ **错误码:** +错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)。 + | 错误码ID | 错误信息 | | -------- | ----------------------------------- | | 1600001 | Internal error. | @@ -945,6 +973,46 @@ let subscriber = { notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` +### onBadgeChanged10+ + + onBadgeChanged?:(data: [BadgeNumberCallbackData](#badgenumbercallbackdata)) => void + +监听应用角标个数变化。 + +**系统能力**:SystemCapability.Notification.Notification + +**系统API**: 此接口为系统接口,三方应用不支持调用。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | -------------------------- | +| callback | AsyncCallback\<[BadgeNumberCallbackData](#badgenumbercallbackdata)\> | 是 | 回调返回监听到的应用信息。 | + +**示例:** + +```javascript +function subscribeCallback(err) { + if (err) { + console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("subscribeCallback"); + } +}; + +function onBadgeChangedCallback(data) { + console.info("bundle: ", data.bundle); + console.info("uid: ", data.uid); + console.info("badgeNumber: ", data.badgeNumber); +}; + +let subscriber = { + onBadgeChanged: onBadgeChangedCallback +}; + +notificationSubscribe.subscribe(subscriber, subscribeCallback); +``` + ## BundleOption **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification @@ -1053,4 +1121,16 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); | 名称 | 值 | 说明 | | -------------------- | --- | -------------------- | | CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 | -| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 | \ No newline at end of file +| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 | + +## BadgeNumberCallbackData10+ + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +**系统API**:此接口为系统接口,三方应用不支持调用。 + +| 名称 | 类型 | 可读 | 可写 | 描述 | +| ----------- | ------ | ---- | ---- | ------------ | +| bundle | string | 是 | 否 | 应用的包名。 | +| uid | number | 是 | 否 | 应用的uid。 | +| badgeNumber | number | 是 | 否 | 角标个数。 | diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md b/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..e790eeaa9e5476ebafe83119bb8343c7e3bb62bb --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md @@ -0,0 +1,219 @@ +# 元能力子系统错误码 + +## 1600001 内部错误 + +**错误信息** + +Internal error. + +**错误描述** + +多线程处理异常、内部指针校验错误等内部处理错误时,方法将返回该错误码。 + +**可能原因** + +多线程处理、内部处理异常等内核通用错误。 + +**处理步骤** + +确认系统资源是否足够。 + +## 1600002 序列化或反序列化错误 + +**错误信息** + +marshalling or unmarshalling error. + +**错误描述** + +数据传输前,进行序列化或反序列化错误,方法将返回该错误码。 + +**可能原因** + +应用与通知服务字段未匹配。 + +**处理步骤** + +检查应用sdk版本与系统版本是否匹配。 + +## 1600003 连接通知服务失败 + +**错误信息** + +Failed to connect service. + +**错误描述** + +应用连接通知服务失败,方法将返回该错误码。 + +**可能原因** + +通知服务繁忙或异常。 + +**处理步骤** + +重启系统。 + +## 1600004 通知开关关闭 + +**错误信息** + +Notification is not enabled. + +**错误描述** + +当通知开关为关闭状态时,方法将返回该错误码。 + +**可能原因** + +应用的通知开关为关闭状态。 + +**处理步骤** + +通知设置里开启应用通知开关。 + +## 1600005 通知渠道关闭 + +**错误信息** + +Notification slot is not enabled. + +**错误描述** + +当通知渠道关闭时,方法将返回该错误码。 + +**可能原因** + +通知渠道关闭状态,或未添加该类型渠道。 + +**处理步骤** + +1、通知设置里查看应用是否有该类型渠道,没有需要新增。 + +2、通知设置里查看应用该类型渠道状态,要保持开启状态。 + +## 1600006 通知删除失败 + +**错误信息** + +Notification is not allowed to remove. + +**错误描述** + +通知设置了禁止删除属性,方法将返回该错误码。 + +**可能原因** + +通知设置了禁止删除属性。 + +**处理步骤** + +参考[NotificationRequest](../apis/js-apis-notificationManager.md#notificationrequest)通知禁止删除属性。 + +## 1600007 通知不存在 + +**错误信息** + +The notification is not exist. + +**错误描述** + +通知服务未找到该通知,方法将返回该错误码。 + +**可能原因** + +通知已被取消或删除。 + +**处理步骤** + +无 + +## 1600008 用户不存在 + +**错误信息** + +The user is not exist. + +**错误描述** + +传入的用户信息系统里未查询到,方法将返回该错误码。 + +**可能原因** + +传入用户信息有误。 + +**处理步骤** + +检查传入的用户信息。 + +## 1600009 通知发布频度超过限制 + +**错误信息** + +Over max number notifications per second. + +**错误描述** + +通知发送频率超过限制,方法将返回该错误码。 + +**可能原因** + +通知发送频率超过每秒10个。 + +**处理步骤** + +降低通知发送频率。 + +## 16000010 分布式操作失败 + +**错误信息** + +Distributed operation failed. + +**错误描述** + +分布式数据库操作异常或分布式接口调用异常,方法将返回该错误码。 + +**可能原因** + +分布式数据库操作异常或分布式接口调用异常。 + +**处理步骤** + +检查分布式连接是否正常。 + +## 16000011 读模板配置文件错误 + +**错误信息** + +Read template config failed. + +**错误描述** + +模板配置文件读取异常,方法将返回该错误码。 + +**可能原因** + +系统中模板配置文件丢失。 + +**处理步骤** + +请检查系统中模板配置文件是否存在,配置文件路径:/system/etc/notification_template/external.json。 + +## 16000012 内存空间不够 + +**错误信息** + +No memory space. + +**错误描述** + +内存申请出现错误,方法将返回该错误码。 + +**可能原因** + +内存申请出现错误。 + +**处理步骤** + +确认系统内存是否足够。