Notification Filters allows you to implement specific behaviors for when Notifications are created or deleted in your application.
You can generate a specific algorithm to determine when the notification process will be started.
For example, you can decide to display a notification when in proximity of a specific bus stop or specific bus line. You can also decide to only send a maximum of 2 notifications every 30 min.
Connecthings' SDK provides you with a sample set of Notifications Filters, which you can freely use. You can also code your own, and implement as many as you want in your application.
You can configure the filters you want to use directly on the App Settings section of the Herow Platform, including your own.
And so, your filters will be automatically active/disable in your application depending on the schedulingInterval variable you seized on the App Settings section.
Notification Filters are simple, unitary rules to facilitate notification management. Complex rules can be achieved by cumulating various Notification Filters.
Using Notification Filters provided by Connecthings
We provide two built-in NotificationFilters.
They are directly available through the Herow App Settings section under the Enable time filters section in the Notifcations Tab.
The Notification Filter interface/delegate
A Notification Filter must implement the following methods:
getName: this method returns the string key associated to your notification strategy that was created. You must add this key to the appropriate custom notification filter field on Herow.
updateParameters: for now, this method is for Connecthings' SDK private use.
deleteCurrentNotification: to know if the SDK has to delete the currently displayed notification. If no notification is displayed, the method is not called. By default, the method must return true.
createNewNotification: to know if the SDK has to create a new notification. If the method deleteCurrentNotification returns "false", this method is not called. By default, the method must return true.
onNotificationCreated: to notify the Filter that a notification has been created.
onNotificationDeleted: to notify the Filter that a notification has been deleted.
onBackground: to notify the Filter that the application is going to background.
onForeground: to notify the Filter that the application is going to foreground.
load: to retrieve the data previously stored by the Filter.
save: to save data needed by the Filter when the application restarts.
Notification Lifecycle with Notification Filters
The following diagram gives an overview of the notification lifecycle, and includes the various queries to the Notification Filter methods.