On Fri, Jun 25, 2010 at 5:36 PM, Nando Android <[email protected]> wrote:
> How can I get the version information of the current installed apps on my
> phone.
> If I do :
> PackageManager packageManager = getPackageManager();
> List<PackageInfo> packs = packageManager.getInstalledPackages(0);
> int size = packs.size();
> apps += "\nTotal apps = "+ size+"\n";
> for (int i = 0; i < size; i++)
> {
> PackageInfo p = packs.get(i);
> apps += "\nApp name: " +
> p.applicationInfo.loadLabel(packageManager).toString();
> apps += "\nPackage name: " + p.packageName;
> apps += "\nVersion name: " + p.versionName;
> apps += "\n";
> }
> tv.setText("Installed apps:\n"+apps);
> IĀ get all the apps currently installed.
> I wasn't able to figure out how to extract their correspondent version
> information.

Use p.versionName and p.versionCode.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to