public final class Result
extends java.lang.Object
implements java.io.Serializable
If the message is successfully created, the getMessageId() returns
the message id and getErrorCodeName() returns null;
otherwise, getMessageId() returns null and
getErrorCodeName() returns the code of the error.
There are cases when a request is accept and the message successfully created, but GCM has a canonical registration id for that device. In this case, the server should update the registration id to avoid rejected requests in the future.
In a nutshell, the workflow to handle a result is:
- CallgetMessageId(): - null means error, callgetErrorCodeName()- non-null means the message was created: - CallgetCanonicalRegistrationId()- if it returns null, do nothing. - otherwise, update the server datastore with the new id.
| Modifier and Type | Class and Description |
|---|---|
static class |
Result.Builder |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCanonicalRegistrationId()
Gets the canonical registration id, if any.
|
java.lang.String |
getErrorCodeName()
Gets the error code, if any.
|
java.util.List<java.lang.String> |
getFailedRegistrationIds() |
java.lang.Integer |
getFailure() |
java.lang.String |
getMessageId()
Gets the message id, if any.
|
java.lang.Integer |
getSuccess() |
java.lang.String |
toString() |
public java.lang.String getMessageId()
public java.lang.String getCanonicalRegistrationId()
public java.lang.String getErrorCodeName()
public java.lang.Integer getSuccess()
public java.lang.Integer getFailure()
public java.util.List<java.lang.String> getFailedRegistrationIds()
public java.lang.String toString()
toString in class java.lang.Object