How to decide which version of Google Play services to use? - android

I am working on an Android application which supports Android version 14 and above. I have compiled my application against Android version 21.
I have used Google Play Services 7.0.0. The application works fine on Android 21. But when I run the application on Android version 19, it throws the following exception
Google Play services out of date. Requires 7095000 but found 6183036
So, I want to know what should be the version of Google Play that I should include in my application so that it works fine on Android 14 and above.

I think you are trying to find an answer to your question using a wrong approach.
The version of the Google Play Services that you want to include depends on the APIs your application implements. Picking a version based on the device you want to support will affect your application performance in a negative way.
Nearby Connections API, Places API are added in the Google Play services 7.0. If your application is using any of those or other APIs added in this version of Play Services then, these features may not work if you specify a lesser version in the Gradle files.
Similarly, Mobile Vision API, Nearby Messages were introduced in the Google Play Services version 7.8. There is no way you can implement them by including an earlier version of Play Services even if you want to support Android 2.3 devices.
Maps and Location Based Services services had been updated in many Play Services versions. Each update has added a small feature to it and improved overall battery efficiency, responsiveness. The version number you are using will affect the battery life ...
In every update to the Google Play Services existing versions, new APIs are released and old ones are improved. Consider the APIs your application is implementing then decide which version of the Play Services you want your users to update so that they can use your application smoothly.
Many Android users regularly update their Google Play Services. Even if the user has a KitKat device or Ice Cream Sandwich they could have updated their Google Play Services to the latest 7.8 version or to an intermediate version.

You can change the minimum sdk version in gradle(app) file to run your application in lower versions of android.

Related

Are there any corelation between Android OS version and supported Google play services version?

Firebase Crashlytics has announced that it's going to remove its old version and we should use its new version SDK till november 15th on our androird app. To do so, we should also increase our minimum supported google play services version to at lease 16 which currently is 11.xx.xx.
So the question is what android devices don't support google play services v 16.xx.xx? I need to know this so I can estimate our users churn.
Are there any relations between minimum google play services version and Android OS version or Android API level or Device model?
Are there any relations between minimum google play services version and Android OS version or Android API level or Device model?
As with any other unknown app, just peek its Manifest. If there's limitation on sdk, it will be there as well.
So the question is what android devices don't support google play services v 16.xx.xx?
That's going to be an extremely long list of devices that are mostly no longer in use any more. It's probably not worthwhile to try to get this list, as it's going to take so much work to process what that means for you. It's probably better to take the advice of Android Studio (during new project configuration) when it says that "your app will run on approximately 99.8% of devices" when targeting api level 16. According to the documentation:
In general, devices running Android 4.1 (API level 16) or later and have the Google Play services app installed receive updates within a few days. This allows you to use the newest APIs in Google Play services and reach most of the devices in the Android ecosystem. Devices older than Android 4.1 or devices without the Google Play services app are not supported.
Are there any relations between minimum google play services version and Android OS version or Android API level or Device model?
Play services currently keeps itself up to date on all devices that target API level 16 or higher.
If you want to fully understand all the documentation details about the relationship between Play services and Android API levels, you should read the documentation. Play services doesn't target anything about specific devices or models. It is purely dependent on API level.

Firebase: How can I ensure compatibility with various versions of Google Play Services?

I want to incorporate messaging/Push notifications in my Android App and since FCM is the newest version recommended, I just checked the Firebase prerequisites and it says,
Prerequisites
A device running Android 4.0 (Ice Cream Sandwich) or newer, and Google Play services 10.2.0 or higher
The Google Play services SDK from the Google Repository, available in the Android SDK Manager
The latest version of Android Studio, version 1.5 or higher
But, it isn't so that all the devices running ICS will have Google Play Services >= 10.2.0. Infact, this is the latest version of it. So, if I decide to go with FCM, all the devices having Play Services <= 10.2.0 will be out of my reach. If then I decide to bump the version down, Firebase doesn't seem to support any.
I want to use Firebase's and Google Play Services newest features and extend my support for devices running Google Play services >= 9.0.0.
This seems to be a fundamental problem with any library. Android provides Support library to mitigate this.
What is the recommended approach to support all these Play Services versions?
Just have the user update to the latest Google Play Services, by placing checkers. From the docs:
Apps that rely on the Play Services SDK should always check the device for a compatible Google Play services APK before accessing Google Play services features. It is recommended to do this in two places: in the main activity's onCreate() method, and in its onResume() method. The check in onCreate() ensures that the app can't be used without a successful check. The check in onResume() ensures that if the user returns to the running app through some other means, such as through the back button, the check is still performed.
If the device doesn't have a compatible version of Google Play services, your app can call GoogleApiAvailability.makeGooglePlayServicesAvailable() to allow users to download Google Play services from the Play Store.
Every device API 14 or higher (the new minimum SDK version as of 10.2.0) that has Google Play services is automatically upgraded to the latest version of Google Play services - in fact, a new version of the API only becomes available to developers when it is available on 100% of devices.

