Status

Kotlin|Java

public final classStatus implementsParcelable,Result


Represents the results of work.

Summary

Constants

static finalParcelable.Creator<Status>

Public constructors

Status(int statusCode)

Creates a representation of the status resulting from a GoogleApiClient operation.

Status(
    @NonNullConnectionResult connectionResult,
    @NonNullString statusMessage
)

Creates a failed API call status due to a failure to connect to Google Play services.

Status(int statusCode, @NullableString statusMessage)

Creates a representation of the status resulting from a GoogleApiClient operation.

Status(
    int statusCode,
    @NullableString statusMessage,
    @NullablePendingIntent pendingIntent
)

Creates a representation of the status resulting from a GoogleApiClient operation.

Public methods

boolean
@NullableConnectionResult

Returns a failedConnectionResult, if applicable.

@NullablePendingIntent

A pending intent to resolve the failure.

Status

Returns the status of this result.

int

Indicates the status of the operation.

@NullableString

Returns thestatusMessage

boolean

Returns true if callingstartResolutionForResult will start any intents requiring user interaction.

int
boolean

Returns true if the operation was canceled.

boolean

Returns true if the operation was interrupted.

boolean

Returns true if the operation was successful.

void

Resolves an error by starting any intents requiring user interaction.

void
startResolutionForResult(Activity activity, int requestCode)

Resolves an error by starting any intents requiring user interaction.

String
void
writeToParcel(Parcel out, int flags)

Inherited Constants

Fromandroid.os.Parcelable
static final int
static final int

Inherited methods

Fromandroid.os.Parcelable
abstract int

Constants

CREATOR

public static final Parcelable.Creator<StatusCREATOR

Public fields

connectionResult

public final @NullableConnectionResult connectionResult

statusCode

public final int statusCode

statusMessage

public final @NullableString statusMessage

Public constructors

Status

public Status(int statusCode)

Creates a representation of the status resulting from a GoogleApiClient operation.

Parameters
int statusCode

The status code.

Status

public Status(
    @NonNullConnectionResult connectionResult,
    @NonNullString statusMessage
)

Creates a failed API call status due to a failure to connect to Google Play services.

Status

public Status(int statusCode, @NullableString statusMessage)

Creates a representation of the status resulting from a GoogleApiClient operation.

Parameters
int statusCode

The status code.

@NullableString statusMessage

The message associated with this status, or null.

Status

public Status(
    int statusCode,
    @NullableString statusMessage,
    @NullablePendingIntent pendingIntent
)

Creates a representation of the status resulting from a GoogleApiClient operation.

Parameters
int statusCode

The status code.

@NullableString statusMessage

The message associated with this status, or null.

@NullablePendingIntent pendingIntent

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

Public methods

equals

public boolean equals(@NullableObject obj)

getConnectionResult

public @NullableConnectionResult getConnectionResult()

Returns a failedConnectionResult, if applicable.

If theStatus is successful, or the failure was not due to an issue with the connection to Google Play services, this returnsnull.

getResolution

public @NullablePendingIntent getResolution()

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

Returns
@NullablePendingIntent

The pending intent to resolve the failure.

getStatus

@CanIgnoreReturnValue
public Status getStatus()

Returns the status of this result. UseisSuccess to determine whether the call was successful, andgetStatusCode to determine what the error cause was.

Certain errors are due to failures that can be resolved by launching a particular intent. The resolution intent is available viagetResolution.

getStatusCode

public int getStatusCode()

Indicates the status of the operation.

Returns
int

Status code resulting from the operation. The value is one of the constants in or specific to the APIs added to the .

getStatusMessage

public @NullableString getStatusMessage()

Returns thestatusMessage

hasResolution

public boolean hasResolution()

Returns true if callingstartResolutionForResult will start any intents requiring user interaction.

Returns
boolean

true if there is a resolution that can be started.

hashCode

public int hashCode()

isCanceled

public boolean isCanceled()

Returns true if the operation was canceled.

isInterrupted

public boolean isInterrupted()

Returns true if the operation was interrupted.

isSuccess

@CheckReturnValue
public boolean isSuccess()

Returns true if the operation was successful.

Returns
boolean

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

startResolutionForResult

public void startResolutionForResult(
    ActivityResultLauncher<IntentSenderRequest> activityResultLauncher
)

Resolves an error by starting any intents requiring user interaction. SeeSIGN_IN_REQUIRED, andRESOLUTION_REQUIRED.

Parameters
ActivityResultLauncher<IntentSenderRequest> activityResultLauncher

Theandroidx.activity.result.ActivityResultLauncher to invoke when the error resolution, if any, completes.

startResolutionForResult

public void startResolutionForResult(Activity activity, int requestCode)

Resolves an error by starting any intents requiring user interaction. SeeSIGN_IN_REQUIRED, andRESOLUTION_REQUIRED.

This method follows thestartActivityForResult andonActivityResult API pattern. Consider migrating tostartResolutionForResult as the API is the recommended approach.

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 isRESULT_OK, the application should try to connect again.

int requestCode

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

public String toString()

writeToParcel

public void writeToParcel(Parcel out, int flags)

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-09-10 UTC.