ConnectionResult

class ConnectionResult : Parcelable


Contains all possible error codes for when a client fails to connect to Google Play services. These error codes are used by .

Summary

Constants

const Int

The API being requested is disabled on this device for this application.

const Int

The API being requested is disabled for this connection attempt, but may work for other connections.

const Int

One of the API components you attempted to connect to is not available.

const Int

The connection was canceled.

const Parcelable.Creator<ConnectionResult!>!
const Int

The application is misconfigured.

const Int

This property is deprecated.

External storage is no longer required.

const Int

An internal error occurred.

const Int

An interrupt occurred while waiting for the connection complete.

const Int

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

const Int

The application is not licensed to the user.

const Int

A network error occurred.

const Int

There was a user-resolvable issue connecting to Google Play services, but when attempting to start the resolution, the activity was not found.

const Int

Completing the connection requires some form of resolution.

const Int

The current user profile is restricted and cannot use authenticated features.

const Int

The installed version of Google Play services has been disabled on this device.

const Int

The version of the Google Play services installed on this device is not authentic.

const Int

Google Play services is missing on this device.

const Int

Google Play service doesn't have one or more required permissions.

const Int

Google Play service is currently being updated on this device.

const Int

The installed version of Google Play services is out of date.

const Int

The client attempted to connect to the service but the user is not signed in.

const Int

The client attempted to connect to the service but the user is not signed in.

const Int

The connection was successful.

const Int
TIMEOUT = 14

The timeout was exceeded while waiting for the connection to complete.

Public constructors

ConnectionResult(statusCode: Int)

Creates a connection result.

ConnectionResult(statusCode: Int, pendingIntent: PendingIntent?)

Creates a connection result.

ConnectionResult(
    statusCode: Int,
    pendingIntent: PendingIntent?,
    message: String?
)

Creates a connection result.

Public functions

Boolean
equals(o: Any?)
Int

Indicates the type of error that interrupted connection.

String?

Returns an error message for connection result.

PendingIntent?

A pending intent to resolve the connection failure.

Boolean

Returns true if calling startResolutionForResult will start any intents requiring user interaction.

Int
Boolean

Returns true if the connection was successful.

Unit
startResolutionForResult(activity: Activity!, requestCode: Int)

Resolves an error by starting any intents requiring user interaction.

String!
Unit
writeToParcel(out: Parcel!, flags: Int)

Inherited functions

From android.os.Parcelable
abstract Int

Constants

API_DISABLED

const val API_DISABLED = 23: Int

The API being requested is disabled on this device for this application. Trying again at a later time may succeed.

API_DISABLED_FOR_CONNECTION

const val API_DISABLED_FOR_CONNECTION = 24: Int

The API being requested is disabled for this connection attempt, but may work for other connections.

API_UNAVAILABLE

const val API_UNAVAILABLE = 16: Int

One of the API components you attempted to connect to is not available. The API will not work on this device or for your app or for this particular account, and updating Google Play services will not likely solve the problem.

CANCELED

const val CANCELED = 13: Int

The connection was canceled. This is returned in two situations:

  • By blockingConnect when disconnect is called before the connection completes.
  • To the OnConnectionFailedListener passed to enableAutoManage when the user chooses not to complete a provided resolution. For example by canceling a dialog.

CREATOR

const val CREATORParcelable.Creator<ConnectionResult!>!

DEVELOPER_ERROR

const val DEVELOPER_ERROR = 10: Int

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.

DRIVE_EXTERNAL_STORAGE_REQUIRED

const val DRIVE_EXTERNAL_STORAGE_REQUIRED = 1500: Int

The Drive API requires external storage (such as an SD card), but no external storage is mounted. This error is recoverable if the user installs external storage (if none is present) and ensures that it is mounted (which may involve disabling USB storage mode, formatting the storage, or other initialization as required by the device).

This error should never be returned on a device with emulated external storage. On devices with emulated external storage, the emulated "external storage" is always present regardless of whether the device also has removable storage.

INTERNAL_ERROR

const val INTERNAL_ERROR = 8: Int

An internal error occurred. Retrying should resolve the problem.

INTERRUPTED

const val INTERRUPTED = 15: Int

An interrupt occurred while waiting for the connection complete. Only returned by blockingConnect.

INVALID_ACCOUNT

const val INVALID_ACCOUNT = 5: Int

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

LICENSE_CHECK_FAILED

const val LICENSE_CHECK_FAILED = 11: Int

The application is not licensed to the user. This error is not recoverable and will be treated as fatal.

NETWORK_ERROR

const val NETWORK_ERROR = 7: Int

A network error occurred. Retrying should resolve the problem.

RESOLUTION_ACTIVITY_NOT_FOUND

