Package 

Class BatchNotificationInterceptor


  • 
    public abstract class BatchNotificationInterceptor
    
                        

    Abstract class describing a notification interceptor.

    An interceptor's job is to override some aspects of a notification that Batch wants to display. See the various methods to see what you can override.

    • Method Summary

      Modifier and Type Method Description
      NotificationCompat.Builder getPushNotificationCompatBuilder(@NonNull() Context context, @NonNull() NotificationCompat.Builder defaultBuilder, @NonNull() Bundle pushIntentExtras, int notificationId) Get the builder instance used to generate the notification.
      int getPushNotificationId(@NonNull() Context context, int defaultId, @NonNull() Bundle pushIntentExtras) Notification Id to use when posting the notification to the system.This id should be unique per notification, unless you want to update it with other pushes (such as a sports game score update, for example)If you always return the same value, the notification can behave unexpectedly.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getPushNotificationCompatBuilder

        @Nullable() NotificationCompat.Builder getPushNotificationCompatBuilder(@NonNull() Context context, @NonNull() NotificationCompat.Builder defaultBuilder, @NonNull() Bundle pushIntentExtras, int notificationId)

        Get the builder instance used to generate the notification.If you're basing your builder on defaultBuilder, some methods might have undefined behaviour as Batch already calls many of them.Likewise, returning another instance of the builder than defaultBuilder's might result in loss of functionality if not reimplemented.

        Parameters:
        context - Context.
        defaultBuilder - NotificationCompat builder that has been created and fully configured by Batch.
        pushIntentExtras - Raw push intent extras.
        notificationId - Notification id that will be used to post the notification.
      • getPushNotificationId

         int getPushNotificationId(@NonNull() Context context, int defaultId, @NonNull() Bundle pushIntentExtras)

        Notification Id to use when posting the notification to the system.This id should be unique per notification, unless you want to update it with other pushes (such as a sports game score update, for example)If you always return the same value, the notification can behave unexpectedly.

        Parameters:
        context - Context.
        defaultId - Notification Id that was generated and about to be used by Batch
        pushIntentExtras - Raw push intent extras.