RemoteMessage  |  Firebase SDKs for Android (original) (raw)

@SafeParcelable.Reserved(value = [1])
@SafeParcelable.Class(creator = "RemoteMessageCreator")
public final class RemoteMessage extends AbstractSafeParcelable


A remote Firebase Message.

Messages will be received via [onMessageReceived](/docs/reference/android/com/google/firebase/messaging/FirebaseMessagingService#onMessageReceived%28com.google.firebase.messaging.RemoteMessage%29).

Messages may have a [Notification](/docs/reference/android/com/google/firebase/messaging/RemoteMessage.Notification) instance if they are received while the application is in the foreground, otherwise they will be automatically posted to the notification tray.

Summary

Constants

Public fields

Public methods

getFrom

public @Nullable String getFrom()

Get the sender of this message.

This will be the sender ID or the topic for topic messages.

getMessageId

public @Nullable String getMessageId()

Gets the message's ID.

This is automatically generated by the server. Treat it as an opaque string. Do not rely on its format to be consistent.

getPriority

@RemoteMessage.MessagePriority
public int getPriority()

Gets the priority of message as delivered. This may be lower than the priority originally requested.

Returns
int The message priority as delivered

getSentTime

public long getSentTime()

Gets the time in milliseconds from the Epoch that the message was sent.

Returns
long The time that the message was sent

getTtl

public int getTtl()

Gets the message time to live (TTL) in seconds.

Returns
int The message TTL