一、Android判断是否安装微信
/**
* 检测是否安装支付宝客户端
* @param context
* @return
*/
public boolean isAliPayInstalled(Context context) {
Uri uri = Uri.parse("alipays://platformapi/startApp");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
ComponentName componentName = intent.resolveActivity(context.getPackageManager());
return componentName != null;
}
二、Android判断是否安装支付宝
/**
* 检测是否安装微信客户端
* @param context
* @return
*/
public boolean isWeixinAvilible(Context context) {
final PackageManager packageManager = context.getPackageManager();
List<PackageInfo> pinfo = packageManager.getInstalledPackages(0);
if (pinfo != null) {
for (int i = 0; i < pinfo.size(); i++) {
String pn = pinfo.get(i).packageName;
if (pn.equals("com.tencent.mm")) {
return true;
}
}
}
return false;
}