java.lang.Object | |
↳ | com.neomades.notification.Notification |
![]() |
A notification is a graphical object that presents notifications: information
that an application can schedule for presentation at a specific date. The
notifications are triggered by a NotificationManager
for local
notification or can be built from a PushMessage
for push
notifications.
Notification graphical interface depends of the platform, lot of options are
only available for some specific platforms. However, the main information,
the notification text (setText(String)
), is available everywhere, be
sure to use it when displaying the notification content.
Most of the time, clicking on a notification will automatically open the
application. Transition between notification to application will result to a
call to onLocalNotificationReceived(Notification)
. Use
this method to do specific behavior between the transition notification -
application.
Android
, the Notification is a
android.app.Notification
. Notifications will appear in the
status bar.iOS
, the Notification is a
UILocalNotification
. The notification is displayed in the status
bar. A notification is not displayed if the application that owns is
opened.Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Notification()
Creates a new empty Notification.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String |
getExtras()
Returns the notification extra.
| ||||||||||
int |
getId()
Returns the notification identifier.
| ||||||||||
String |
getText()
Returns the notification description text.
| ||||||||||
String |
getTitle()
Returns the notification title.
| ||||||||||
Notification |
setAccessoryIcon(int accessoryIcon)
Sets the notification icon displayed in the status bar.
| ||||||||||
Notification |
setAccessoryIcon(Image accessoryIcon)
Sets the notification icon displayed in the status bar.
| ||||||||||
Notification |
setAutoCancel(boolean on)
Sets whether the notification should be removed in the phone status bar when
the end-user has clicked to the notification.
| ||||||||||
Notification |
setBadge(int badge)
Sets the badge number inside the Application icon (iOS).
| ||||||||||
Notification |
setDate(Date date)
Sets a date to display in the notification.
| ||||||||||
Notification |
setExtras(String extras)
Sets extra information embedded into this notification.
| ||||||||||
Notification |
setIcon(Image icon)
Set a large icon that is shown on the right in the notification (optional).
| ||||||||||
Notification |
setIcon(int icon)
Set a large icon that is shown on the right in the notification (optional).
| ||||||||||
Notification |
setId(int id)
Sets an identifier/tag to this element
| ||||||||||
Notification |
setLED(Color color, int onMs, int offMs)
Sets the Color that you would like the LED on the device to blink, as well as
the rate.
| ||||||||||
Notification |
setLaunchImage(int launchImage)
Sets an image to display when launching an application from the notification,
during the application loading.
| ||||||||||
Notification |
setSound(int sound)
Sets a sound to play when the notification is displayed.
| ||||||||||
Notification |
setSubText(String subText)
Sets a subtitle for Android notification.
| ||||||||||
Notification |
setText(String string)
Sets the details text of this notification.
| ||||||||||
Notification |
setText(int text)
Sets the details text of this notification.
| ||||||||||
Notification |
setTitle(int title)
Sets the title of this notification.
| ||||||||||
Notification |
setTitle(String title)
Sets the title of this notification.
| ||||||||||
Notification |
setVibration(long[] vibrations)
Sets a vibration pattern to use when the notification appears.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates a new empty Notification.
Returns the notification description text.
Returns the notification title. Default is the name of the application.
Sets the notification icon displayed in the status bar.
If no image is set, the icon of the application will be used.
Only available on Android.
accessoryIcon | must be an image from the resources |
---|
Sets the notification icon displayed in the status bar.
If no image is set, the icon of the application will be used.
Only available on Android.
accessoryIcon | must be an image from the resources |
---|
Sets whether the notification should be removed in the phone status bar when the end-user has clicked to the notification.
Only available for android.
on | true if the notification should disappear in the status bar |
---|
Sets the badge number inside the Application icon (iOS).
badge | the badge number (positive value to show the number, 0 or negative to hide it) |
---|
Sets a date to display in the notification.
In iOS, the date must be the date at which the notification was sent and it cannot be changed.
date | a date to show in the notification |
---|
Sets extra information embedded into this notification.
extras | extra information |
---|
Set a large icon that is shown on the right in the notification (optional).
Only available on Android.
icon | must be an image from the resources |
---|
Set a large icon that is shown on the right in the notification (optional).
Only available on Android.
icon | must be an image from the resources |
---|
Sets an identifier/tag to this element
id | the identifier |
---|
Sets the Color that you would like the LED on the device to blink, as well as the rate. The rate is set in millisecond, the first parameter indicate the time for which the LED is on, the second the time for which the LED is off. The hardware will do its best to match the blinking pattern.
Only available on Android
color | the color of the LED when on |
---|---|
onMs | the time for the LED to be on |
offMs | the time for the LED to be off |
Sets an image to display when launching an application from the notification, during the application loading.
Only available on iOS.
launchImage | an image from the resources to display as the launch image |
---|
Sets a sound to play when the notification is displayed. It will replace the default platform sound.
In Android, setting a sound has no effect.
sound | a sound from the resources to play when the notification is displayed |
---|
Sets a subtitle for Android notification.
Only available for android.
subText | a text |
---|
Sets the details text of this notification.
string | the message displayed in the notification |
---|
Sets the details text of this notification.
text | string from resource to display in the notification |
---|
Sets the title of this notification.
In iOS, even if the title is changed, the title displayed in the notification
will be the application name. However, if getTitle()
is used later
on the code and a title was set, it is the title you set that will be
returned.
title | title from resources |
---|
Sets the title of this notification.
In iOS, even if the title is changed, the title displayed in the notification
will be the application name. However, if getTitle()
is used later
on the code and a title was set, it is the title you set that will be
returned.
title | the title of the notification |
---|
Sets a vibration pattern to use when the notification appears. It is an array of long where the first value indicates the number of milliseconds to wait before turning the vibrator on and the next value indicates the number of milliseconds for which to keep the vibrator on before turning it off. The hardware will do its best to match the vibration pattern.
This method requires the caller to hold the permission VIBRATE.
Only available on Android
vibrations | an array of longs of times for which to turn the vibrator on or off. |
---|