Summary: Nested Classes | Inherited Constants | Methods | Inherited Methods | [Expand All]
public final class

# RemoteMessage

extends Object
implements SafeParcelable

java.lang.Object
↳ | com.google.firebase.messaging.RemoteMessage

## Class Overview

A remote Firebase Message. Messages will be received via `onMessageReceived(RemoteMessage)` and can be sent via `send(RemoteMessage)`. Messages may have a `RemoteMessage.Notification` instance if they are received while the application is in the foreground, otherwise they will be automatically posted to the notification tray. Use the `RemoteMessage.Builder` class for building message instances to send via `send(RemoteMessage)`.

## Summary

Nested Classes
class | RemoteMessage.Builder | Builder object for constructing `RemoteMessage` instances.
class | RemoteMessage.Notification | Remote Firebase notification details.

[Expand] Inherited Constants
From interface com.google.android.gms.common.internal.safeparcel.SafeParcelable
String | NULL |
From interface android.os.Parcelable
int | CONTENTS_FILE_DESCRIPTOR |
int | PARCELABLE_WRITE_RETURN_VALUE |

Public Methods
String | getCollapseKey() Get the collapse key of the message.
Map<String, String> | getData() The message payload data.
String | getFrom() Get the sender of this message.
String | getMessageId() Get the message's ID.
String | getMessageType() Get the type of message.
RemoteMessage.Notification | getNotification() Get the message notification if any.
long | getSentTime() Get the time in milliseconds from the Epoch that the message was sent.
String | getTo() Get the message destination.
int | getTtl() Get the message time to live (TTL) in seconds.
void | writeToParcel(Parcel out, int flags)

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.os.Parcelable
abstract int | describeContents()
abstract void | writeToParcel(Parcel arg0, int arg1)

## Public Methods

#### public String getCollapseKey ()

Get the collapse key of the message.

##### Returns

- The collapse key

#### public Map<String, String> getData ()

The message payload data.

##### Returns

- A map of the message payload.

#### public String getFrom ()

Get the sender of this message. This will be the sender ID or the topic for topic messages.

##### Returns

- The message sender

#### public String getMessageId ()

Get the message's ID. This will be the message ID set when sending the message or automatically generated by the server.

##### Returns

- The message ID

#### public String getMessageType ()

Get the type of message.

##### Returns

- The message type

#### public RemoteMessage.Notification getNotification ()

Get the message notification if any. This field will be non-null if a notification message is received while the application is in the foreground.

##### Returns

- The message notification or null.

#### public long getSentTime ()

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

##### Returns

- The time that the message was sent

#### public String getTo ()

Get the message destination. For upstream messages this will be of the form `SENDER_ID&#64;gcm.googleapis.com`.

##### Returns

- The message destination

#### public int getTtl ()

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

##### Returns

- The message TTL

#### public void writeToParcel (Parcel out, int flags)