public class NotificationService
extends java.lang.Object
A NotificationService subscribes to a Notifications container of the StreamLink user and allows the user to register a listener to be called when notifications are triggered or dismissed.
The service itself does not subscribe to anything unless listeners are added to it. For every listener added one subscription is being issued. These subscriptions induce the service state for the associated listeners. Therefore the service states can vary for different listeners. If the reference to the service is removed without removing all listeners beforehand, open subscriptions will stay around forever. To avoid that, remove all listeners before removing the service.
Constructor and Description |
---|
NotificationService(StreamLink streamLink)
Creates a new NotificationService for the given StreamLink instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(NotificationListener listener)
Adds a notification listener that will be called back when notifications are triggered or dismissed.
|
void |
dismissNotification(Notification notification,
ResultListener listener)
Dismiss a notification for the current user.
|
void |
removeListener(NotificationListener listener)
Removes a previously added notification listener, callbacks to this listener will be stopped.
|
public NotificationService(StreamLink streamLink)
Creates a new NotificationService for the given StreamLink instance.
streamLink
- the StreamLink that will be used to receive notifications and dismiss them.public void addListener(NotificationListener listener)
Adds a notification listener that will be called back when notifications are triggered or dismissed.
listener
- The NotificationListener to be added.public void removeListener(NotificationListener listener)
Removes a previously added notification listener, callbacks to this listener will be stopped.
listener
- The NotificationListener to be removed.public void dismissNotification(Notification notification, ResultListener listener)
Dismiss a notification for the current user.
notification
- the notification to dismiss.listener
- a ResultListener that will be called back to notify the user code whether the operation was sent
to liberator successfully or not.Please send bug reports and comments to Caplin support