亲测可用:
public boolean isAppInstalled(Context context, String packageName) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
List<String> pName = new ArrayList<String>();
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
pName.add(pn);
}
}
return pName.contains(packageName);
}