Reputation: 453
I am trying to figure out how to forcefully update the latest version from play store.
As the older version of my android app is already in play store where i haven't implement the check to get the current version of the app and compare with the play store app version like specified in the link update android app forcefully
I want that when I upload my new version on play store then user should not be able to use the app till he update the new version
.
Could you please help me out.
Upvotes: 1
Views: 13630
Reputation:
I have to do the same thing but what i did i gonna share you i hope this will help you.
1> I get the previous code version of my application and store it the string.xml. like my live app version code is 1. And my new app version code is 1.1.
This code is tell us our app version code.
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int versionNumber = pinfo.versionCode;
String versionName = pinfo.versionName;
2> Than check
if (newcodeversion > previouscodeversion) {
// open any activity or pop up }
3> And in the new activity place Text view with text "you have update version" and a button.And on the click of that button navigate to google play store.
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("Your application URL"));
startActivity(i);
Upvotes: 3
Reputation: 2561
This is not difficult to do. Simply bar the user from having the core functionality of what ever your app is responsible for.
Example, if it is a calling app, do a version check, and if the user has not updated as yet, restrict the use of call making entirely.
According to @pieter-b, taken from Forcing Updates:
For this to work, some kind of logic the app uses needs to be under your control. And then without that part of logic the app won't work and you can show a message: "your app is out of date, please download the new version to continue use."
Consider a messenger app where traffic goes through your servers. Just refuse to deliver messages of clients using an outdated version.
Also refer to Force update android app when new version available.
Upvotes: 1
Reputation: 41
It is not possible if the logic of comparing the versionCode and blocking the user isn't already placed inside the current app on PlayStore.
Upvotes: 1