I have in mind the force the user to update the application when there is a new update.
To accomplish this I had thought in the versionCode, obtain the versionCode of the application installed on the device:
public int getVersion() {
int v = 0;
try {
v = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return v;
}
And now i would need to know my server update versionCode.
Knowing the update versionCode and comparing it with the application of user versionCode i could check if it is different.
My ultimate goal is to check if there is an update. And if it exists, does not open the current application while the user does not update.
Any idea for this?
Thanks