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:
kony.localnotifications Namespace
Function | Description |
---|---|
kony.localnotifications.cancel
|
Cancels the specified notifications. |
kony.localnotifications.create
|
Creates a local notification. |
kony.localnotifications.getNotifications
|
Retrieves the pending local notifications. |
kony.localnotifications.setCallbacks
|
Associates online and offline callbacks for local notifications. |
Function | Description |
---|---|
kony.push.deRegister
|
Allows an application on a device to deregister from Push Notifications. |
kony.push.register
|
Allows you to register the application and the mobile device for Push Notifications. |
kony.push.setCallbacks
|
You can specify the functions to be executed for Push Notification in an Object for this API. |
kony.notificationsettings Namespace
Function | Description |
---|---|
kony.notificationsettings.createAction
|
Creates an action that can be used with category. |
kony.notificationsettings.createCategory
|
Creates a category with a group of created actions. |
kony.notificationsettings.registerCategory
|
Registers the created category with the application. |
kony.notificationsettings.pickTitleAndDescriptionFromPushPayload
|
The Title and Description details of the payload are considered when the value is set to true. |
kony.notificationsettings.setShowBadge
|
Enables or disables notification badges for push or local notifications that are only supported by Quantum Visualizer 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 kony.localnotifications.create
function. Use the kony.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 kony.localnotifications.getNotifications
function. To cancel a local notification, use the kony.localnotifications.cancel
function.
To enroll an application on your device for Push Notifications, use the kony.push.register
function. Then configure the callbacks by using the kony.push.setCallbacks
function. If you want to stop receiving push notifications for an application use the kony.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 kony.notificationsettings.createAction
function. Then give a unique ID to the group of actions created by using the kony.notificationsettings.createCategory
function. Register the created category with the application by using the kony.notificationsettings.registerCategory
function. You can also display a badge on the push or local notifications by using the kony.notificationsettings.setShowBadge
function.