com.google.android.gcm.server
Class Result

java.lang.Object
  extended by com.google.android.gcm.server.Result
All Implemented Interfaces:
java.io.Serializable

public final class Result
extends java.lang.Object
implements java.io.Serializable

Result of a GCM message request that returned HTTP status code 200.

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:

   - Call getMessageId():
     - null means error, call getErrorCodeName()
     - non-null means the message was created:
       - Call getCanonicalRegistrationId()
         - if it returns null, do nothing.
         - otherwise, update the server datastore with the new id.
 

See Also:
Serialized Form

Method Summary
 java.lang.String getCanonicalRegistrationId()
          Gets the canonical registration id, if any.
 java.lang.String getErrorCodeName()
          Gets the error code, if any.
 java.lang.String getMessageId()
          Gets the message id, if any.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getMessageId

public java.lang.String getMessageId()
Gets the message id, if any.


getCanonicalRegistrationId

public java.lang.String getCanonicalRegistrationId()
Gets the canonical registration id, if any.


getErrorCodeName

public java.lang.String getErrorCodeName()
Gets the error code, if any.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object