Java Code Examples for com.google.android.gms.common.ConnectionResult#API_UNAVAILABLE
The following examples show how to use
com.google.android.gms.common.ConnectionResult#API_UNAVAILABLE .
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 android-google-accounts with Apache License 2.0 | 6 votes |
/** * Called when the Activity could not connect to Google Play services AND the auto manager * could not resolve the error automatically. * * @param result can be inspected to determine the cause of the failure */ @Override public void onConnectionFailed(ConnectionResult result) { // Refer to the javadoc for ConnectionResult to see what error codes might be returned in // onConnectionFailed. Since this is the AutoManage sample only unresolvable errors // are returned here. Log.i(TAG, "onConnectionFailed: ConnectionResult.getErrorCode() = " + result.getErrorCode()); if (result.getErrorCode() == ConnectionResult.API_UNAVAILABLE) { // An API requested for GoogleApiClient is not available. The device's current // configuration might not be supported with the requested API or a required component // may not be installed, such as the Android Wear application. You may need to use a // second GoogleApiClient to manage the application's optional APIs. Log.i(TAG, "onConnectionFailed because an API was unavailable"); } googleApiClientConnectionStateChange(false); }
Example 2
Source File: PlayServicesUtil.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
public static PlayServicesStatus getPlayServicesStatus(Context context) { int gcmStatus = 0; try { gcmStatus = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context); } catch (Throwable t) { Log.w(TAG, t); return PlayServicesStatus.MISSING; } Log.i(TAG, "Play Services: " + gcmStatus); switch (gcmStatus) { case ConnectionResult.SUCCESS: return PlayServicesStatus.SUCCESS; case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: try { ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo("com.google.android.gms", 0); if (applicationInfo != null && !applicationInfo.enabled) { return PlayServicesStatus.MISSING; } } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, e); } return PlayServicesStatus.NEEDS_UPDATE; case ConnectionResult.SERVICE_DISABLED: case ConnectionResult.SERVICE_MISSING: case ConnectionResult.SERVICE_INVALID: case ConnectionResult.API_UNAVAILABLE: case ConnectionResult.SERVICE_MISSING_PERMISSION: return PlayServicesStatus.MISSING; default: return PlayServicesStatus.TRANSIENT_ERROR; } }
Example 3
Source File: GoogleApiMessenger.java From Sensor-Data-Logger with Apache License 2.0 | 5 votes |
@Override public void onConnectionFailed(ConnectionResult connectionResult) { if (connectionResult.getErrorCode() == ConnectionResult.API_UNAVAILABLE) { wearableApiAvailable = false; } status.setConnected(false); status.updated(statusUpdateHandler); Log.e(TAG, "Google API client connection failed: " + connectionResult.getErrorMessage()); }
Example 4
Source File: MainActivity.java From android-google-accounts with Apache License 2.0 | 5 votes |
/** * Called when the Activity could not connect to Google Play services. The callback indicates * that the user needs to select an account, grant permissions, or resolve an error in order * to sign in. * * @param result can be inspected to determine the cause of the failure */ @Override public void onConnectionFailed(ConnectionResult result) { // Refer to the javadoc for ConnectionResult to see what error codes might be returned in // onConnectionFailed. Log.i(TAG, "onConnectionFailed: ConnectionResult.getErrorCode() = " + result.getErrorCode()); if (result.getErrorCode() == ConnectionResult.API_UNAVAILABLE) { // An API requested for GoogleApiClient is not available. The device's current // configuration might not be supported with the requested API or a required component // may not be installed, such as the Android Wear application. You may need to use a // second GoogleApiClient to manage the application's optional APIs. } else if (mSignInProgress != STATE_IN_PROGRESS) { // We do not have an intent in progress so we should store the latest error // resolution intent for use when the sign in button is clicked. mSignInIntent = result.getResolution(); mSignInError = result.getErrorCode(); if (mSignInProgress == STATE_SIGN_IN) { // STATE_SIGN_IN indicates the user already clicked the sign in button so we // should continue processing errors until the user is signed in or they click // cancel. resolveSignInError(); } } // In this sample we consider the user signed out when they do not have a connection to // Google Play services. onSignedOut(); }