Allow phone number link in android studio app

Asked

Viewed 1,068 times

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’s a mobile site, how to allow in the app that this works, by clicking on the call help it already starts the link

1 answer

3


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


    }
  • I don’t think it’s necessary, as far as I can remember tel: on the link, as I mentioned here http://answall.com/a/45426/3635 .... However If it’s another problem you could explain to me, I find it very interesting.

  • actually if you are developing in android studio, only the link in the html layout will not be valid, need to set this in the app Activity

  • Androidstudio is just an IDE, but I think I understand what you said I will test and confirm, thank you :D

  • yes, but as I am doing here, I use local webview folder and to use html call is necessary...rs.. but test there is positive in...

Browser other questions tagged

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