CommonStatusCodes

public class CommonStatusCodes extends Object

Common status codes that are often shared across API surfaces.

Constant Summary

int API_NOT_CONNECTED The client attempted to call a method from an API that failed to connect.
int CANCELED The result was canceled either due to client disconnect or cancel().
int CONNECTION_SUSPENDED_DURING_CALL The connection was suspended while the call was in-flight.
int DEVELOPER_ERROR The application is misconfigured.
int ERROR The operation failed with no more detailed information.
int INTERNAL_ERROR An internal error occurred.
int INTERRUPTED A blocking call was interrupted while waiting and did not run to completion.
int INVALID_ACCOUNT The client attempted to connect to the service with an invalid account name specified.
int NETWORK_ERROR A network error occurred.
int RECONNECTION_TIMED_OUT The connection timed-out while attempting to re-connect.
int RECONNECTION_TIMED_OUT_DURING_UPDATE The connection timed-out while waiting for Google Play services to update.
int REMOTE_EXCEPTION There was a non-DeadObjectException RemoteException while calling a connected service.
int RESOLUTION_REQUIRED Completing the operation requires some form of resolution.
int SERVICE_DISABLED This constant is deprecated. This case handled during connection, not during API requests. No results should be returned with this status code.
int SERVICE_VERSION_UPDATE_REQUIRED This constant is deprecated. This case handled during connection, not during API requests. No results should be returned with this status code.
int SIGN_IN_REQUIRED The client attempted to connect to the service but the user is not signed in.
int SUCCESS The operation was successful.
int SUCCESS_CACHE The operation was successful, but was used the device's cache.
int TIMEOUT Timed out while awaiting the result.

Public Method Summary

static String
getStatusCodeString(int statusCode)

Inherited Method Summary

Constants

public static final int API_NOT_CONNECTED

The client attempted to call a method from an API that failed to connect. Possible reasons include:

  • The API previously failed to connect with a resolvable error, but the user declined the resolution.
  • The device does not support GmsCore.
  • The specific API cannot connect on this device.
Constant Value: 17

public static final int CANCELED

The result was canceled either due to client disconnect or cancel().

Constant Value: 16

public static final int CONNECTION_SUSPENDED_DURING_CALL

The connection was suspended while the call was in-flight.

API calls will be failed with this status if onServiceDisconnected(ComponentName) is called by the Android platform before the call is completed.

This indicates that the underlying service was bound, since onServiceDisconnected should never be called unless onServiceConnected was called first.

It is possible this failure could be resolved by retrying.

Constant Value: 20

public static final int DEVELOPER_ERROR

The application is misconfigured. This error is not recoverable and will be treated as fatal. The developer should look at the logs after this to determine more actionable information.

Constant Value: 10

public static final int ERROR

The operation failed with no more detailed information.

Constant Value: 13

public static final int INTERNAL_ERROR

An internal error occurred. Retrying should resolve the problem.

Constant Value: 8

public static final int INTERRUPTED

A blocking call was interrupted while waiting and did not run to completion.

Constant Value: 14

public static final int INVALID_ACCOUNT

The client attempted to connect to the service with an invalid account name specified.

Constant Value: 5

public static final int NETWORK_ERROR

A network error occurred. Retrying should resolve the problem.

Constant Value: 7

public static final int RECONNECTION_TIMED_OUT

The connection timed-out while attempting to re-connect.

This failure indicates a connection to Google Play services was successfully established, however it was disconnected for some reason (i.e. Google Play services crashed), and re-connecting took longer than expected.

Any API calls failed with this status would have been initiated after the connection was disconnected.

Constant Value: 22

public static final int RECONNECTION_TIMED_OUT_DURING_UPDATE

The connection timed-out while waiting for Google Play services to update.

This failure indicates a connection to Google Play services was successfully established, however it was disconnected because Google Play services was updated, and the update took far longer than expected.

Any API calls failed with this status would have been initiated after the disconnection for the update.

Constant Value: 21

public static final int REMOTE_EXCEPTION

There was a non-DeadObjectException RemoteException while calling a connected service.

This signifies that an API was able to connect to Google Play services and received an instance, but that when calling an individual method, a RemoteException was thrown.

Note that the exception would not be a DeadObjectException, which indicates that the binding has died (for example if the remote process died). This is because DeadObjectExceptions are handled by the connection management infrastructure of GoogleApi.

If this is encountered during an API call for an API that uses the Google Play services ServiceBroker (most do), it is after a bound service is successfully received from the ServiceBroker.

Constant Value: 19

public static final int RESOLUTION_REQUIRED

Completing the operation requires some form of resolution. A resolution will be available to be started with startResolutionForResult(Activity, int). If the result returned is RESULT_OK, then further attempts should either complete or continue on to the next issue that needs to be resolved.

Constant Value: 6

public static final int SERVICE_DISABLED

This constant is deprecated.
This case handled during connection, not during API requests. No results should be returned with this status code.

The installed version of Google Play services has been disabled on this device. The calling activity should pass this error code to getErrorDialog(Activity, int, int) to get a localized error dialog that will resolve the error when shown.

Constant Value: 3

public static final int SERVICE_VERSION_UPDATE_REQUIRED

This constant is deprecated.
This case handled during connection, not during API requests. No results should be returned with this status code.

The installed version of Google Play services is out of date. The calling activity should pass this error code to getErrorDialog(Activity, int, int) to get a localized error dialog that will resolve the error when shown.

Constant Value: 2

public static final int SIGN_IN_REQUIRED

The client attempted to connect to the service but the user is not signed in. The client may choose to continue without using the API. Alternately, if hasResolution() returns true the client may call startResolutionForResult(Activity, int) to prompt the user to sign in. After the sign in activity returns with RESULT_OK further attempts should succeed.

Constant Value: 4

public static final int SUCCESS

The operation was successful.

Constant Value: 0

public static final int SUCCESS_CACHE

The operation was successful, but was used the device's cache. If this is a write, the data will be written when the device is online; errors will be written to the logs. If this is a read, the data was read from a device cache and may be stale.

Constant Value: -1

public static final int TIMEOUT

Timed out while awaiting the result.

Constant Value: 15

Public Methods

public static String getStatusCodeString (int statusCode)

Returns
  • untranslated debug (not user-friendly!) string based on the current status code.