Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force users to have latest android app version

Is it possible to check on startup of an Android app whether the user has the latest version of it and force him to update if he has not? Or at least checkt whether there is a new version and tell him, that the app only will work again when he downloads and installs the update?

Background is that I have an app that needs to communicate with a server. When I change something in the interface between server and client I want to assure that the client has the latest version.

Is there any native way to do this? Or do I have to check this on my own?

Is this only accessible if you have a mysql database? is it possible to do this with just plain text on a webpage and have it checked with the current app version?

like image 382
Drake Avatar asked Jul 08 '11 04:07

Drake


People also ask

Can I force user to update app Android?

Unlike web applications, when the mobile app is installed on the user's device you have no control already. Unfortunately, there is no built-in solution, that works for both App Store and Google Play, to force users to update their installed application versions.

Can you force update an app?

You can use https://appupgrade.dev/ service to force update you mobile apps. You need to create new version for your app versions you want to update in the app upgrade service and select whether you want to force it or just want to let users know that new version is available.

How do I force a user to update?

Short Answer: You cannot force all versions to update because there are too many scenarios at play for your users (maybe some users downloaded your app and haven't used data/wifi since then, or maybe some people have custom versions of Android which don't use Google play framework for app updates, etc).


1 Answers

is it possible to do this with just plain text on a webpage and have it checked with the current app version?

That's what I would do:

Checking latest version on your server, in a text file:

HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);

String latestVersion = "";
InputStream in = response.getEntity().getContent();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
StringBuilder str = new StringBuilder();
String line = null;
while((line = reader.readLine()) != null)
{
    str.append(line);
}
in.close();
latestVersion = str.toString();

and then compare it to the installed version:

private String getSoftwareVersion() {
    try {
            PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
            return packageInfo.versionName;//EDIT: versionCode would be better
    } catch (PackageManager.NameNotFoundException e) {
            Log.e(TAG, "Package name not found", e);
    };
 }
like image 179
Waza_Be Avatar answered Sep 17 '22 03:09

Waza_Be