RemoteMessage

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


A remote Firebase Message.

Messages will be received via onMessageReceived and can be sent via send.

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.

Use the Builder class for building message instances to send via send.

Summary

Nested types

Builder object for constructing RemoteMessage instances.

@IntDef(value = )
@Retention(value = RetentionPolicy.SOURCE)
annotation RemoteMessage.MessagePriority

Priority of the message

Remote Firebase notification details.

Constants

const Int
const Int
const Int

Public functions

String?

Gets the collapse key of the message.

String?

Get the sender of this message.

String?

Gets the message's ID.

String?

Gets the type of message.

Int

Gets the original priority of message.

Int

Gets the priority of message as delivered.

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.

String?

Gets the message destination.

Int

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

Unit
writeToParcel(out: Parcel, flags: Int)

Constants

PRIORITY_HIGH

const val PRIORITY_HIGH = 1: Int

PRIORITY_NORMAL

const val PRIORITY_NORMAL = 2: Int

PRIORITY_UNKNOWN

const val PRIORITY_UNKNOWN = 0: Int

Public functions

getCollapseKey

fun getCollapseKey(): String?

Gets the collapse key of the message.

Returns
String?

The collapse key

getFrom

fun getFrom(): String?

Get the sender of this message.

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

Returns
String?

The message sender

getMessageId

fun getMessageId(): String?

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.

Returns
String?

The message ID

getMessageType

fun getMessageType(): String?

Gets the type of message.

Returns
String?

The message type

getOriginalPriority

@RemoteMessage.MessagePriority
fun getOriginalPriority(): Int

Gets the original priority of message.

Returns
Int

The original message priority

getPriority

@RemoteMessage.MessagePriority
fun getPriority(): Int

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

Returns
Int

The message priority as delivered

getSenderId

fun getSenderId(): String?

Gets the Sender ID for the sender of this message.

Returns
String?

the message Sender ID

getSentTime

fun getSentTime(): Long

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

Returns
Long

The time that the message was sent

getTo

fun getTo(): String?

Gets the message destination.

  • For upstream messages, this will be of the form SENDER_ID@fcm.googleapis.com.
  • For downstream messages, this will be the Firebase installations ID (FID).

getTtl

fun getTtl(): Int

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

Returns
Int

The message TTL

writeToParcel

fun writeToParcel(out: Parcel, flags: Int): Unit

Public properties

data

val data: (Mutable)Map<String!, String!>!