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.
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);
//getVersionCode is Deprecated, instead use getLongVersionCode().
long verCode = pinfo.getLongVersionCode();
//getVersionName is Deprecated, instead use versionName
String verName = pinfo.versionName;
You can get all packages and find out name with the following method call:
List<PackageInfo> packages = getPackageManager().getInstalledPackages(PackageManager.GET_META_DATA);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With