How to get application version?

Put your problem here if it does not fit any of the other categories.

How to get application version?

Postby elmuSSo » Wed Feb 09, 2011 1:44 am

Hello. How can I get application version from installed applications?
I can get Application name, label, paths, but where is the version and how to get it?

This is what I got now:
PackageManager pm = this.getPackageManager();
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);

List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.PERMISSION_GRANTED);

for (ResolveInfo rInfo : list) {
Log.w("Installed Applications", rInfo.activityInfo.applicationInfo.loadLabel(pm).toString() );
)

In applicationInfo structure I can't see anything about version of particular app.
elmuSSo
elmuSSo
Freshman
Freshman
 
Posts: 4
Joined: Tue Sep 15, 2009 3:18 am
Location: Poland

Top

Re: How to get application version?

Postby azekrot » Wed Feb 09, 2011 9:51 pm

It's in android.content.pm.PackageInfo: versionCode, versionName
azekrot
Developer
Developer
 
Posts: 49
Joined: Thu Sep 02, 2010 7:58 pm

Re: How to get application version?

Postby elmuSSo » Thu Feb 10, 2011 9:58 pm

Thank You. works fine.
elmuSSo
elmuSSo
Freshman
Freshman
 
Posts: 4
Joined: Tue Sep 15, 2009 3:18 am
Location: Poland

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 26 guests