Interface NotificationChannelListener


public interface NotificationChannelListener

You should implement (and register) the NotificationChannelListener if you want to receive a callback when a user has dismissed a notification from their screen. The NotificationChannelListener also allows your application to receive information about other interactions with an onscreen notification. For example, the user interface may inform your adapter that a notification has been read.

The DISMISS action is handled automatically, removing the dismissed notification from the channel, but a callback is still received on registered listeners.

Register this listener on the incoming channel from NotificationApplicationListener.notificationChannelOpened(com.caplin.datasource.notification.NotificationChannel)

The onNotificationRequest is received when a request for a notification comes in that refers to a notification that hasn't been sent on this channel previously. That is, one which has been sent by a different NotificationProvider with the same source name for the same user from a separate adapter. A use case for this set up is having one adapter publishing which Notifications are available (Notifications with no fields set) and another providing the notification fields (Notifications with fields set). Notification requests would be received by the fields-provider for notifications sent by the available-notifications-provider which would trigger the onNotificationRequest callback. Simply send the requested notifications on the channel or submit a NotificationChannel.sendNotificationNotFound(java.lang.String) to the NotificationChannel received on the onNotificationRequest(com.caplin.datasource.notification.NotificationChannel, java.lang.String) callback.

Refer to the NotificationConfiguration for how to configure this use case.

  • Method Details

    • onNotificationAction

      void onNotificationAction(NotificationChannel channel, String notificationId, String action)

      Called when a contrib comes in for a Notification serviced by this provider.

      This callback enables the provider to respond to a contrib asynchronously.

      The action DISMISS is a special case - dismissed notifications will be removed from the channel automatically.

      Parameters:
      channel - The user's NotificationChannel
      notificationId - The unique identifier for the notification in the channel
      action - The action sent to the provider.
    • onNotificationRequest

      void onNotificationRequest(NotificationChannel channel, String notificationId)

      Called when a previously unsubmitted notification in a channel is requested.

      This callback enables a response to a notification request to be sent asynchronously, to respond to the request use NotificationChannel.sendNotification(com.caplin.datasource.notification.Notification) or if a not found is required use NotificationChannel.sendNotificationNotFound(java.lang.String) both using the same uniqueId as an input.

      Parameters:
      channel - The user's notification channel
      notificationId - The unique identifier for the notification in the channel