Message | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Languages
close

- - Get Started
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
    - Get the SDK
  - Google Services
- - Google Play
  - Publishing
  - Promoting
  - App Quality
  - Spotlight
  - Open Distribution

## Results

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

# Message

extends Object
implements Serializable

java.lang.Object
↳ | com.google.android.gcm.server.Message

## Class Overview

GCM message.

Instances of this class are immutable and should be created using a `Message.Builder`. Examples: Simplest message:

     Message message = new Message.Builder().build();

Message with optional attributes:

     Message message = new Message.Builder()
        .collapseKey(collapseKey)
        .timeToLive(3)
        .delayWhileIdle(true)
        .build();

Message with optional attributes and payload data:

     Message message = new Message.Builder()
        .collapseKey(collapseKey)
        .timeToLive(3)
        .delayWhileIdle(true)
        .addData("key1", "value1")
        .addData("key2", "value2")
        .build();

## Summary

Nested Classes
class | Message.Builder |

Public Methods
String | getCollapseKey() Gets the collapse key.
Map<String, String> | getData() Gets the payload data, which is immutable.
Integer | getTimeToLive() Gets the time to live (in seconds).
Boolean | isDelayWhileIdle() Gets the delayWhileIdle flag.
String | toString()

[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()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## Public Methods

#### public String getCollapseKey ()

Gets the collapse key.

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

Gets the payload data, which is immutable.

#### public Integer getTimeToLive ()

Gets the time to live (in seconds).

#### public Boolean isDelayWhileIdle ()

Gets the delayWhileIdle flag.

#### public String toString ()