Skip to content

You are here: Notification APIs

Notifications

Notifications are the means to keep the users informed about relevant events in your app such as a calendar event and a news update.

Notifications are of two types:

  • Local Notifications: These notifications are scheduled in the app locally and delivered to the same device. Example, calendar event.
  • Push Notifications: These notifications are sent from a remote server to the device on which the app is installed. For example, if you have installed a news app in your device, you will receive timely news updates for that app.

For more information on notification settings, refer Notification Settings.

The Notifications API comprises of the following Namespaces and functions:

voltmx.localnotifications Namespace

Function Description
voltmx.localnotifications.cancel Cancels the specified notifications.
voltmx.localnotifications.create Creates a local notification.
voltmx.localnotifications.getNotifications Retrieves the pending local notifications.
voltmx.localnotifications.setCallbacks Associates online and offline callbacks for local notifications.

voltmx.push Namespace

Function Description
voltmx.push.deRegister Allows an application on a device to deregister from Push Notifications.
voltmx.push.register Allows you to register the application and the mobile device for Push Notifications.
voltmx.push.setCallbacks You can specify the functions to be executed for Push Notification in an Object for this API.

voltmx.notificationsettings Namespace

Function Description
voltmx.notificationsettings.createAction Creates an action that can be used with category.
voltmx.notificationsettings.createCategory Creates a category with a group of created actions.
voltmx.notificationsettings.registerCategory Registers the created category with the application.
voltmx.notificationsettings.pickTitleAndDescriptionFromPushPayload The Title and Description details of the payload are considered when the value is set to true.
voltmx.notificationsettings.setShowBadge Enables or disables notification badges for push or local notifications that are only supported by Volt MX Iris Framework.

The Notifications API enables you to set local notifications, register for push notifications and configure various notification settings.

To design a local notification, use the voltmx.localnotifications.create function. Use the voltmx.localnotifications.setCallbacks function to configure callbacks depending on the type of the notification that is triggered. If you want to see pending notifications, use the voltmx.localnotifications.getNotifications function. To cancel a local notification, use the voltmx.localnotifications.cancel function.

To enroll an application on your device for Push Notifications, use the voltmx.push.register function. Then configure the callbacks by using the voltmx.push.setCallbacks function. If you want to stop receiving push notifications for an application use the voltmx.push.deRegister function.

You can also configure various notification settings. Create an actions on the notification interface such as accept or decline a calendar event by using the voltmx.notificationsettings.createAction function. Then give a unique ID to the group of actions created by using the voltmx.notificationsettings.createCategory function. Register the created category with the application by using the voltmx.notificationsettings.registerCategory function. You can also display a badge on the push or local notifications by using the voltmx.notificationsettings.setShowBadge function.