Android Webview call dialer by link

Asked

Viewed 426 times

0

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

This is the link I’m using:

<a href="tel:3326 3728">Ligar</a>

1 answer

-1

Follows the excerpt of the code that solved this issue:

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

});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.