2

If I run an app that requires Google Play Service (For example, an app that uses Mobile Vision API / Firebase, etc),

How do I know the minimum version of Google Play Services required on the device in order for the app to run?

Google official websites only recommend devices to update Google Play Services (In fact this is done automatically on devices that has Google Play installed)

Why I need to know

It is because I want to use the app on a completely offline device, that will not have an up-to-date Google Play Services installed.

My guess

A hint is that the version number of play services libraries are very similar to Google Play Services version number installed on the device.
As of today, the latest library version is 11.8.0; while the latest version of that installed on the phone is 11.9.75.
It is not the same, but I think it makes sense for the device to be ahead of library versions.

So is there a chance that the minimum version required actually equals to the version number of compiled library?

(In case you need me to specify a specific library - The Mobile Vision API is the one I need to know.)

Sira Lam
  • 5,179
  • 3
  • 34
  • 68
  • it will depend on what google play services APIs you use, keep note of all API's you use from the docs, and the version when the API was added, the minimum is what u need – Ayush Gupta Jan 31 '18 at 11:00
  • I am afraid that is not true. I just tried to install the app on a device that has Play Services v10.x but it cannot run (needs update). But the API is published in v9.2 according to the release note. – Sira Lam Jan 31 '18 at 11:08
  • Apologies, the **maximum** is what u need, not the **minimum** – Ayush Gupta Jan 31 '18 at 11:11
  • So if a device has **v10.1**, you cannot use an API published in **v10.2**, and you need to update *as far as I know*. – Ayush Gupta Jan 31 '18 at 11:12
  • I am lucky enough to find a device with factory version 11.0.55, and then I tried to compile a 11.0.2 sdk, it runs, but with error logs; and then if I change it to 11.2.0, it prompts me to update the SDK. It seems my guess was correct, and matches with what you said as well. – Sira Lam Jan 31 '18 at 11:17

2 Answers2

0

You can use sGooglePlayServicesAvailable:

GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)

to verify that Google Play services is installed and enabled on this device, and that the version installed on this device is no older than the one required by this client.

Returns:
status code indicating whether there was an error. Can be one of following in ConnectionResult: SUCCESS, SERVICE_MISSING, SERVICE_UPDATING, SERVICE_VERSION_UPDATE_REQUIRED, SERVICE_DISABLED, SERVICE_INVALID

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
  • Thanks for your answer. But this is actually not related, I already know how to check *runtime*; but before checking I need to know the minimum version (So that I know what device can run the app). – Sira Lam Feb 01 '18 at 02:31
0

Although I am not 100% sure (So I won't accept this answer of my own),

It does look like the minimum required version needed is really the library version you compiled with your app (i.e. specified in build.gradle).

Sira Lam
  • 5,179
  • 3
  • 34
  • 68