Android应用识别支付宝收款二维码直接跳转支付宝转账界面

我们知道应用可以通过scheme跳转应用,支付宝的scheme

private static final String URL_FORMAT =
            "intent://platformapi/startapp?saId=10000007&" +
                    "clientVersion=3.7.0.0718&qrcode=https%3A%2F%2Fqr.alipay.com%2F{urlCode}%3F_s" +
                    "%3Dweb-other&_t=1472443966571#Intent;" + "scheme=alipayqr;package=com.eg.android.AlipayGphone;end";

这里需要将{urlcode}替换为你识别的二维码用户的id

 public boolean startAlipay(Activity activity, String urlCode) {
        return startIntentUrl(activity, URL_FORMAT.replace("{urlCode}", urlCode));
    }
public boolean startIntentUrl(Activity activity, String intentUrl) {
        try {
            Intent intent = Intent.parseUri(intentUrl, Intent.URI_INTENT_SCHEME);
            activity.startActivity(intent);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        } catch (ActivityNotFoundException e) {
            e.printStackTrace();
        }
    }

 

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页