RemoteMessage
@SafeParcelable.Reserved(value = [1])
@SafeParcelable.Class(creator = "RemoteMessageCreator")
public final class RemoteMessage extends AbstractSafeParcelable
| java.lang.Object | ||
| ↳ | com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable | |
| ↳ | com.google.firebase.messaging.RemoteMessage |
A remote Firebase Message.
Messages will be received via onMessageReceived.
Messages may have a Notification instance if they are received while the application is in the foreground, otherwise they will be automatically posted to the notification tray.
Summary
Nested types |
|---|
public class RemoteMessage.BuilderBuilder object for constructing |
@IntDef(value = )Priority of the message |
public class RemoteMessage.NotificationRemote Firebase notification details. |
Constants |
|
|---|---|
static final int |
PRIORITY_HIGH = 1 |
static final int |
PRIORITY_NORMAL = 2 |
static final int |
PRIORITY_UNKNOWN = 0 |
Public fields |
|
|---|---|
Map<String, String> |
|
RemoteMessage.Notification |
Public methods |
|
|---|---|
@Nullable String |
Gets the collapse key of the message. |
@NonNull Map<String, String> |
getData()Gets the message payload data. |
@Nullable String |
getFrom()Get the sender of this message. |
@Nullable String |
Gets the message's ID. |
@Nullable String |
Gets the type of message. |
@Nullable RemoteMessage.Notification |
Gets the notification data from the message if set. |
int |
Gets the original priority of message. |
int |
Gets the priority of message as delivered. |
@Nullable String |
Gets the Sender ID for the sender of this message. |
long |
Gets the time in milliseconds from the Epoch that the message was sent. |
@Nullable String |
This method is deprecated. This function is actually decommissioned along with all of FCM upstream messaging. |
int |
getTtl()Gets the message time to live (TTL) in seconds. |
void |
writeToParcel(@NonNull Parcel out, int flags) |
Inherited Constants |
||||
|---|---|---|---|---|
|
||||
Inherited methods |
||
|---|---|---|
|
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.
getNotification
public @Nullable RemoteMessage.Notification getNotification()
Gets the notification data from the message if set.
This field will be non-null if a notification message is received while the application is in the foreground.
| Returns | |
|---|---|
@Nullable RemoteMessage.Notification |
The message notification or null. |
getOriginalPriority
@RemoteMessage.MessagePriority
public int getOriginalPriority()
Gets the original priority of message.
| Returns | |
|---|---|
int |
The original message priority |
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 |
getSenderId
public @Nullable String getSenderId()
Gets the Sender ID for the sender of this message.
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 |