安卓app检测是否安装微信和支付宝
warning:
这篇文章距离上次修改已过1033天,其中的内容可能已经有所变动。
/**
* 检测是否安装支付宝
*
* @return
*/
public boolean checkAliPayInstalled() {
Uri uri = Uri.parse("alipays://platformapi/startApp");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
ComponentName componentName = intent.resolveActivity(this.getPackageManager());
return componentName != null;
}
/**
* 检测是否安装微信
* @return
*/
public boolean checkWechatInstalled() {
Uri uri = Uri.parse("weixin://");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
ComponentName componentName = intent.resolveActivity(this.getPackageManager());
return componentName != null;
}