Adam
Adam

Reputation: 957

How to get version number of another application?

I'm trying to listen for updates to apps that aren't my own. You can listen for intent.action.PACKAGE_ADDED and use the uid to get the app name like so:

PackageManager manager = context.getPackageManager();
    String name = manager.getNameForUid(uid);

Is there any way to get that app's version number? I've looked through the PackageManager methods and couldn't find anything helpful.

Upvotes: 1

Views: 74

Answers (1)

matiash
matiash

Reputation: 55340

That information is part of PackageInfo (versionCode and versionName).

You can get that via the PackageManager.getPackageInfo() method

Upvotes: 2

Related Questions