Status
public final class Status implements Parcelable, Result
Represents the results of work.
Summary
Constants |
|
|---|---|
static final Parcelable.Creator<Status> |
Public fields |
|
|---|---|
final @Nullable ConnectionResult |
|
final int |
|
final @Nullable String |
Public constructors |
|---|
Status(int statusCode)Creates a representation of the status resulting from a GoogleApiClient operation. |
Status(Creates a failed API call status due to a failure to connect to Google Play services. |
|
Creates a representation of the status resulting from a GoogleApiClient operation. |
Status(Creates a representation of the status resulting from a GoogleApiClient operation. |
Public methods |
|
|---|---|
boolean |
|
@Nullable ConnectionResult |
Returns a failed |
@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 |
boolean |
Returns true if calling |
int |
hashCode() |
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 |
startResolutionForResult(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 |
toString() |
void |
writeToParcel(Parcel out, int flags) |
Inherited Constants |
||||
|---|---|---|---|---|
|
Inherited methods |
||
|---|---|---|
|
Constants
Public fields
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.
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
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 . |
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. |
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 |
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 |
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. |