fluttercommunity / fluttercommunity/flutter_webview_plugin

支持支付宝和微信支付功能

Đang mở
#628 1 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
1.5k
Fork
938
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

使用webview的时候应用到微信和支付宝支付功能,自主增加了以下代码,测试成功,建议可以增加此功能,支付功能比较常用。
`if (url.startsWith("weixin://wap/pay?")) {
try{
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
activity.startActivity(intent);
}catch (Exception e){
Toast.makeText(activity,"未检测到微信,请安装后重试",Toast.LENGTH_SHORT).show();
}
// if(isAppAvilible(activity,"com.tencent.mm")){
//
// }else{
// }
return true;
}
else if (url.startsWith("alipays:") || url.startsWith("alipay")) {
try{
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
activity.startActivity(intent);
}catch (Exception e){
Toast.makeText(activity,"未检测到支付宝,请安装后重试",Toast.LENGTH_SHORT).show();
}
return true;
}
else if (url.contains("intent://platformapi/startapp")) {
try{
Intent intent = Intent.parseUri(url,
Intent.URI_INTENT_SCHEME);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setComponent(null);
// intent.setSelector(null);
activity.startActivity(intent);
}catch (Exception e){
Toast.makeText(activity,"未检测到支付宝,请安装后重试",Toast.LENGTH_SHORT).show();
}
// if(isAppAvilible(activity,"com.eg.android.AlipayGphone")){
// }else{
// Toast.makeText(activity,"尚未安装支付宝",Toast.LENGTH_SHORT).show();
// }
return true;
}`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.