Result | Android Developers

Quicknav Quicknav
Links

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

Android Sites

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

Language
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

# Result

extends Object
implements Serializable

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

## Class Overview

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.

## Summary

Nested Classes
class | Result.Builder |

Public Methods
String | getCanonicalRegistrationId() Gets the canonical registration id, if any.
String | getErrorCodeName() Gets the error code, if any.
String | getMessageId() Gets the message id, if any.
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 getCanonicalRegistrationId ()

Gets the canonical registration id, if any.

#### public String getErrorCodeName ()

Gets the error code, if any.

#### public String getMessageId ()

Gets the message id, if any.

#### public String toString ()