fluttercommunity / fluttercommunity/flutter_webview_plugin
支持支付宝和微信支付功能
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 938
- PR merge metrics
- No merged PRs in 30d
Description
使用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;
}`
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named in the issue. Start by locating the Android WebView URL interception entry point and compare it with the supplied WeChat and Alipay handlers; done means the supported payment URL schemes open the corresponding installed apps and show the stated fallback when they are unavailable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100