What i have
I have an application that is highly dependent on Google Play services (for Firebase), so I need the user device to install Play Services. More importantly, the version of Play Services installed on the device must be equal to or higher than the Play Services that I use in my application.
What I want
I want to show a message (possibly a dialogue or a snack bar) on the Splash screen of my application if the user uses an old version of Service Services, which version targeting I use in my application.
As of now, the version of Play Services that I use in my application is 10.0.1. Obviously, this is the name of the version.
I know I can do it
int v = getPackageManager().getPackageInfo("com.google.android.gms", 0 ).versionName;
But I can’t compare the versions of the Play Services installed on the device and the Play Services that I use? Should I do this using versionCode instead of versionName? If so, how do I find out the version code of the Services of the Services that I use?
Or is there another (or better) way to do this?
source
share