IsGooglePlayServicesAvailable always returns 2

I am trying to embed the Google Play Services library in my android app. But there is a problem with the isGooglePlayServicesAvailable function.

Although my game services are up to date, it returns 2, which means SERVICE_VERSION_UPDATE_REQUIRED according to the documentation.

My code is below:

 @Override
protected void onResume() {
    super.onResume();
    int statusCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(LoginSigninActivity.this);
    if( statusCode != ConnectionResult.SUCCESS)
    {
        Log.e("statuscode",statusCode+"");
        if(GooglePlayServicesUtil.isUserRecoverableError(statusCode))
        {
            Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                    statusCode,
                    LoginSigninActivity.this,
                    REQUEST_CODE_RECOVER_PLAY_SERVICES);

            // If Google Play services can provide an error dialog
            if (errorDialog != null) {
                errorDialog.show();
            }
        }
        else
        {
            Toast.makeText(this, getString(R.string.toast_google_play_services_not_found),Toast.LENGTH_LONG).show();
        }
    }
}

      

Thanks in advance.

PS The error dialog is always displayed.

+3


source to share


2 answers


No, it shouldn't be.

Android 4.4.4 device has version 5.0.89 playback service where when Android preview devices support 5.2.08 playback. This is the reason why android studio is asking to update the version of the game service to 5.2.08. So for now use

compile 'com.google.android.gms:play-services:5.0.89' 

      



If you are using an Android emulator I think you should be using 5.2.08.

And if you want to update your game service to 5.2 see this .

+2


source


I also had the same problem. I used the latest version of Game Services: 5. + to develop the application. But my device where Kitkat is using the game services version: 4.4.52. He always said SERVICE_VERSION_UPDATE_REQUIRED

because I am building an app that uses the upper version of the game service, but the device has a lower version.



My suggestion is to use the lower game version to develop your app, or use a device using the upper game version.

0


source







All Articles