Dim Dim - 11 months ago 72
Android Question

Checking external app version name in android

I would like to know how to read installed apk version.
For example, from my app i would like to know what version of Skype is installed on my phone.

To Read my app version i use:

PackageInfo pinfo = null;
pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
String versionName = pinfo.versionName;

Of course with try/catch surrounded.

Answer Source

You need to figure out what is the right package name of the skype installed on your device.

PackageInfo pinfo = null;
pinfo = getPackageManager().getPackageInfo("com.skype.android", 0);
int verCode = pinfo.getVersionCode();
String verName = pinfo.getVersionName();

You can get all packages and find out name with the following method call:

List<PackageInfo> packages = getPackageManager().getInstalledPackages(PackageManager.GET_META_DATA);