public final class Message
extends java.lang.Object
implements java.io.Serializable
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()
.priority("normal")
.collapseKey(collapseKey)
.timeToLive(3)
.delayWhileIdle(true)
.dryRun(true)
.restrictedPackageName(restrictedPackageName)
.addData("key1", "value1")
.addData("key2", "value2")
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
Message.Builder |
static class |
Message.Priority |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCollapseKey()
Gets the collapse key.
|
java.util.Map<java.lang.String,java.lang.String> |
getData()
Gets the payload data, which is immutable.
|
Notification |
getNotification()
Gets notification payload, which is immutable.
|
java.lang.String |
getPriority()
Gets the message priority value.
|
java.lang.String |
getRestrictedPackageName()
Gets the restricted package name.
|
java.lang.Integer |
getTimeToLive()
Gets the time to live (in seconds).
|
java.lang.Boolean |
isDelayWhileIdle()
Gets the delayWhileIdle flag.
|
java.lang.Boolean |
isDryRun()
Gets the dryRun flag.
|
java.lang.String |
toString() |
public java.lang.String getCollapseKey()
public java.lang.Boolean isDelayWhileIdle()
public java.lang.Integer getTimeToLive()
public java.lang.Boolean isDryRun()
public java.lang.String getRestrictedPackageName()
public java.lang.String getPriority()
public java.util.Map<java.lang.String,java.lang.String> getData()
public Notification getNotification()
public java.lang.String toString()
toString in class java.lang.Object