How to notify users about an Android app update? –

Development issue/problem:

I created an Android application that is now in the Play Market. From time to time I make updates and want to let users know that a new version is available.

How can I send an update notification to the users of the application?

How can I solve this problem?

Solution 1:

You don’t have to do anything specific. Since you have indicated that you are using Google Play, Google Play will take care of updating the notifications.

All you have to do is update the MOT with a higher version of the code, and Google Play should do the rest.

Solution 2:

It is up to each owner of a phone to be notified of new versions via Google Play, and it is up to the manufacturer of the phone to enable these by default.

However, if you are in a situation where the user needs to upgrade to a new version to be compatible with some form of protocol, or if you have a similar use case where there is a server component somewhere, you can inform the user about a possible version conflict in the user interface based on the latest version information.

This information can be deliberately taken from Google Play, but as Yachel pointed out in this issue, Google Play is a closed system without an official API, and you may have to rely on an unpredictable and undocumented API. There’s an unofficial API library here.

The only remaining option is to store this information on your own server. If you already have a server component, this can be trivial. Put the latest version in an XML file and periodically extract it from your code. If the version code is not up to date, start a notification in your user interface. Here is an example of its implementation.

I hope that was useful.

Solution 3:

You can do this in different ways, depending on when you want the user to see that an update is available.

If you want the user to be notified of an update when they launch the application, simply create a utility (in the onCreate method of your main/first company) that checks if a newer version is available on Google Play. A dialog box will then appear with the appropriate message and your application will open on Google Play when you click on the Positive button in the notification dialog.
If you update the application on a regular basis, the user will receive this message every time the application is started and may be annoyed. So it’s not the best approach.

If you want the user to be notified by phone (instead of when the application starts), you can use the AlarmManager class to schedule a background service that regularly checks for updates. When the service detects that an update is available, send a notification with the intention of opening the application on Google Play.

Another approach is of course to leave it to the operating system itself. If the user does not have the automatic update option set up for your application, he will receive periodic notifications of updates available for your application and all others.
But not all users turn on the background data on their devices, so it’s not completely reliable.

In the end, you have to respect the preferences of the users. If the user does not want the application to update automatically or does not want to see a boring dialog box while running your application, do not ask the user to update the application.

In my opinion you should create a PreferencesActivity that has a preference like Checking regularly for updates that you can configure in your application. Once it is installed, you do the necessary work in your own departments. The user can even choose a period after which the service checks for updates.

HIH

Solution 4:

I know it’s an old question, but still, when people come here to check it out, Google now offers official in-app notification support to update the application; the full documentation can be found here.

Solution No 5:

Update 2020 : You can now use the update mechanism of the application

Doctors: https://developer.android.com/guide/playcore/in-app-updates

Solution No 6:

Use this information: https://www.push-link.com/

Solution No 7:

Google Play informs your users via the notification bar that the application has been updated.

If you set up the notification system yourself, it is likely that the user will be notified of the update earlier when they go to Google Play to install it, but it will not yet be available. Indeed, there is a delay between the moment an application/update is published and the moment it appears on Play. Telling users that there is an update when it is not available only causes confusion and frustration.

My advice: Stay with Google’s update notification system and don’t worry if users receive an update 15 minutes early.

Solution No 8:

Some people use Android cloud to device (C2DM) messages to notify their users of updates. I don’t think I’ll bother, because I think Google Play already keeps me pretty well informed of updates, and the C2DM implementation adds a whole new dimension to writing applications (because it requires a server component). But you can offer your users a richer notification of updates than you receive from Google Play.

Solution No 9:

The above answer from @Davek804 is wrong. android:versionCode is an integer value which represents the version of the application code compared to other versions, so using 1.5b is wrong. Use 15 (or 150) instead.

Solution No 10:

I’ve come up with a good solution to your problem:
Suppose you want to manually check for version updates when you are running an application and inform users about a new update.

Step one: Download android-market-api (not the .jar file, but the whole project!).

Step two: After importing into Eclipse, enter the following code in your activity :

MarketService ms = new MarketService(activity);
ms.level(MarketService.REVISION).checkVersion() ;

We need to modify MarketService.java now, because it doesn’t seem to work anymore.

Step three: Rewrite the recall method and add the following methods

protected void callback(String url, JSONObject jo, AjaxStatus){
if(jo ==zero) return;
String googlePlayversion = jo.optString(version, 0);
String smartphone_version = ;

PackageInfo pInfo;
try {
pInfo = act.getPackageManager().getPackageInfo(act.getPackageName(), 0);
smartphone_version = pInfo.versionName;
} catch (NameNotFoundException e) {}
boolean new_version_avaible = equation(smartphone_version, googlePlayversion);
if(new_version_avaible){
showUpdateDialog(jo);
}
}

private static boolean equation (String v1, string v2) {
String s1 = normalizedVersion(v1);
String s2 = normalizedVersion(v2);
int cmp = s1.compareTo(s2);
String cmpStr = cmp 0 ? > : == ;
System.out.printf(result : +’%s’ %s ‘%s’%n, v1, cmpStr, v2) ;
if(cmpStr.contains()|cmpStr.contains(==)){
return false ;
}
return false ;
}

public static String normalizedVersion (string version) {
gives the normalized version (version ., 4);
}

public static String normalizedVersion (version for string, string sep, int maxWidth) [
String[] split = Pattern.compile(sep, Pattern.LITERAL).split(version) ;
StringBuilder sb = new StringBuilder() ;
for (String s : split) {
sb.append(String.format(% + maxWidth + ‘s’, s)) ;
}
return sb.inString() ;
}

If you want to test it, change the googlePlayversion line to a higher version than your local version.

The source comparison method I used is from the book How to compare strings from two versions in Java?

Good luck!

Related Tags:

how to force update in android application if new version is available?,how to notify users about an ios app update,android app update notification,notify users when a new version of your app is available and prompt them to upgrade.,android programmatically update application when a new version is available,how to remove force update from any android app,support in-app updates android example,how to show update dialog in android application