Interface NotificationListener


  • public 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 Detail

      • onNotification

        void onNotification​(Notification notification)

        Received when notification gets added to the container.

        Parameters:
        notification - Notification
      • onNotificationRemoved

        void onNotificationRemoved​(Notification notification)

        Received when notification is removed from the container.

        Parameters:
        notification - Notification
      • onServiceStatus

        void onServiceStatus​(ServiceStatus status)

        Received when the notification service availability changes.

        Parameters:
        status - the updated ServiceStatus.