Java Code Examples for com.google.android.gms.common.api.ResolvableApiException#startResolutionForResult()

The following examples show how to use com.google.android.gms.common.api.ResolvableApiException#startResolutionForResult() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java    From identity-samples with Apache License 2.0 6 votes vote down vote up
/**
 * Attempt to resolve a non-successful result from an asynchronous request.
 * @param rae the ResolvableApiException to resolve.
 * @param requestCode the request code to use when starting an Activity for result,
 *                    this will be passed back to onActivityResult.
 */
private void resolveResult(ResolvableApiException rae, int requestCode) {
    // We don't want to fire multiple resolutions at once since that can result
    // in stacked dialogs after rotation or another similar event.
    if (mIsResolving) {
        Log.w(TAG, "resolveResult: already resolving.");
        return;
    }
    
    Log.d(TAG, "Resolving: " + rae);
    try {
        rae.startResolutionForResult(MainActivity.this, requestCode);
        mIsResolving = true;
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "STATUS: Failed to send resolution.", e);
        hideProgress();
    }
}
 
Example 2
Source File: MainActivity.java    From android-credentials with Apache License 2.0 6 votes vote down vote up
/**
 * Attempt to resolve a non-successful result from an asynchronous request.
 * @param rae the ResolvableApiException to resolve.
 * @param requestCode the request code to use when starting an Activity for result,
 *                    this will be passed back to onActivityResult.
 */
private void resolveResult(ResolvableApiException rae, int requestCode) {
    // We don't want to fire multiple resolutions at once since that can result
    // in stacked dialogs after rotation or another similar event.
    if (mIsResolving) {
        Log.w(TAG, "resolveResult: already resolving.");
        return;
    }
    
    Log.d(TAG, "Resolving: " + rae);
    try {
        rae.startResolutionForResult(MainActivity.this, requestCode);
        mIsResolving = true;
    } catch (IntentSender.SendIntentException e) {
        Log.e(TAG, "STATUS: Failed to send resolution.", e);
        hideProgress();
    }
}
 
Example 3
Source File: MainActivity.java    From identity-samples with Apache License 2.0 5 votes vote down vote up
private void resolveResult(ResolvableApiException rae, int requestCode) {
    if (!mIsResolving) {
        try {
            rae.startResolutionForResult(MainActivity.this, requestCode);
            mIsResolving = true;
        } catch (IntentSender.SendIntentException e) {
            Log.e(TAG, "Failed to send Credentials intent.", e);
            mIsResolving = false;
        }
    }
}
 
Example 4
Source File: LocationAlarmActivity.java    From LocationAware with Apache License 2.0 5 votes vote down vote up
@Override public void startResolutionForLocation(ResolvableApiException resolvable) {
  try {
    resolvable.startResolutionForResult((Activity) context, REQUEST_CHECK_SETTINGS);
  } catch (IntentSender.SendIntentException e) {
    e.printStackTrace();
  }
}
 
Example 5
Source File: MainActivity.java    From android-credentials with Apache License 2.0 5 votes vote down vote up
private void resolveResult(ResolvableApiException rae, int requestCode) {
    if (!mIsResolving) {
        try {
            rae.startResolutionForResult(MainActivity.this, requestCode);
            mIsResolving = true;
        } catch (IntentSender.SendIntentException e) {
            Log.e(TAG, "Failed to send Credentials intent.", e);
            mIsResolving = false;
        }
    }
}