Allow phone number link in app android studio [duplicate]

0

And I created a webview app, and I'm testing it with local folder and web, and in the app has the html link to link directly from a link with the phone number, because it is a mobile site, such as allow in the app that it works, clicking on the call help it already initiates the connection

    
asked by anonymous 06.08.2016 / 20:57

1 answer

3

I found the answer after much cost and adaptation

 myWebView.setWebViewClient(new WebBrowser());

private class WebBrowser extends WebViewClient {


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


    }
    
09.08.2016 / 01:28