[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md), inherited from [ExtensionAbility](extensionability-overview.md), is used for developing input method applications.
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
functionsetBadgeNumberCallback(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.`);
# 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
@@ -333,7 +333,7 @@ For non-custom navigation bars, tabs and tab content are linked by default. For
**Figure 11** Lack of linkage between tabs and tab content
![lack-of-linkage](figures/lack-of-linkage.gif)
![lack-of-linkage](figures/lack-of-linkage.gif)
To manually switch between the tabs, use the **onChange** API provided by the **\<Tabs>** component to listen for the index change and pass the index of the active tab to **currentIndex**.