From 59d176c7e557c7751c9f618e98aa2380f8ff55b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E8=8A=B7=E7=8F=8A?= Date: Fri, 27 Jun 2025 14:44:49 +0800 Subject: [PATCH] update docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 胡芷珊 --- .../js-apis-notificationManager-sys.md | 70 +++++++++---------- .../js-apis-notificationManager.md | 48 ++++++------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager-sys.md b/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager-sys.md index d7847cc05b6..5f7dd1208ea 100644 --- a/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager-sys.md +++ b/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager-sys.md @@ -55,7 +55,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600014 | No permission. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -134,7 +134,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600014 | No permission. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -529,10 +529,10 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getAllNotificationEnabledBundles().then((data: Array) => { - console.info("Enable bundle data is" + JSON.stringify(data)); + console.info(`Enable bundle data is ${JSON.stringify(data)}`); data.forEach(element => { - console.info("Enable uid is " + JSON.stringify(element.uid)); - console.info("Enable bundle is " + JSON.stringify(element.bundle)); + console.info(`Enable uid is ${JSON.stringify(element.uid)}`); + console.info(`Enable bundle is ${JSON.stringify(element.bundle)}`); }); }).catch((err: BusinessError) => { console.error(`getAllNotificationEnabledBundles failed, code is ${err.code}, message is ${err.message}`); @@ -639,7 +639,7 @@ let bundle: notificationManager.BundleOption = { bundle: "bundleName1", }; notificationManager.isNotificationEnabled(bundle).then((data: boolean) => { - console.info("isNotificationEnabled success, data: " + JSON.stringify(data)); + console.info(`isNotificationEnabled success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -744,7 +744,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; let userId: number = 1; notificationManager.isNotificationEnabled(userId).then((data: boolean) => { - console.info("isNotificationEnabled success, data: " + JSON.stringify(data)); + console.info(`isNotificationEnabled success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -756,7 +756,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ Sets whether to enable the notification badge for a specified application. This API uses a promise to return the result. -This API is not supported on TVs and wearables. +This API is not supported on wearables. **System capability**: SystemCapability.Notification.Notification @@ -967,7 +967,7 @@ let bundle: notificationManager.BundleOption = { }; notificationManager.isBadgeDisplayed(bundle).then((data: boolean) => { - console.info("isBadgeDisplayed success, data: " + JSON.stringify(data)); + console.info(`isBadgeDisplayed success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isBadgeDisplayed failed, code is ${err.code}, message is ${err.message}`); }); @@ -1207,7 +1207,7 @@ let bundle: notificationManager.BundleOption = { bundle: "bundleName1", }; notificationManager.getSlotFlagsByBundle(bundle).then((data : number) => { - console.info("getSlotFlagsByBundle success, data: " + JSON.stringify(data)); + console.info(`getSlotFlagsByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getSlotFlagsByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -1318,7 +1318,7 @@ let bundle: notificationManager.BundleOption = { }; notificationManager.getSlotsByBundle(bundle).then((data: Array) => { - console.info("getSlotsByBundle success, data: " + JSON.stringify(data)); + console.info(`getSlotsByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getSlotsByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -1431,7 +1431,7 @@ let bundle: notificationManager.BundleOption = { }; notificationManager.getSlotNumByBundle(bundle).then((data: number) => { - console.info("getSlotNumByBundle success, data: " + JSON.stringify(data)); + console.info(`getSlotNumByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getSlotNumByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -1521,7 +1521,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getAllActiveNotifications().then((data: Array) => { - console.info("getAllActiveNotifications success, data: " + JSON.stringify(data)); + console.info(`getAllActiveNotifications success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getAllActiveNotifications failed, code is ${err.code}, message is ${err.message}`); }); @@ -1639,7 +1639,7 @@ let filter: notificationManager.NotificationFilter = { extraInfoKeys: ['event'] } notificationManager.getActiveNotificationByFilter(filter).then((data: notificationManager.NotificationRequest) => { - console.info("getActiveNotificationByFilter success, data: " + JSON.stringify(data)); + console.info(`getActiveNotificationByFilter success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getActiveNotificationByFilter failed, code is ${err.code}, message is ${err.message}`); }); @@ -2089,7 +2089,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getDoNotDisturbDate().then((data: notificationManager.DoNotDisturbDate) => { - console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data)); + console.info(`getDoNotDisturbDate success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`); }); @@ -2203,7 +2203,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; let userId: number = 1; notificationManager.getDoNotDisturbDate(userId).then((data: notificationManager.DoNotDisturbDate) => { - console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data)); + console.info(`getDoNotDisturbDate success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`); }); @@ -2253,7 +2253,7 @@ let isSupportDoNotDisturbModeCallback = (err: BusinessError, data: boolean): voi if (err) { console.error(`isSupportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`); } else { - console.info("isSupportDoNotDisturbMode success, data: " + JSON.stringify(data)); + console.info(`isSupportDoNotDisturbMode success, data: ${JSON.stringify(data)}`); } } @@ -2299,7 +2299,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.isSupportDoNotDisturbMode().then((data: boolean) => { - console.info("isSupportDoNotDisturbMode success, data: " + JSON.stringify(data)); + console.info(`isSupportDoNotDisturbMode success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isSupportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`); }); @@ -2575,7 +2575,7 @@ let isDistributedEnabledByBundleCallback = (err: BusinessError, data: boolean): if (err) { console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`); } else { - console.info("isDistributedEnabledByBundle success" + JSON.stringify(data)); + console.info(`isDistributedEnabledByBundle success, data: ${JSON.stringify(data)}`); } }; let bundle: notificationManager.BundleOption = { @@ -2635,7 +2635,7 @@ let bundle: notificationManager.BundleOption = { bundle: "bundleName1", }; notificationManager.isDistributedEnabledByBundle(bundle).then((data: boolean) => { - console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data)); + console.info(`isDistributedEnabledByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -2730,7 +2730,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getDeviceRemindType().then((data: notificationManager.DeviceRemindType) => { - console.info("getDeviceRemindType success, data: " + JSON.stringify(data)); + console.info(`getDeviceRemindType success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getDeviceRemindType failed, code is ${err.code}, message is ${err.message}`); }); @@ -2778,7 +2778,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600012 | No memory space. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -2860,7 +2860,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600012 | No memory space. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -2937,7 +2937,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600012 | No memory space. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -3486,7 +3486,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; // isNotificationSlotEnabled notificationManager.isNotificationSlotEnabled({ bundle: "ohos.samples.notification", }, notificationManager.SlotType.SOCIAL_COMMUNICATION).then((data: boolean) => { - console.info("isNotificationSlotEnabled success, data: " + JSON.stringify(data)); + console.info(`isNotificationSlotEnabled success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isNotificationSlotEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -3651,7 +3651,7 @@ let getSyncNotificationEnabledWithoutAppCallback = (err: BusinessError, data: bo if (err) { console.error(`getSyncNotificationEnabledWithoutAppCallback failed, code is ${err.code}, message is ${err.message}`); } else { - console.info("getSyncNotificationEnabledWithoutAppCallback success, data: " + JSON.stringify(data)); + console.info(`getSyncNotificationEnabledWithoutAppCallback success, data: ${JSON.stringify(data)}`); } } notificationManager.getSyncNotificationEnabledWithoutApp(userId, getSyncNotificationEnabledWithoutAppCallback); @@ -3704,7 +3704,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; // Use the actual user ID when calling the API. let userId: number = 100; notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data: boolean) => { - console.info('getSyncNotificationEnabledWithoutApp, data: ' + JSON.stringify(data)); + console.info(`getSyncNotificationEnabledWithoutApp, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`); }); @@ -3825,7 +3825,7 @@ Unsubscribes from notification events. **System capability**: SystemCapability.Notification.Notification -**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER, ohos.permission.NOTIFICATION_AGENT_CONTROLLER +**Required permissions**: ohos.permission.NOTIFICATION_CONTROLLER and ohos.permission.NOTIFICATION_AGENT_CONTROLLER **System API**: This is a system API. @@ -3970,7 +3970,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; let onResponseCallback = (id:number, option:notificationManager.ButtonOptions) => { - console.info("onResponseCallback: " + JSON.stringify(option) + "notificationId" + id); + console.info(`notificationId: ${id},onResponseCallback: ${JSON.stringify(option)}`); } let subscriber: notificationManager.SystemLiveViewSubscriber = { onResponse: onResponseCallback, @@ -4100,7 +4100,7 @@ let bundle: notificationManager.BundleOption = { }; let deviceType: string = "phone"; notificationManager.isDistributedEnabledByBundle(bundle, deviceType).then((data: boolean) => { - console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data)); + console.info(`isDistributedEnabledByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -4214,7 +4214,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; let deviceType: string = "phone"; notificationManager.isSmartReminderEnabled(deviceType).then((data: boolean) => { - console.info("isSmartReminderEnabled success, data:" + data); + console.info(`isSmartReminderEnabled success data:${data}`); }).catch((err: BusinessError) => { console.error(`isSmartReminderEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -4335,7 +4335,7 @@ let bundle: notificationManager.BundleOption = { let slotType = notificationManager.SlotType.LIVE_VIEW; notificationManager.getSlotByBundle(bundle, slotType).then((data: notificationManager.NotificationSlot) => { - console.info("getSlotByBundle success, data: " + JSON.stringify(data)); + console.info(`getSlotByBundle success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`); }); @@ -4518,7 +4518,7 @@ For details about the error codes, see [Notification Error Codes](./errorcode-no import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.setAdditionalConfig('RING_TRUSTLIST_PKG','[bundleName1,bundleName2]').then((data: number) => { - console.info("setAdditionalConfig success, data: " + JSON.stringify(data)); + console.info(`setAdditionalConfig success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`setAdditionalConfig failed, code is ${err.code}, message is ${err.message}`); }); @@ -4571,7 +4571,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getDoNotDisturbProfile(1).then((data: notificationManager.DoNotDisturbProfile) => { - console.info("getDoNotDisturbProfile success: " + JSON.stringify(data)); + console.info(`getDoNotDisturbProfile success: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`getDoNotDisturbProfile failed, code is ${err.code}, message is ${err.message}`); }); diff --git a/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager.md b/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager.md index f7d2d05cd76..e76cbeffed1 100644 --- a/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager.md +++ b/en/application-dev/reference/apis-notification-kit/js-apis-notificationManager.md @@ -26,7 +26,7 @@ If the ID and label of the new notification are the same as that of the previous | Name | Type | Mandatory| Description | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest-1) | Yes | Content and related configuration of the notification to publish.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -47,7 +47,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600014 | No permission. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -118,7 +118,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ | 1600014 | No permission. | | 1600015 | The current notification status does not support duplicate configurations. | | 1600016 | The notification version for this update is too low. | -| 1600020 | The application is not allowed to publish notifications due to permission control settings. | +| 1600020 | The application is not allowed to send notifications due to permission settings. | | 2300007 | Network unreachable. | **Example** @@ -478,7 +478,7 @@ let getSlotCallback = (err: BusinessError, data: notificationManager.Notificatio if (err) { console.error(`Failed to get slot. Code is ${err.code}, message is ${err.message}`); } else { - console.info(`Succeeded in getting slot, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting slot, data is ${JSON.stringify(data)}`); } } let slotType: notificationManager.SlotType = notificationManager.SlotType.SOCIAL_COMMUNICATION; @@ -523,7 +523,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; let slotType: notificationManager.SlotType = notificationManager.SlotType.SOCIAL_COMMUNICATION; notificationManager.getSlot(slotType).then((data: notificationManager.NotificationSlot) => { - console.info(`Succeeded in getting slot, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting slot, data is ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`Failed to get slot. Code is ${err.code}, message is ${err.message}`); }); @@ -565,7 +565,7 @@ let getSlotsCallback = (err: BusinessError, data: Array) => { - console.info(`Succeeded in getting slots, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting slots, data is ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`Failed to get slots. Code is ${err.code}, message is ${err.message}`); }); @@ -845,7 +845,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.isNotificationEnabled().then((data: boolean) => { - console.info("isNotificationEnabled success, data: " + JSON.stringify(data)); + console.info(`isNotificationEnabled success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -890,7 +890,7 @@ Sets the notification badge number. This API uses a promise to return the URI of If the **badgeNumber** is set to **0**, badges are cleared; if the value is greater than **99**, **99+** is displayed on the badge. -This API is not supported on TVs and wearables. +This API is not supported on wearables. **System capability**: SystemCapability.Notification.Notification @@ -940,7 +940,7 @@ Sets the notification badge number. This API uses an asynchronous callback to re If the **badgeNumber** is set to **0**, badges are cleared; if the value is greater than **99**, **99+** is displayed on the badge. -This API is not supported on TVs and wearables. +This API is not supported on wearables. **System capability**: SystemCapability.Notification.Notification @@ -1014,7 +1014,7 @@ let getActiveNotificationCountCallback = (err: BusinessError, data: number): voi if (err) { console.error(`Failed to get active notification count. Code is ${err.code}, message is ${err.message}`); } else { - console.info(`Succeeded in getting active notification count, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting active notification count, data is ${JSON.stringify(data)}`); } } @@ -1051,7 +1051,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.getActiveNotificationCount().then((data: number) => { - console.info(`Succeeded in getting active notification count, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting active notification count, data is ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`Failed to get active notification count. Code is ${err.code}, message is ${err.message}`); }); @@ -1069,7 +1069,7 @@ Obtains the active notifications of this application. This API uses an asynchron | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------ | -| callback | AsyncCallback\> | Yes | Callback used to return the result.| +| callback | AsyncCallback\> | Yes | Callback used to return the result.| **Error codes** @@ -1091,7 +1091,7 @@ let getActiveNotificationsCallback = (err: BusinessError, data: Array) => { - console.info(`Succeeded in getting active notifications, data is ` + JSON.stringify(data)); + console.info(`Succeeded in getting active notifications, data is ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`Failed to get active notifications. Code is ${err.code}, message is ${err.message}`); }); @@ -1145,7 +1145,7 @@ Cancels notifications under a notification group of this application. This API u | Name | Type | Mandatory| Description | | --------- | --------------------- | ---- | ---------------------------- | -| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) when the notification is published.| +| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest-1) when the notification is published.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1187,7 +1187,7 @@ Cancels notifications under a notification group of this application. This API u | Name | Type | Mandatory| Description | | --------- | ------ | ---- | -------------- | -| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) when the notification is published.| +| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest-1) when the notification is published.| **Return value** @@ -1223,7 +1223,7 @@ notificationManager.cancelGroup(groupName).then(() => { isSupportTemplate(templateName: string, callback: AsyncCallback\): void -Checks whether a specified template is supported. This API uses an asynchronous callback to return the result. +Checks whether a specified template is supported before using [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md) to publish a notification. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Notification.Notification @@ -1255,7 +1255,7 @@ let isSupportTemplateCallback = (err: BusinessError, data: boolean): void => { if (err) { console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`); } else { - console.info("isSupportTemplate success, data: " + JSON.stringify(data)); + console.info(`isSupportTemplate success, data: ${JSON.stringify(data)}`); } } notificationManager.isSupportTemplate(templateName, isSupportTemplateCallback); @@ -1299,7 +1299,7 @@ import { BusinessError } from '@kit.BasicServicesKit'; let templateName: string = 'downloadTemplate'; notificationManager.isSupportTemplate(templateName).then((data: boolean) => { - console.info("isSupportTemplate success, data: " + JSON.stringify(data)); + console.info(`isSupportTemplate success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`); }); @@ -1554,7 +1554,7 @@ let isDistributedEnabledCallback = (err: BusinessError, data: boolean): void => if (err) { console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`); } else { - console.info("isDistributedEnabled success " + JSON.stringify(data)); + console.info(`isDistributedEnabled success ${JSON.stringify(data)}`); } }; notificationManager.isDistributedEnabled(isDistributedEnabledCallback); @@ -1591,7 +1591,7 @@ For details about the error codes, see [Universal Error Codes](../errorcode-univ import { BusinessError } from '@kit.BasicServicesKit'; notificationManager.isDistributedEnabled().then((data: boolean) => { - console.info("isDistributedEnabled success, data: " + JSON.stringify(data)); + console.info(`isDistributedEnabled success, data: ${JSON.stringify(data)}`); }).catch((err: BusinessError) => { console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`); }); @@ -1756,7 +1756,7 @@ Describes the notification content. | Type| Description| | --- | --- | -| [_NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | Notification content.| +| [_NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent-1) | Notification content.| ## NotificationLongTextContent @@ -1816,7 +1816,7 @@ Describes the notification request. | Type| Description| | --- | --- | -| [_NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Notification request.| +| [_NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest-1) | Notification request.| ## DistributedOptions -- Gitee