Android WebView call dialer by link

0
Hello, I'm developing a WebApp from a phonebook, on the website I have the option of clicking a button to open the phone dialer already with the phone number. But in WebApp it does not work, it shows me the "Page not found".

This is the link I'm using:

<a href="tel:3326 3728">Ligar</a>
    
asked by anonymous 26.07.2017 / 17:20

1 answer

0

Here is the snippet of the code that solved this question:

myWebview.setWebViewClient(new WebViewClient(){

    public boolean shouldOverrideUrlLoading(WebView myWebview, String url) {
        if (url.startsWith("tel:")) {
            Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
            startActivity(intent);
            myWebview.reload();
            return false;
        }

        myWebview.loadUrl(url);
        return false;
    }

});
    
28.07.2017 / 20:55