webview支付时候遇到的坑

 html5网页中 webview调起支付宝客户端支付

if (url.contains("http://wappaygw.alipay.com")) {


                    Intent intent = new Intent();
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(url));
                    startActivity(intent);

                    return true;

                }


            


 html5网页中 webview调起微信客户端支付


                 if (url.startsWith("weixin://wap/pay?")) {
                    Intent intent = new Intent();
                    intent.setAction(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(url));
                    startActivity(intent);

                    return true;

                }


出现如下错误   ,net::ERR_UNKNOW_URL_SCHEME,应在load(url)之前加入如下代码


 


    if (url.startsWith("http:") || url.startsWith("https:")) {
                    return false;
                }



你可能感兴趣的:(android)