Skip to content

You are here: Badge API

Badge API

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 Volt MX, you can configure a badge for the following:

  • Apps
  • App Menus

The Badge API uses the voltmx.application Namespace and the following API elements.

Function Description
voltmx.application.getApplicationBadgevalue Reads the badge value (if any) attached to the given application icon.
voltmx.application.getAppMenuBadgeValue Reads the badge value (if any) attached to the specified app menu item.
voltmx.application.setApplicationBadgeValue Sets a badge value to an application icon on the mobile desktop at the top-right corner of the application icon
voltmx.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 voltmx.application.setApplicationBadgeValue function. To know about an existing badge value an app, you can use the voltmx.application.getApplicationBadgeValue function.

Similarly, to configure the badge value for an AppMenu, you can use the voltmx.application.setAppMenuBadgeValue function. To know about an existing badge value an app, you can use the voltmx.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 Volt MX App.