Android WebView call dialer by link

Hello, I am developing a webapp of a phone guide, on the site I have the option to click a button to open the dialer of the Mobile already with the phone number. But in the WebApp does not work, it shows me the"page not found".

This is the link I'm using:

<a href="tel:3326 3728">Ligar</a>
Author: Christian Herber, 2017-07-26

1 answers

Follows 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;
    }

});
 0
Author: Christian Herber, 2017-07-28 18:55:59