Cannot upload new APK to Google Play because of Google Play services version

I have minSdk set to 8 (Froyo) because of client's wish. Google Play won't allow me to upload new .apk. This is what it says:
Warnings
You uploaded an APK that uses Google Play services version 4030500. This will only work with Android API levels of 9 and above. It is discouraged to use this Google Play services version unless you have set the minSdkVersion in your manifest to 9 or higher.
Is there any chance to support versions older than Gingerbread?
Thanks in advance.
You have to use an older version of the Google Play Services to be Froyo compatible.
change in your build.gradle file to:
compile 'com.google.android.gms:play-services:4.1.+'
ps.: but I strongly advise in explaning to the client that Froyo is dead and gone and users that still have those devices are users that usually only make phone calls and SMS. They never go to Google Play to download new apps because their devices are too old and are not able to run any modern app properly.

Find out if Google Play Services can't be updated

I have an app that is released and working great. Every now and then few users post me and say that the app requests them to update Google Play Services but Google Play doesn't show the update. This is because their device is no longer supported by the latest version of Google Play Services.
Is there any other way to determine if a device is supported by the version of Google Play Services which you are using, other than checking if the device runs Android 2.3 or higher? (2.3 or higher is quaranteed to have the latest version)
You can use PackageManager to get versionCode of Google Play Services installed on the device (if present):
int versionCode = getPackageManager().
getPackageInfo("com.google.android.gms", 0).versionCode;
and show Dialog to the user, but I'd personally do nothing about that. If the latest version of platform is 2.3 just set minSdk to 2.3 - that would eliminate users on older versions (which makes no difference as they would not be able to use your app anyway).
EDIT
If you care your pre 2.3 users then you can release separate app that is build against Google Play Services for Froyo.

Google Play Service , Using Updated Google Map V2

i am using google play services in my project, i am trying to use google map v2 service in my app.
For this i included play services as dependency in build.gradle file as mentioned in this thread.
for now the latest version of play services is 3.2.65 and i am pointing to it. Ok.
So my question is ,In the future when google releases newer version of play services and the device has play services version above 3.2.65 which was specified in build.gradle file, will cause any problem or not? And will my application adapts the latest feature of play services automatically or i have to release updates of my application every time google releases newer version of play services.
And if not then is there any other way or including play services in module dependency so that my application will always use updated version of play services.
Thanks
My guess is you have to recompile your project with a newer version of the library.
Various library versions are downloaded on your machine and used to compile the project.
SDK_DIRECTORY/extras/google/m2repository/com/google/android/gms
Of course Google releases things in order to preserve compatibility, so if you don't need any new feature/API you don't have to update your project.
In your build.gradle file, you can also write in this way:
compile 'com.google.android.gms:play-services:3.1.+'
So you will pick up any new 3.1.x version whatever is the latest number.
In the future when google releases newer version of play services and the device has play services version above 3.2.65 which was specified in build.gradle file, will cause any problem or not?
No, it won't cause any problems. Google Maps Android API v2 is developed in a forward-compatible way. No change will ever be made that can break older apps.
And will my application adapts the latest feature of play services automatically or i have to release updates of my application every time google releases newer version of play services.
Depends. Most of the bug fixes are made in the Google Play Services app and you don't need to update client library. Because client library has almost no code, there is low chance any bug will appear there.
If you want to use new features, you will obviously have to update the library to be able to call new APIs.

Categories

Resources