Andorid检测支付宝客户端是否安装

来源:互联网 发布:js 360全景图 编辑:程序博客网 时间:2024/06/04 18:55

主要采用intent意图匹配间接实现检测支付宝客户端是否安装,代码如下:

    public static boolean checkAliPayInstalled(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;    }

目前测试有效

1 0
原创粉丝点击