Status

public final class Status implements Parcelable, Result


Represents the results of work.

Summary

Constants

static final Parcelable.Creator<Status>

Public constructors

Status(int statusCode)

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

Status(
    @NonNull ConnectionResult connectionResult,
    @NonNull String statusMessage
)

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

Status(int statusCode, @Nullable String statusMessage)

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

Status(
    int statusCode,
    @Nullable String statusMessage,
    @Nullable PendingIntent pendingIntent
)

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

Public methods

boolean
@Nullable ConnectionResult

Returns a failed ConnectionResult, if applicable.

@Nullable PendingIntent

A pending intent to resolve the failure.

Status

Returns the status of this result.

int

Indicates the status of the operation.

@Nullable String

Returns the statusMessage

boolean

Returns true if calling startResolutionForResult 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

From android.os.Parcelable
static final int
static final int

Inherited methods

From android.os.Parcelable
abstract int

Constants

CREATOR

public static final Parcelable.Creator<StatusCREATOR

Public fields

connectionResult

public final @Nullable ConnectionResult connectionResult

statusCode

public final int statusCode

statusMessage

public final @Nullable String 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(
    @NonNull ConnectionResult connectionResult,
    @NonNull String statusMessage
)

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

Status

public Status(int statusCode, @Nullable String statusMessage)

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

Parameters
int statusCode

The status code.

@Nullable String statusMessage

The message associated with this status, or null.

Status

public Status(
    int statusCode,
    @Nullable String statusMessage,
    @Nullable PendingIntent pendingIntent
)

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

Parameters
int statusCode

The status code.

@Nullable String statusMessage

The message associated with this status, or null.

@Nullable PendingIntent pendingIntent

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

Public methods

equals

public boolean equals(@Nullable Object obj)

getConnectionResult

public @Nullable ConnectionResult getConnectionResult()

Returns a failed ConnectionResult, if applicable.

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

getResolution

public @Nullable PendingIntent getResolution()

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

Returns
@Nullable PendingIntent

The pending intent to resolve the failure.

getStatus

@CanIgnoreReturnValue
public Status getStatus()

Returns the status of this result. Use isSuccess to determine whether the call was successful, and getStatusCode 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 via getResolution.

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 @Nullable String getStatusMessage()

Returns the statusMessage

hasResolution

public boolean hasResolution()

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

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. See SIGN_IN_REQUIRED, and RESOLUTION_REQUIRED.

Parameters
ActivityResultLauncher<IntentSenderRequest> activityResultLauncher

The androidx.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. See SIGN_IN_REQUIRED, and RESOLUTION_REQUIRED.

This method follows the startActivityForResult and onActivityResult API pattern. Consider migrating to startResolutionForResult 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 is RESULT_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)