In my application, I need to check Google Play services version (which is installed in user's device). Is it possible ? And if yes, how can I do that? I searched Google but I could not find anything!
I found simple solution:
int v = getPackageManager().getPackageInfo(GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, 0 ).versionCode;
But versionCode
is deprecated in API 28, so you can use PackageInfoCompat
:
long v = PackageInfoCompat.getLongVersionCode(getPackageManager().getPackageInfo(GoogleApiAvailability.GOOGLE_PLAY_SERVICES_PACKAGE, 0 ));