RemoteMessage.Notification

public class RemoteMessage.Notification


Remote Firebase notification details.

This class maps to the fields of a notification message.

Summary

Public fields

final String
final String
final String
final String
final boolean
final boolean
final Long
final String
final int[]
final Uri
final boolean
final Integer
final Integer
final String
final boolean
final String
final String
final String
final long[]
final Integer

Public methods

@Nullable String

Gets the body of the notification, or null if not set.

@Nullable String[]

Gets the variable string values to be used as format specifiers in the body localization key, or null if not set.

@Nullable String

Gets the string resource name to use to localize the body of the notification, or null if not set.

@Nullable String

Gets the channel id from the notification, or null if not set.

@Nullable String

Gets the action to be performed on the user opening the notification, or null if not set.

@Nullable String

Gets the color of the notification, or null if not set.

boolean

Gets whether or not the notification uses the default notification light settings.

boolean

Gets whether or not the notification uses the default sound.

boolean

Gets whether or not the notification uses the default vibrate pattern.

@Nullable Long

Gets the eventTime from the notification.

@Nullable String

Gets the image resource name of the icon of the notification, or null if not set.

@Nullable Uri

Gets the image URL from the notification.

@Nullable int[]

Gets the lightSettings from the notification.

@Nullable Uri

Gets the deep link from the notification, or null if not set.

boolean

Gets whether or not this notification is only relevant to the current device.

@Nullable Integer

Gets the notificationCount from the notification.

@Nullable Integer

Gets the notificationPriority from the notification.

@Nullable String

Gets the sound to be played when the notification is shown, or null if not set.

boolean

Gets whether or not the notification is considered sticky.

@Nullable String

Gets the tag of the notification, or null if not set.

@Nullable String

Gets the ticker text from the notification.

@Nullable String

Gets the title of the notification, or null if not set.

@Nullable String[]

Gets the variable string values to be used as format specifiers in the title localization key, or null if not set.

@Nullable String

Gets the string resource name to use to localize the title of the notification, or null if not set.

@Nullable long[]

Gets the vibrateTimings from the notification.

@Nullable Integer

Gets the visibility from the notification.

Public fields

body

public final String body

channelId

public final String channelId

clickAction

public final String clickAction

color

public final String color

defaultLightSettings

public final boolean defaultLightSettings

defaultSound

public final boolean defaultSound

eventTime

public final Long eventTime

icon

public final String icon

lightSettings

public final int[] lightSettings

link

public final Uri link

localOnly

public final boolean localOnly

notificationCount

public final Integer notificationCount

notificationPriority

public final Integer notificationPriority

sound

public final String sound

sticky

public final boolean sticky

tag

public final String tag

ticker

public final String ticker

title

public final String title

vibrateTimings

public final long[] vibrateTimings

visibility

public final Integer visibility

Public methods

getBody

public @Nullable String getBody()

Gets the body of the notification, or null if not set.

getBodyLocalizationArgs

public @Nullable String[] getBodyLocalizationArgs()

Gets the variable string values to be used as format specifiers in the body localization key, or null if not set.

getBodyLocalizationKey

public @Nullable String getBodyLocalizationKey()

Gets the string resource name to use to localize the body of the notification, or null if not set.

getChannelId

public @Nullable String getChannelId()

Gets the channel id from the notification, or null if not set.

Note that this method does not perform verification on the existence of a channel, nor does it fallback to the manifest defined default or the default Firebase Cloud Messaging channel.

getClickAction

public @Nullable String getClickAction()

Gets the action to be performed on the user opening the notification, or null if not set.

The action is to open an Activity with matching intent filter.

getColor

public @Nullable String getColor()

Gets the color of the notification, or null if not set.

Color is expressed in #rrggbb format.

getDefaultLightSettings

public boolean getDefaultLightSettings()

Gets whether or not the notification uses the default notification light settings.

See details about defaultLightSettings in Firebase Cloud Messaging Reference: HTTP v1 API.

Returns
boolean

true if it is set to true; Otherwise false.

getDefaultSound

public boolean getDefaultSound()

Gets whether or not the notification uses the default sound.

See details about defaultSound in Firebase Cloud Messaging Reference: HTTP v1 API.

Returns
boolean

true if it is set to true; Otherwise false.

getDefaultVibrateSettings

public boolean getDefaultVibrateSettings()

Gets whether or not the notification uses the default vibrate pattern.

See details about defaultVibrateTimings in Firebase Cloud Messaging Reference: HTTP v1 API.

Returns
boolean

true if it is set to true; Otherwise false.

getEventTime

public @Nullable Long getEventTime()

Gets the eventTime from the notification.

See details about eventTime in Firebase Cloud Messaging Reference: HTTP v1 API.

getIcon

public @Nullable String getIcon()

Gets the image resource name of the icon of the notification, or null if not set.

getImageUrl

public @Nullable Uri getImageUrl()

Gets the image URL from the notification.

Returns
@Nullable Uri

The image URL if it was set, null otherwise.

getLightSettings

public @Nullable int[] getLightSettings()

Gets the lightSettings from the notification. lightSettings is an primitive integer array of size three that includes color, lightOnDuration and lightOffDuration respectively.

See details about lightSettings in Firebase Cloud Messaging Reference: HTTP v1 API.

getLink

public @Nullable Uri getLink()

Gets the deep link from the notification, or null if not set.

getLocalOnly

public boolean getLocalOnly()

Gets whether or not this notification is only relevant to the current device.

See details about localOnly in Firebase Cloud Messaging Reference: HTTP v1 API.

Returns
boolean

true if it is set to true; Otherwise false.

getNotificationCount

public @Nullable Integer getNotificationCount()

Gets the notificationCount from the notification.

See details about notificationCount in Firebase Cloud Messaging Reference: HTTP v1 API.

getNotificationPriority

public @Nullable Integer getNotificationPriority()

Gets the notificationPriority from the notification.

See details about notificationPriority in Firebase Cloud Messaging Reference: HTTP v1 API.

getSound

public @Nullable String getSound()

Gets the sound to be played when the notification is shown, or null if not set.

This will be either a raw resource name, or "default" for the user's default notification sound.

getSticky

public boolean getSticky()

Gets whether or not the notification is considered sticky.

See details about sticky in Firebase Cloud Messaging Reference: HTTP v1 API.

Returns
boolean

true if it is set to true; Otherwise false.

getTag

public @Nullable String getTag()

Gets the tag of the notification, or null if not set.

getTicker

public @Nullable String getTicker()

Gets the ticker text from the notification.

getTitle

public @Nullable String getTitle()

Gets the title of the notification, or null if not set.

getTitleLocalizationArgs

public @Nullable String[] getTitleLocalizationArgs()

Gets the variable string values to be used as format specifiers in the title localization key, or null if not set.

getTitleLocalizationKey

public @Nullable String getTitleLocalizationKey()

Gets the string resource name to use to localize the title of the notification, or null if not set.

getVibrateTimings

public @Nullable long[] getVibrateTimings()

Gets the vibrateTimings from the notification.

See details about vibrateTimings in Firebase Cloud Messaging Reference: HTTP v1 API.

getVisibility

public @Nullable Integer getVisibility()

Gets the visibility from the notification.

See details about visibility in Firebase Cloud Messaging Reference: HTTP v1 API.