Class Notification
- java.lang.Object
-
- com.gluonhq.attach.localnotifications.Notification
-
public class Notification extends java.lang.Object
Represents a single notification that can be installed onto the system usingLocalNotificationsService
.- Since:
- 3.0.0
- See Also:
LocalNotificationsService
-
-
Constructor Summary
Constructors Constructor Description Notification(java.lang.String id, java.lang.String title, java.lang.String text, java.io.InputStream imageInputStream, java.time.ZonedDateTime dateTime, java.lang.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.Notification(java.lang.String id, java.lang.String title, java.lang.String text, java.time.ZonedDateTime dateTime, java.lang.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.Notification(java.lang.String id, java.lang.String text, java.time.ZonedDateTime dateTime, java.lang.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.ZonedDateTime
getDateTime()
TheZonedDateTime
with the time when the notification is scheduledjava.lang.String
getId()
The id of the notification.java.io.InputStream
getImageInputStream()
TheInputStream
with an image for the notification's logojava.lang.Runnable
getRunnable()
A runnable to be executed when the notification is displayed and clicked by the user on the devicejava.lang.String
getText()
The content of the notificationjava.lang.String
getTitle()
The title of the notificationjava.lang.String
toString()
-
-
-
Constructor Detail
-
Notification
public Notification(java.lang.String id, java.lang.String text, java.time.ZonedDateTime dateTime, java.lang.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(java.lang.String id, java.lang.String title, java.lang.String text, java.time.ZonedDateTime dateTime, java.lang.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(java.lang.String id, java.lang.String title, java.lang.String text, java.io.InputStream imageInputStream, java.time.ZonedDateTime dateTime, java.lang.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 Detail
-
getId
public final java.lang.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 java.lang.String getTitle()
The title of the notification- Returns:
- a String with the title
-
getText
public final java.lang.String getText()
The content of the notification- Returns:
- a String with the text
-
getImageInputStream
public final java.io.InputStream getImageInputStream()
TheInputStream
with an image for the notification's logo- Returns:
- an InputStream
-
getDateTime
public final java.time.ZonedDateTime getDateTime()
TheZonedDateTime
with the time when the notification is scheduled- Returns:
- a ZonedDateTime
-
getRunnable
public final java.lang.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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-