const val RESOLUTION_ACTIVITY_NOT_FOUND = 22: Int

There was a user-resolvable issue connecting to Google Play services, but when attempting to start the resolution, the activity was not found.

This can occur when attempting to resolve issues connecing to Google Play services on emulators with Google APIs but not Google Play Store.

RESOLUTION_REQUIRED

const val RESOLUTION_REQUIRED = 6: Int

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

RESTRICTED_PROFILE

const val RESTRICTED_PROFILE = 20: Int

The current user profile is restricted and cannot use authenticated features. (Jelly Bean MR2+ Restricted Profiles for Android tablets)

SERVICE_DISABLED

const val SERVICE_DISABLED = 3: Int

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

SERVICE_INVALID

const val SERVICE_INVALID = 9: Int

The version of the Google Play services installed on this device is not authentic.

SERVICE_MISSING

const val SERVICE_MISSING = 1: Int

Google Play services is missing on this device. The calling activity should pass this error code to getErrorDialog to get a localized error dialog that will resolve the error when shown.

SERVICE_MISSING_PERMISSION

const val SERVICE_MISSING_PERMISSION = 19: Int

Google Play service doesn't have one or more required permissions. The client may call startResolutionForResult to prompt the user to fix the issue. After activity returns with RESULT_OK further attempts to connect should succeed.

SERVICE_UPDATING

const val SERVICE_UPDATING = 18: Int

Google Play service is currently being updated on this device.

SERVICE_VERSION_UPDATE_REQUIRED

const val SERVICE_VERSION_UPDATE_REQUIRED = 2: Int

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

SIGN_IN_FAILED

const val SIGN_IN_FAILED = 17: Int

The client attempted to connect to the service but the user is not signed in. An error may have occurred when signing in the user and the error can not be recovered with any user interaction. Alternately, the API may have been requested with addApiIfAvailable and it may be the case that no required APIs needed authentication, so authentication did not occur.

When seeing this error code,there is no resolution for the sign-in failure.

SIGN_IN_REQUIRED

const val SIGN_IN_REQUIRED = 4: Int

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 to prompt the user to sign in. After the sign in activity returns with RESULT_OK further attempts should succeed.

SUCCESS

const val SUCCESS = 0: Int

The connection was successful.

TIMEOUT

const val TIMEOUT = 14: Int

The timeout was exceeded while waiting for the connection to complete. Only returned by blockingConnect.

Public constructors

ConnectionResult

ConnectionResult(statusCode: Int)

Creates a connection result.

Parameters
statusCode: Int

The status code.

ConnectionResult

ConnectionResult(statusCode: Int, pendingIntent: PendingIntent?)

Creates a connection result.

Parameters
statusCode: Int

The status code.

pendingIntent: PendingIntent?

A pending intent that will resolve the issue when started, or null.

ConnectionResult

ConnectionResult(
    statusCode: Int,
    pendingIntent: PendingIntent?,
    message: String?
)

Creates a connection result.

Parameters
statusCode: Int

The status code.

pendingIntent: PendingIntent?

A pending intent that will resolve the issue when started, or null.

message: String?

An additional error message for the connection result, or null.

Public functions

equals

fun equals(o: Any?): Boolean

getErrorCode

fun getErrorCode(): Int

Indicates the type of error that interrupted connection.

Returns
Int

the error code, or SUCCESS if no error occurred.

getErrorMessage

fun getErrorMessage(): String?

Returns an error message for connection result.

Returns
String?

the message.

getResolution

fun getResolution(): PendingIntent?

A pending intent to resolve the connection failure. This intent can be started with startIntentSenderForResult to present UI to solve the issue.

Returns
PendingIntent?

The pending intent to resolve the connection failure.

hasResolution

fun hasResolution(): Boolean

Returns true if calling startResolutionForResult will start any intents requiring user interaction.

Returns
Boolean

true if there is a resolution that can be started.

hashCode

fun hashCode(): Int

isSuccess

fun isSuccess(): Boolean

Returns true if the connection was successful.

Returns
Boolean

true if the connection was successful, false if there was an error.

startResolutionForResult

fun startResolutionForResult(activity: Activity!, requestCode: Int): Unit

Resolves an error by starting any intents requiring user interaction. See SIGN_IN_REQUIRED, and RESOLUTION_REQUIRED.

Parameters
activity: Activity!

An Activity context to use to resolve the issue. The activity's onActivityResult method will be invoked after the user is done. If the resultCode is RESULT_OK, the application should try to connect again.

requestCode: Int

The request code to pass to onActivityResult.

Throws
android.content.IntentSender.SendIntentException

If the resolution intent has been canceled or is no longer able to execute the request.

toString

fun toString(): String!

writeToParcel

fun writeToParcel(out: Parcel!, flags: Int): Unit