Android Question How to programmatically check the installed version of GooglePlay Services on the Device

Anser

Well-Known Member
Licensed User
Longtime User
Hi,

How do I programmatically check the installed version of GooglePlay Services on a device ?.

I know the following code to know whether Google Play Services is installed or not

B4X:
Dim mFragment As MapFragment
If mFragment.IsGooglePlayServicesAvailable = False Then

I am not sure whether the above code is the only way OR the best way to check GooglePlay Service status on the device.

Unfortunately, the above code will only say whether GooglePlay services is available or not, it doesn't let you know the version. May be I am asking a very stupid question here.

The whole point is to inform the user that whether he needs to update his device's google play services version to the latest.

Regards

Anser
 

Anser

Well-Known Member
Licensed User
Longtime User
I don't know if this code is still valid:
B4X:
Dim mPackageManager As PackageManager
Dim GooglePlayServicesVersion As Int
GooglePlayServicesVersion = mPackageManager.GetVersionCode("com.google.android.gms")

Thank you. It is working. On my device, running the above code, it is displaying a value 9452440
When I checked the application manager in phones settings screen the version of Google Play Services is shown as 9.4.52(440-127739847)

Regards
Anser
 
Upvote 0
Top