安卓app检测是否安装微信和支付宝

/**
 * 检测是否安装支付宝
 *
 * @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;
}