Java Code Examples for com.google.android.gms.common.ConnectionResult#SERVICE_UPDATING

The following examples show how to use com.google.android.gms.common.ConnectionResult#SERVICE_UPDATING . 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: GmsApiWrapper.java    From rebootmenu with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 取Google Play Service可用性状态
 *
 * @param context context
 * @return String
 */
public static String fetchStateString(Context context) {
    switch (GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context.getApplicationContext())) {
        case ConnectionResult.SUCCESS:
            return "SUCCESS";
        case ConnectionResult.SERVICE_MISSING:
            return "SERVICE_MISSING";
        case ConnectionResult.SERVICE_UPDATING:
            return "SERVICE_UPDATING";
        case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
            return "SERVICE_VERSION_UPDATE_REQUIRED";
        case ConnectionResult.SERVICE_DISABLED:
            return "SERVICE_DISABLED";
        case ConnectionResult.SERVICE_INVALID:
            return "SERVICE_INVALID";
    }
    return null;
}
 
Example 2
Source File: PlayServiceManager.java    From android-sdk with MIT License 6 votes vote down vote up
public boolean connect() {
    status = availability.isGooglePlayServicesAvailable(context);
    switch (status) {
        case ConnectionResult.SUCCESS:
            if (!client.isConnected() && !client.isConnecting()) {
                retry(0);
            }
            return true;
        case ConnectionResult.SERVICE_UPDATING:
            Logger.log.geofenceError("Google Api Client " + availability.getErrorString(status), null);
            retry(SERVICE_RECONNECT_INTERVAL);
            return true;
        default:
            if (logged != status) {
                logged = status;
                Logger.log.geofenceError("Google Api Client " + availability.getErrorString(status), null);
            }
            return false;
    }
}
 
Example 3
Source File: PlayNetwork.java    From CrossBow with Apache License 2.0 6 votes vote down vote up
private static void throwErrorForCode(int code) throws VolleyError {

        final String message;

        switch (code) {
            case ConnectionResult.SERVICE_MISSING:
                message = "Play Services is missing";
                break;
            case ConnectionResult.SERVICE_UPDATING:
                message = "Play Services is updating";
                break;
            case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
                message = "Play Services is running the wrong version";
                break;
            case ConnectionResult.SERVICE_DISABLED:
                message = "Play Services is disabled";
                break;
            case ConnectionResult.SERVICE_INVALID:
                message = "Play Services is invalid";
                break;
            default:
                message = "Connection to play services failed";
        }

        throw new VolleyError(message);
    }
 
Example 4
Source File: LocationUtils.java    From react-native-geolocation-service with MIT License 5 votes vote down vote up
/**
 * Check if google play service is available on device.
 */
public static boolean isGooglePlayServicesAvailable(Context context) {
  int result = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context);

  // TODO: Handle other possible success types.
  return result == ConnectionResult.SUCCESS || result == ConnectionResult.SERVICE_UPDATING;
}
 
Example 5
Source File: ExternalAuthUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * @param errorCode returned by {@link #checkGooglePlayServicesAvailable(Context)}.
 * @return true if the error code indicates that an invalid version of Google Play Services is
 *         installed.
 */
public boolean isGooglePlayServicesUpdateRequiredError(int errorCode) {
    return errorCode == ConnectionResult.SERVICE_UPDATING
            || errorCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
            || errorCode == ConnectionResult.SERVICE_DISABLED
            || errorCode == ConnectionResult.SERVICE_MISSING;
}
 
Example 6
Source File: ExternalAuthUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * @param errorCode returned by {@link #checkGooglePlayServicesAvailable(Context)}.
 * @return true if the error code indicates that an invalid version of Google Play Services is
 *         installed.
 */
public boolean isGooglePlayServicesUpdateRequiredError(int errorCode) {
    return errorCode == ConnectionResult.SERVICE_UPDATING
            || errorCode == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
            || errorCode == ConnectionResult.SERVICE_DISABLED
            || errorCode == ConnectionResult.SERVICE_MISSING;
}
 
Example 7
Source File: LocationProvider.java    From open-location-code with Apache License 2.0 5 votes vote down vote up
private void determineIfUsingGms() {
    // Possible returned status codes can be found at
    // https://developers.google.com/android/reference/com/google/android/gms/common/GoogleApiAvailability
    int statusCode = mGoogleApiAvailability.isGooglePlayServicesAvailable(mContext);
    if (statusCode == ConnectionResult.SUCCESS
            || statusCode == ConnectionResult.SERVICE_UPDATING) {
        mUsingGms = true;
    }
}
 
Example 8
Source File: GoogleApiClientHelper.java    From delion with Apache License 2.0 4 votes vote down vote up
private static boolean isErrorRecoverableByRetrying(int errorCode) {
    return errorCode == ConnectionResult.INTERNAL_ERROR
            || errorCode == ConnectionResult.NETWORK_ERROR
            || errorCode == ConnectionResult.SERVICE_UPDATING;
}
 
Example 9
Source File: GoogleApiClientHelper.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private static boolean isErrorRecoverableByRetrying(int errorCode) {
    return errorCode == ConnectionResult.INTERNAL_ERROR
            || errorCode == ConnectionResult.NETWORK_ERROR
            || errorCode == ConnectionResult.SERVICE_UPDATING;
}
 
Example 10
Source File: GoogleApiClientHelper.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private static boolean isErrorRecoverableByRetrying(int errorCode) {
    return errorCode == ConnectionResult.INTERNAL_ERROR
            || errorCode == ConnectionResult.NETWORK_ERROR
            || errorCode == ConnectionResult.SERVICE_UPDATING;
}
 
Example 11
Source File: PlayServiceManager.java    From android-sdk with MIT License 4 votes vote down vote up
public boolean isGeofencingAvailable() {
    status = availability.isGooglePlayServicesAvailable(context);
    return checker.checkForPermission(Manifest.permission.ACCESS_FINE_LOCATION)
            && location.isLocationEnabled()
            && (status == ConnectionResult.SUCCESS || status == ConnectionResult.SERVICE_UPDATING);
}