CloudMessage

  • CloudMessage is a class representing a Cloud Messaging message that implements the Parcelable interface.

  • It includes information such as collapse key, message data, sender, message ID, type, priority, raw data, sent time, destination, and time to live.

  • The message priority can be HIGH, NORMAL, or UNKNOWN, defined by integer constants.

  • The class provides various public methods to access the different properties of the message.

public final classCloudMessage extendsObject
implementsParcelable

A Cloud Messaging message.

Nested Class Summary

@interface CloudMessage.MessagePriorityPriority of the message  

Constant Summary

int PRIORITY_HIGH
int PRIORITY_NORMAL
int PRIORITY_UNKNOWN

Inherited Constant Summary

From interface android.os.Parcelable
intCONTENTS_FILE_DESCRIPTOR
intPARCELABLE_STABILITY_LOCAL
intPARCELABLE_STABILITY_VINTF
intPARCELABLE_WRITE_RETURN_VALUE

Public Method Summary

String
getCollapseKey()
Gets the collapse key of the message.
synchronizedMap<StringString>
getData()
Gets the message payload data.
String
getFrom()
Get the sender of this message.
Intent
getIntent()
Gets the broadcast Intent that this message was sent through.
String
getMessageId()
Gets the message's ID.
String
getMessageType()
Gets the type of message.
int
getOriginalPriority()
Gets the original priority of message.
int
getPriority()
Gets the priority of message as delivered.
byte[]
getRawData()
Gets the raw data.
String
getSenderId()
Gets the Sender ID for the sender of this message.
long
getSentTime()
Gets the time in milliseconds from the Epoch that the message was sent.
String
getTo()
Gets the message destination.
int
getTtl()
Gets the message time to live (TTL) in seconds.
void
writeToParcel(Parcel out, int flags)

Inherited Method Summary

From class java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
finalClass<?>
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()
int
getStability()
abstract void
writeToParcel(Parcel arg0, int arg1)

Constants

public static final intPRIORITY_HIGH

Constant Value:1

public static final intPRIORITY_NORMAL

Constant Value:2

public static final intPRIORITY_UNKNOWN

Constant Value:0

Public Methods

publicStringgetCollapseKey()

Gets the collapse key of the message.

Returns
  • The collapse key

public synchronizedMap<StringString>getData()

Gets the message payload data.

Returns
  • A map of the message payload.

publicStringgetFrom()

Get the sender of this message.

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

Returns
  • The message sender

publicIntentgetIntent()

Gets the broadcast Intent that this message was sent through.

Returns
  • the broadcast Intent

publicStringgetMessageId()

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
  • The message ID

publicStringgetMessageType()

Gets the type of message.

Returns
  • The message type

public intgetOriginalPriority()

Gets the original priority of message.

Returns
  • The original message priority

public intgetPriority()

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

Returns
  • The message priority as delivered

public byte[]getRawData()

Gets the raw data.

publicStringgetSenderId()

Gets the Sender ID for the sender of this message.

Returns
  • the message Sender ID

public longgetSentTime()

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

Returns
  • The time that the message was sent

publicStringgetTo()

Gets the message destination.

Returns
  • The message destination

public intgetTtl()

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

Returns
  • The message TTL

public voidwriteToParcel(Parcel out, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.