http://blog.csdn.net/xiaodongrush/article/details/9320135
1. 首先得到该程序的包名
这个连上手机ADB,看logcat就能看到。比如:QQ客户端的包名是com.tencent.mobileqq。
2. 然后通过PackageManager判断是否存在该包的程序
- private boolean isPkgInstalled(String pkgName) {
- PackageInfo packageInfo = null;
- try {
- packageInfo = this.getPackageManager().getPackageInfo(pkgName, 0);
- } catch (NameNotFoundException e) {
- packageInfo = null;
- e.printStackTrace();
- }
- if (packageInfo == null) {
- return false;
- } else {
- return true;
- }