diff --git a/en/application-dev/application-models/inputmethodextentionability.md b/en/application-dev/application-models/inputmethodextentionability.md index b36cf2a050cd15c1d4047410406ed46343f604e5..49686c5d5c087d8a484123f0f6d58a12f6283976 100644 --- a/en/application-dev/application-models/inputmethodextentionability.md +++ b/en/application-dev/application-models/inputmethodextentionability.md @@ -1,4 +1,4 @@ -# InputMethodExtensionAbility Development +# InputMethodExtensionAbility ## When to Use [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md), inherited from [ExtensionAbility](extensionability-overview.md), is used for developing input method applications. diff --git a/en/application-dev/notification/Readme-EN.md b/en/application-dev/notification/Readme-EN.md index f7b76df0e99484508bcb073462fd65f0ab3d03cb..47c6303ebec771590779b7cb9e5c3acaf6eaf31c 100644 --- a/en/application-dev/notification/Readme-EN.md +++ b/en/application-dev/notification/Readme-EN.md @@ -1,9 +1,9 @@ # Notification - [Notification Overview](notification-overview.md) -- [Notification Subscription (for System Applications Only)](notification-subscription.md) +- [Subscribing to Notifications (for System Applications Only)](notification-subscription.md) - [Enabling Notification](notification-enable.md) -- [Notification Badge](notification-badge.md) +- [Managing the Notification Badge](notification-badge.md) - Publishing a Notification - [Publishing a Basic Notification](text-notification.md) - [Publishing a Progress Notification](progress-bar-notification.md) diff --git a/en/application-dev/notification/notification-badge.md b/en/application-dev/notification/notification-badge.md index 66d29e659d03ac147a9aa7acc0e1af24b60980c3..5cf38e460c8db944f8608869760e3dfc63c648a7 100644 --- a/en/application-dev/notification/notification-badge.md +++ b/en/application-dev/notification/notification-badge.md @@ -1,4 +1,4 @@ -# Notification Badge +# Managing the Notification Badge OpenHarmony provides APIs for setting the notification badge, which is displayed in the upper right corner of the application icon on the home screen to notify the user of the count of unread notifications. @@ -11,11 +11,11 @@ After a notification is read, the count on the badge is decremented by 1. If the 1. The notification service provides two methods to increase the count on the notification badge: - - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). After the notification is received, the count on the badge is incremented. + - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). After the notification is received, the count on the badge is incremented. - - Call the [setBadgeNumber](../reference/apis/js-apis-notificationManager.md#setbadgenumber) API to set the count on the badge. + - Call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API to set the count on the badge. -2. To decrease the count on the badge, call the **setBadgeNumber** API. +2. To decrease the count on the badge, call the [setBadgeNumber()](../reference/apis/js-apis-notificationManager.md#notificationmanagersetbadgenumber10) API. | API| Description| | -------- | -------- | @@ -32,37 +32,37 @@ After a notification is read, the count on the badge is decremented by 1. If the 2. Increase the count on the badge. - When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md). + When publishing a notification, pass the **badgeNumber** parameter in [NotificationRequest](../reference/apis/js-apis-inner-notification-notificationRequest.md#notificationrequest). For details, see [Publishing a Basic Notification](text-notification.md). In this example, the **setBadgeNumber** API is called to add a badge. This API is called after a new notification is published. ```ts function setBadgeNumberCallback(err) { - if (err) { - console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); - } else { - console.info(`Set badge success`); - } + if (err) { + console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`Succeeded in seting badge number.`); } - let badgeNumber = 10 + let badgeNumber = 10; notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); ``` -3. Reduce the count on the badge. +3. Decrease the count on the badge. After a notification is read, the application needs to call the API to set the number of remaining unread notifications. The badge is then updated. ```ts function setBadgeNumberCallback(err) { - if (err) { - console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); - } else { - console.info(`Set badge success`); - } + if (err) { + console.error(`Failed to set badge number. Code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`Succeeded in seting badge number.`); } - let badgeNumber = 9 + let badgeNumber = 9; notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); ``` diff --git a/en/application-dev/notification/notification-subscription.md b/en/application-dev/notification/notification-subscription.md index 45e75f1f64606cfa89cae2cfae91b89a13faaa5c..68bc11450b9302d66c05b3388ca8096e5c33088f 100644 --- a/en/application-dev/notification/notification-subscription.md +++ b/en/application-dev/notification/notification-subscription.md @@ -1,4 +1,4 @@ -# Notification Subscription (for System Applications Only) +# Subscribing to Notifications (for System Applications Only) To receive notifications, an application must subscribe to notifications first. The notification subsystem provides two types of subscription APIs, allowing applications to subscribe to notifications from all applications or notifications from a specific application. @@ -13,14 +13,14 @@ The major APIs for notification subscription are described as follows. For detai **Table 1** Major APIs for notification subscription -| Name | Description| +| API| Description| | -------- | -------- | | subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void | Subscribes to notifications from a specific application.| | subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | Subscribes to notifications from all applications. | **Table 2** Callbacks for notification subscription -| Name | Description| +| API| Description| | -------- | -------- | | onConsume?:(data: SubscribeCallbackData) => void | Callback for receiving notifications. | | onCancel?:(data: SubscribeCallbackData) => void | Callback for canceling notifications. | diff --git a/en/application-dev/notification/notification-with-wantagent.md b/en/application-dev/notification/notification-with-wantagent.md index 638f53ef2f6f6fce1637468ba4c900496727f23d..3864db71c96b59827bdf4603f48199f27345a2a3 100644 --- a/en/application-dev/notification/notification-with-wantagent.md +++ b/en/application-dev/notification/notification-with-wantagent.md @@ -13,7 +13,7 @@ Below you can see the process of adding a **WantAgent** object to a notification For details about the APIs, see [@ohos.app.ability.wantAgent](../reference/apis/js-apis-app-ability-wantAgent.md). -| Name| Description| +| API | Description| | -------- | -------- | | getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | Creates a **WantAgent** object.| | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | Triggers a **WantAgent** object.|