Vitaliy A
Vitaliy A

Reputation: 3838

How can i ensure that my app support minimum Google Play Services 4.1 version?

I need to get ConnectionResult.SUCCESS when I'm checking Google Play Services availability if installed Google Play Services version is 4.1+:

int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);

Currently I'm geting code == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED, when Google Play Services version is 5.0.84.

I know that all i need is to add some tag to manifest witch should include GooglePlayServices version code. But i do not know witch one and what version number belong to 4.1. Please advice.

Upvotes: 2

Views: 1657

Answers (2)

Eugen Pechanec
Eugen Pechanec

Reputation: 38223

If you need to support GMS back to 4.1 you need to include the following dependency

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

Alternatively extract <android-sdk>\extras\google\m2repository\com\google\android\gms\play-services\4.1.32\play-services-4.1.32.aar and import it as a library project if you're using Eclipse.

This will add the GMS interface library of version 4.1.32 to your project. This also means you have to use older APIs (before unified GoogleApiClient).

Upvotes: 0

Vitaliy A
Vitaliy A

Reputation: 3838

This is what i found till now:

No need to do any changes on manifest file.

Version code for Google Play Services is 7 digits number and its complicated from same digits as version name.

For example:

version 4.1.00 has code 4100000 version 6.5.99 has code 6599000

So, when i need to check if installed GooglePlayServices is updated enough i do:

int code = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    ...
    if (code == ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED) {
        if (GooglePlayServicesUtil.GOOGLE_PLAY_SERVICES_VERSION_CODE >= 4100000)
            result = true;// Meets minimum version requirements
    }

Upvotes: 7

Related Questions