java.lang.Object
com.gluonhq.attach.localnotifications.Notification

public class Notification extends Object
Represents a single notification that can be installed onto the system using LocalNotificationsService.
Since:
3.0.0
See Also:
  • Constructor Details

    • Notification

      public Notification(String id, String text, ZonedDateTime dateTime, Runnable runnable)
      Creates a new Notification instance with the specified id and text, set to be displayed on the users device as the given date/time, and when clicked will execute the given Runnable.
      Parameters:
      id - The unique ID of this notification. It should remain the same through multiple executions of the application.
      text - The text to show in the native notification popup.
      dateTime - The date and time to show the notification.
      runnable - The code to run when the user clicks on the notification.
    • Notification

      public Notification(String id, String title, String text, ZonedDateTime dateTime, Runnable runnable)
      Creates a new Notification instance with the specified id, title, and text, set to be displayed on the users device as the given date/time, and when clicked will execute the given Runnable.
      Parameters:
      id - The unique ID of this notification. It should remain the same through multiple executions of the application.
      title - The title text to show in the native notification popup.
      text - The text to show in the native notification popup.
      dateTime - The date and time to show the notification.
      runnable - The code to run when the user clicks on the notification.
    • Notification

      public Notification(String id, String title, String text, InputStream imageInputStream, ZonedDateTime dateTime, Runnable runnable)
      Creates a new Notification instance with the specified id, title, text, and image, set to be displayed on the users device as the given date/time, and when clicked will execute the given Runnable.
      Parameters:
      id - The unique ID of this notification. It should remain the same through multiple executions of the application.
      title - The title text to show in the native notification popup.
      text - The text to show in the native notification popup.
      imageInputStream - An input stream containing image data that can be displayed in the native notification popup.
      dateTime - The date and time to show the notification.
      runnable - The code to run when the user clicks on the notification.
  • Method Details

    • getId

      public final String getId()
      The id of the notification. A unique id that will be used to schedule or find the notification on the device Note: This id will be used over multiple runs of the application so it must remain the same, and not be reused for other notifications
      Returns:
      The unique ID of this notification.
    • getTitle

      public final String getTitle()
      The title of the notification
      Returns:
      a String with the title
    • getText

      public final String getText()
      The content of the notification
      Returns:
      a String with the text
    • getImageInputStream

      public final InputStream getImageInputStream()
      The InputStream with an image for the notification's logo
      Returns:
      an InputStream
    • getDateTime

      public final ZonedDateTime getDateTime()
      The ZonedDateTime with the time when the notification is scheduled
      Returns:
      a ZonedDateTime
    • getRunnable

      public final Runnable getRunnable()
      A runnable to be executed when the notification is displayed and clicked by the user on the device
      Returns:
      a Runnable
    • toString

      public String toString()
      Overrides:
      toString in class Object