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)
    .dryRun(true)
    .restrictedPackageName(restrictedPackageName)
    .build();
 
Message with optional attributes and payload data:

 Message message = new Message.Builder()
    .collapseKey(collapseKey)
    .timeToLive(3)
    .delayWhileIdle(true)
    .dryRun(true)
    .restrictedPackageName(restrictedPackageName)
    .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.
String getRestrictedPackageName()
Gets the restricted package name.
Integer getTimeToLive()
Gets the time to live (in seconds).
Boolean isDelayWhileIdle()
Gets the delayWhileIdle flag.
Boolean isDryRun()
Gets the dryRun flag.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public String getCollapseKey ()

Gets the collapse key.

public Map<String, String> getData ()

Gets the payload data, which is immutable.

public String getRestrictedPackageName ()

Gets the restricted package name.

public Integer getTimeToLive ()

Gets the time to live (in seconds).

public Boolean isDelayWhileIdle ()

Gets the delayWhileIdle flag.

public Boolean isDryRun ()

Gets the dryRun flag.

public String toString ()