Maximizing Google Play Application Compatibility

What are the recommended methods to maintain the broadest backward compatibility of an Android application across Google Play services?

Developer implementation documentation for using Android Studio points to compile against v5. + compile 'com.google.android.gms:play-services:5.+'

which with the downloads available that I am using seems to end with version 5208000. After which I get errors and warnings returned when testing the application:

W/GooglePlayServicesUtil Google Play services out of date. Requires 5208000 but found 5089036
E/GooglePlayServicesUtil GooglePlayServices not available due to error 2
      

Admob, my dependency on Google Play Services, is working fine. If you follow Google's calling guidelines isGooglePlayServicesAvailable()

and GooglePlayServicesUtil.getErrorDialog()

, the user is informed that an update is required for the app to work and is sent to a repository where there are no updates available.

Elsewhere, backward compatibility means compiling with the oldest version of the API that supports the functionality you want. So I tried with v4 compile 'com.google.android.gms:play-services:4.+'

, which generated another error:

E/GooglePlayServicesUtil﹕ The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
      

A search around indicates that this is a false report and can be ignored.

If I compile a new version of the API and it doesn't appear on the device, does everything work? Or do I need to convince users to update? Is it better to compile with an older version of the API and assume everything is correctly compatible with the newer versions running on devices?

+3


source to share


1 answer


I am an SDK developer who optionally depends on Google Play Services, and my approach, as you said, was compiled for the oldest version of Google Play Services which contains the APIs I need, so that downstream clients won't have to deal with such issues.

If the APIs you need are available in version 4, it can be compiled with com.google.android.gms:play-services:4.+

and followed by Google's directions to show a prompt to the user to update. Users will only see the upgrade dialog if they are running an older version of v4, or if they somehow stay on v3. In any case, the update dialog should correctly bring them to the Play Store, where the update will actually be available.



If the required APIs are only available in version 5, do not use a wildcard version (i.e. 5.+

). You should compile an older version that is likely to be widely distributed, eg com.google.android.gms:play-services:5.0.89

. Using a wildcard means you will compile the most recent version of Google Play Services that you have installed in the Android SDK manager on whatever computer / environment you intend to compile in, which just isn't the case for me - I don't know, Don't worry if it will Google build in the library, I like to know exactly what I am compiling into my application.

Also, with a wildcard, if you always update your SDK manager, whenever you compile a version of your application and then submit it to Google Play, you may have just submitted the application against a version of Services of a Service that is not Widespread or worse, not even available for download on every device, in which case users will receive a dialog box and will not be able to update as you saw during development.

+3


source







All Articles