handsome
I tried to Intent "action_dial" from webview. It doesn't perfectly works. When I click "href tag", it open error page then call dial page,too. error page message is "unknown_url_scheme". please help me
Here is my code
<a href= "tel:02-6285-0085"> 02-6285-0085</a>
Android
webview.setWebViewClient((WebViewClient) (new WebViewClient() {
public boolean shouldOverrideUrlLoading(@NotNull WebView view, @NotNull WebResourceRequest request) {
Uri uri = request.getUrl();
if (uri.getScheme().equals("tel")){
try {
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent); //
}catch (Exception ex) {
ex.printStackTrace();
}
}
return false;
}
}));
Try once if condition need to change in your current code.
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("tel:")) {
try {
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
startActivity(intent); //
}catch (Exception ex) {
ex.printStackTrace();
}
}
}
return false;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.