Class Notification
java.lang.Object
com.gluonhq.attach.localnotifications.Notification
Represents a single notification that can be installed onto the system using
LocalNotificationsService
.- Since:
- 3.0.0
- See Also:
-
Constructor Summary
ConstructorDescriptionNotification
(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.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.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. -
Method Summary
Modifier and TypeMethodDescriptionfinal ZonedDateTime
TheZonedDateTime
with the time when the notification is scheduledfinal String
getId()
The id of the notification.final InputStream
TheInputStream
with an image for the notification's logofinal Runnable
A runnable to be executed when the notification is displayed and clicked by the user on the devicefinal String
getText()
The content of the notificationfinal String
getTitle()
The title of the notificationtoString()
-
Constructor Details
-
Notification
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
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
The title of the notification- Returns:
- a String with the title
-
getText
The content of the notification- Returns:
- a String with the text
-
getImageInputStream
TheInputStream
with an image for the notification's logo- Returns:
- an InputStream
-
getDateTime
TheZonedDateTime
with the time when the notification is scheduled- Returns:
- a ZonedDateTime
-
getRunnable
A runnable to be executed when the notification is displayed and clicked by the user on the device- Returns:
- a Runnable
-
toString
-