How to allow users to check for the latest app version from inside the app?


I want to add a "Check for update" button in apps so that when someone clicks it, it will display a toast message / progress dialog for checking the app's version.

If new version is found the apps will auto download it to the phone and let user to manually install the updated apps.

Or any others method will do as long as it can check for latest version and notify the user to update.

Update: Now you can do this inside your app using

This question is tagged with java android http versioning

~ Asked on 2011-09-04 08:30:47

The Best Answer is


To save time writing for check new version update for android app, I written it as library and open source at

~ Answered on 2013-04-04 13:49:42


You can use this Android Library: It aims to provide a reusable instrument to check asynchronously if exists any newer released update of your app on the Store. It is based on the use of Jsoup ( to test if a new update really exists parsing the app page on the Google Play Store:

private boolean web_update(){
    try {       
        String curVersion = applicationContext.getPackageManager().getPackageInfo(package_name, 0).versionName; 
        String newVersion = curVersion;
        newVersion = Jsoup.connect("" + package_name + "&hl=en")
                .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/")
        return (value(curVersion) < value(newVersion)) ? true : false;
    } catch (Exception e) {
        return false;

And as "value" function the following (works if values are beetween 0-99):

private long value(String string) {
    string = string.trim();
    if( string.contains( "." )){ 
        final int index = string.lastIndexOf( "." );
        return value( string.substring( 0, index ))* 100 + value( string.substring( index + 1 )); 
    else {
        return Long.valueOf( string ); 

If you want only to verify a mismatch beetween versions, you can change:

value(curVersion) < value(newVersion) with value(curVersion) != value(newVersion)

~ Answered on 2014-01-19 17:36:31

Most Viewed Questions: