Skip to content

Altering or canceling notifications on the device

Plot Projects offers 2 ways of segmentation: client-side segmentation(with the Plot Projects NotificationFilter) and server-side segmentation (with the Plot Projects Segmentation feature).

In case you're not sure wich one suits your business the most please feel free to contact us so we can explain you a bit more the difference between these two.

More information on server-side segmentation can be found in paragraph Segmenting notifications.

The rest of this paragraph is about client-side segmentation.

When you want to personalize the notifications, you can use the notification filter, it allows you to filter out or edit notifications before they are shown.

Be aware even though the notification reached this stage, doesn't mean it will be displayed to the user. In case you have set up cooldown periods, it will be processed after this step.


Plot automatically detects whether a service is registered in AndroidManifest.xml that extends from the class NotificationFilterBroadcastReceiver. Implementations of NotificationFilterReceiver must implement the method public List<FilterableNotification> filterNotifications(List<FilterableNotification> notifications). When the service is defined Plot will send the notifications to this method before showing them on the mobile device. This allows you to prevent notifications from being shown or change the notifications.

The “data” field of a notification allows you to add custom information to a notification in our dashboard that you can access in the filterNotifications() method. Plot doesn’t prescribe a format for this data. You can use plain text, or for example use JSON.

//Example implementation for filterNotifications:
public class MyNotificationFilterReceiver extends NotificationFilterBroadcastReceiver {
    public List<FilterableNotification> filterNotifications(List<FilterableNotification> notifications) {
        String format = "Hello Paul: %s";
        for (FilterableNotification notification : notifications) {
            String newMessage = String.format(format, notification.getMessage());
        return notifications;

And add this receiver to the manifest:

<receiver android:name=".MyNotificationFilterReceiver" android:exported="false">
       <action android:name="${applicationId}.plot.FilterNotifications" />

It is possible to change the message with the setMessage() method or it is even possible to provide a custom Notification with the setNotification() method on FilterableNotification. By providing a custom notification object it is possible to send rich notifications, for example notifications with an image, to your users. When no custom Notification is specified, Plot will generate a Notification based on the message field and show that one.

We have written a more extensive blog post about this: Using The Notification Filter To Increase Relevance. A larger example is given in another blog post: Using Plot To Create Context-Aware Coupons, Offers And Promotions.