Interface NotificationListener
Interface that should be implemented to receive notification change callbacks from the NotificationProvider
A trivial implementation of NotificationListener
would be:
import com.caplin.streamlink.ServiceStatus;
import com.caplin.streamlink.StreamLink;
import com.caplin.streamlink.alerts.Notification;
import com.caplin.streamlink.alerts.NotificationListener;
import com.caplin.streamlink.alerts.NotificationService;
public class NotificationListenerSnippet
{
private NotificationService notificationService;
public NotificationListenerSnippet( StreamLink streamLink )
{
this.notificationService = new NotificationService(streamLink);
notificationService.addListener(new NotificationListener()
{
@Override
public void onNotificationRemoved( Notification notification )
{
System.out.println("onNotificationRemoved(" + notification.toString() + ")");
}
@Override
public void onNotification ( Notification notification )
{
System.out.println("onNotification(" + notification.toString() + ")");
}
@Override
public void onServiceStatus( ServiceStatus status )
{
System.out.println("onServiceStatus(" + status.toString() + ")");
}
});
}
}
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onNotification
(Notification notification) Received when notification gets added to the container.void
onNotificationRemoved
(Notification notification) Received when notification is removed from the container.void
onServiceStatus
(ServiceStatus status) Received when the notification service availability changes.
-
Method Details
-
onNotification
Received when notification gets added to the container.
- Parameters:
notification
-Notification
-
onNotificationRemoved
Received when notification is removed from the container.
- Parameters:
notification
-Notification
-
onServiceStatus
Received when the notification service availability changes.
- Parameters:
status
- the updatedServiceStatus
.
-