Take the 2-minute tour ×

Im trying to figure out an easier (more automated way) to see all the version numbers of the apk's (both user installed and preinstalled) that are currently installed on an Android device.

currently I have been going about it like this:

a. The version is in the apk
b. The apk is typically in /system/app
c. The package name to apk name can be found in /data/system/packages.xml
d. The tricky part is that the application NAME is usually in a string resource in the apk file – like strings.xml (default name)
e. This can also be done from within the android SDK using the PackageManager family of API’s

This is extremely time consuming and Im doing this for many, many, many devices. Im just thinking that there has to be an easier way then how Im going about it.

Thanks for the help, as always, its very appreciated.

share|improve this question
with "version number" you mean the versionCode and versionName in the apps manifests? –  YuviDroid Mar 10 '12 at 0:02
add comment

2 Answers

up vote 0 down vote accepted

I did it, whoooo!!! ..... I am posting this code to anyone else that need to find the packagenames and version names of everything on the device.

import java.util.List;
import android.app.Activity;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.widget.TextView;

public class main extends Activity {

public void onCreate(Bundle savedInstanceState) {

    String bldr = new String();

    List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
    bldr = "Total packages --> " + packs.size() + "\n";

        PackageInfo p = packs.get(i);
        bldr = bldr + "<" + p.packageName + ">" + "\t" + "v" + p.versionName + "\n";

    TextView tv = new TextView(this);
    tv.setMaxLines(packs.size() + 2);
    tv.setMovementMethod(new ScrollingMovementMethod());
    Log.w("com.tmobile.pr.showAllPackages", bldr.toString());
share|improve this answer
add comment

The only one of your approaches that is valid is:


The rest... I have no idea why you think it would even work, let alone do so reliably. What makes you think that people will be using string resources for these, considering that versionCode in particular never has to be translated?

This is extremely time consuming

The code to call PackageManager, iterate over the installed applications, and retrieve the version information should take a handful of milliseconds.

share|improve this answer
add comment

Your Answer


