This article describes the method of Android programming to determine whether a program is installed on your phone. Share it for your reference, as follows:
1. First get the package name of the program
Connect this to your mobile phone ADB and you can see it by looking at logcat. For example: The package name of the QQ client is.
2. Then use the PackageManager to determine whether the package's program exists.
private boolean isPkgInstalled(String pkgName) { PackageInfo packageInfo = null; try { packageInfo = ().getPackageInfo(pkgName, 0); } catch (NameNotFoundException e) { packageInfo = null; (); } if (packageInfo == null) { return false; } else { return true; }
I hope this article will be helpful to everyone's Android programming design.