private boolean checkAppInstalled(Context context, String pkgName) { if (pkgName== null || pkgName.isEmpty()) { return false; } final PackageManager packageManager = context.getPackageManager(); List<PackageInfo> info = packageManager.getInstalledPackages(0); if(info == null || info.isEmpty()) return false; for ( int i = 0; i < info.size(); i++ ) { if(pkgName.equals(info.get(i).packageName)) { return true; } } return false; }
判断应用是否安装
最新推荐文章于 2021-07-30 10:42:25 发布