CloudMessage Stay organized with collections Save and categorize content based on your preferences.
Page Summary
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.
A Cloud Messaging message.
Nested Class Summary
| @interface | CloudMessage.MessagePriority | Priority of the message | |
Constant Summary
| int | PRIORITY_HIGH | |
| int | PRIORITY_NORMAL | |
| int | PRIORITY_UNKNOWN |
Inherited Constant Summary
| int | CONTENTS_FILE_DESCRIPTOR | |
| int | PARCELABLE_STABILITY_LOCAL | |
| int | PARCELABLE_STABILITY_VINTF | |
| int | PARCELABLE_WRITE_RETURN_VALUE |
Public Method Summary
| String | getCollapseKey() Gets the collapse key of the message. |
| synchronizedMap<String, String> | 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
| abstract int | describeContents() |
| int | getStability() |
| abstract void | writeToParcel(Parcel arg0, int arg1) |
Constants
public static final intPRIORITY_HIGH
public static final intPRIORITY_NORMAL
public static final intPRIORITY_UNKNOWN
Public Methods
publicStringgetCollapseKey()
Gets the collapse key of the message.
Returns
- The collapse key
public synchronizedMap<String, String>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.