Skip to content

Commit

Permalink
支持网页拨打电话
Browse files Browse the repository at this point in the history
  • Loading branch information
like5188 committed Aug 9, 2022
1 parent 1546874 commit 16bf59e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions webview/src/main/java/com/like/webview/core/X5WebViewClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ internal class X5WebViewClient(private val mListener: X5Listener?) : WebViewClie
// 这时便可以实现在app内访问网页。

// 如下方案可在非微信内部WebView的H5页面中调出微信支付
if (url != null && url.startsWith("weixin://wap/pay?")) {
val intent = Intent()
intent.action = Intent.ACTION_VIEW
intent.data = Uri.parse(url)
webView?.context?.startActivity(intent)
return true
if (url != null) {
if (url.startsWith("weixin://wap/pay?") ||
url.startsWith("tel:")// 网页中打电话
) {
webView?.context?.startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url)))
return true
}
}

webView?.loadUrl(url)
Expand Down

0 comments on commit 16bf59e

Please sign in to comment.