Badge APIs
Badging is a concept used in both iOS and Android platforms to indicate to user, information about an app or an app menu. Badging works as a notification to the users. Based on the information provided, user’s can take some action. However, badging does not explicitly ask the users to take any action.
The number of unread messages on your mobile device that is indicated is an example of the badge API.
Using the Badge API in Quantum, you can configure a badge for the following:
- Apps
- App Menus
The Badge API uses the kony.application
namespace and the following API elements.
Function | Description |
---|---|
kony.application.getApplicationBadgevalue
|
Reads the badge value (if any) attached to the given application icon. |
kony.application.getAppMenuBadgeValue
|
Reads the badge value (if any) attached to the specified app menu item. |
kony.application.setApplicationBadgeValue
|
Sets a badge value to an application icon on the mobile desktop at the top-right corner of the application icon |
kony.application.setAppMenuBadgeValue
|
Sets a badge value to the specified app menu item on the top-right corner of the app menu item. |
Depending upon the type of badge you want to set, Badge API functions vary.
To configure the badge value for an App, you can use the kony.application.setApplicationBadgeValue
function. To know about an existing badge value an app, you can use the kony.application.getApplicationBadgeValue
function.
Similarly, to configure the badge value for an AppMenu, you can use the kony.application.setAppMenuBadgeValue
function. To know about an existing badge value an app, you can use the kony.application.getAppMenuBadgeValue
function.
In addition, each widget supports the following methods for working with badges.
To view the functionality of the Badge API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Quantum App.