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 (Notification
s with no fields set)
and another providing the notification fields (Notification
s 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 the NotificationProvider
for this use case.
Modifier and Type | Method and Description |
---|---|
void |
onNotificationAction(NotificationChannel channel,
java.lang.String notificationId,
java.lang.String action)
Called when a contrib comes in for a Notification serviced by this provider.
|
void |
onNotificationRequest(NotificationChannel channel,
java.lang.String notificationId)
Called when a previously unsubmitted notification in a channel is requested.
|
void onNotificationAction(NotificationChannel channel, java.lang.String notificationId, java.lang.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.
channel
- The user's NotificationChannelnotificationId
- The unique identifier for the notification in the channelaction
- The action sent to the provider.void onNotificationRequest(NotificationChannel channel, java.lang.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.
channel
- The user's notification channelnotificationId
- The unique identifier for the notification in the channelPlease send bug reports and comments to Caplin support