Interface NotificationInterceptor


  • public interface NotificationInterceptor
    Defines a mechanism for intercepting notifications generated within an application before they're displayed. Implementers of this interface can inspect, modify, or suppress notifications based on specific criteria or logic.
    The interceptor is designed to work with local notifications, offering a way to customize notification content, behavior, or appearance directly within the application, rather than handling push notifications which are managed externally.
    Also an interceptor is also called for local notifications and not only for push notifications via Firebase. The ability to modify or suppress notifications can help to honor user preferences and to maintain consistency with the application's overall notification strategy.
    • Method Detail

      • onIntercept

        @Nullable
        UnbluNotification onIntercept​(@NonNull
                                      UnbluNotification notification,
                                      UnbluNotificationTag tag)
        Interceptor function that allows you to retrieve the notification and modify its contents before it's displayed.

        The notification's only displayed if you pass the method a notification to display.

        The interceptor only works while the sdk is initialized, meaning it should not get triggered when the app is not running.

        Parameters:
        notification - The intercepted notification
        tag - The tag of the intercepted notification
        Returns:
        An UnbluNotification instance or null to prevent displaying any notification