com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException Java Examples

The following examples show how to use com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException. 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: CheckupReminders.java    From Crimson with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError)
                            .getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    CheckupReminders.REQUEST_AUTHORIZATION);
        } else {
            //mOutputText.setText("The following error occurred:\n"+ mLastError.getMessage());
        }
    } else {
        //  mOutputText.setText("Request cancelled.");
    }
}
 
Example #2
Source File: MainActivity.java    From apps-script-mobile-addons with Apache License 2.0 6 votes vote down vote up
/**
 * Handle cancel requests -- specifically, those caused by exceptions
 * raised when attempting to call the API.
 */
@Override
protected void onCancelled() {
    mProgress.hide();
    if (mLastError != null) {
        if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
            showGooglePlayServicesAvailabilityErrorDialog(
                    ((GooglePlayServicesAvailabilityIOException) mLastError).getConnectionStatusCode());
        } else if (mLastError instanceof UserRecoverableAuthIOException) {
            startActivityForResult(
                    ((UserRecoverableAuthIOException) mLastError).getIntent(),
                    MainActivity.REQUEST_AUTHORIZATION);
        } else {
            showErrorDialog(mLastError.toString());
        }
    }
}
 
Example #3
Source File: ApiAsyncTask.java    From CalendarQuickStart with MIT License 6 votes vote down vote up
/**
 * Background task to call Google Calendar API.
 * @param params no parameters needed for this task.
 */
@Override
protected Void doInBackground(Void... params) {
    try {
        mActivity.clearResultsText();
        mActivity.updateResultsText(getDataFromApi());

    } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
        mActivity.showGooglePlayServicesAvailabilityErrorDialog(
                availabilityException.getConnectionStatusCode());

    } catch (UserRecoverableAuthIOException userRecoverableException) {
        mActivity.startActivityForResult(
                userRecoverableException.getIntent(),
                MainActivity.REQUEST_AUTHORIZATION);

    } catch (IOException e) {
        mActivity.updateStatus("The following error occurred: " +
                e.getMessage());
    }
    return null;
}
 
Example #4
Source File: CommonAsyncTask.java    From SimplePomodoro-android with MIT License 6 votes vote down vote up
@Override
protected final Boolean doInBackground(Void... ignored) {
  try {
    doInBackground();
    return true;
  } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
  	mFragment.showGooglePlayServicesAvailabilityErrorDialog(
        availabilityException.getConnectionStatusCode());
  } catch (UserRecoverableAuthIOException userRecoverableException) {
  	mFragment.startActivityForResult(
        userRecoverableException.getIntent(), TaskListFragment.REQUEST_AUTHORIZATION);
  } catch (IOException e) {
    Utils.logAndShow(mFragment.getActivity(), TaskListFragment.TAG, e);
  }
  return false;
}
 
Example #5
Source File: FragmentAsyncTask.java    From SimplePomodoro-android with MIT License 6 votes vote down vote up
@Override
protected final Boolean doInBackground(Void... ignored) {
  try {
    doInBackground();
    return true;
  } catch (final GooglePlayServicesAvailabilityIOException availabilityException) {
  	mFragment.showGooglePlayServicesAvailabilityErrorDialog(
        availabilityException.getConnectionStatusCode());
  } catch (UserRecoverableAuthIOException userRecoverableException) {
  	mFragment.startActivityForResult(
        userRecoverableException.getIntent(), TaskListFragment.REQUEST_AUTHORIZATION);
  } catch (IOException e) {
    Utils.logAndShow(mFragment.getActivity(), TaskListFragment.TAG, e);
  }
  return false;
}