shouldOverrideUrlLoading is what the main cordova webview uses, so that's certainly the right approach. I believe it should also add CATEGORY_BROWSABLE to the intent to ensure that the user is prompted to confirm whether they actually want to make the call.
On Thu, Apr 2, 2015 at 7:07 PM, julio cesar sanchez <[email protected]> wrote: > I've been looking into issues and I have seen this one: > https://issues.apache.org/jira/browse/CB-8180 > > Right now the code to handle the tel links is inside the onPageStarted > > if (url.startsWith(WebView.SCHEME_TEL)) { > try { > Intent intent = new Intent(Intent.ACTION_DIAL); > intent.setData(Uri.parse(url)); > cordova.getActivity().startActivity(intent); > } catch (android.content.ActivityNotFoundException e) { > LOG.e(LOG_TAG, "Error dialing " + url + ": " + > e.toString()); > } > } > > But the problem is, it launchs the intent and try to open the web page, so > when you come back from the intent you see a "couldn't load the url" page > on the app. > > I've tried to use the view.stopLoading() but it doesn't seem to stop it. > The issue only talks about the tel links, but I suppose that will happen > with sms, mailto and some other links. > > > So, I think a solution might be to move that code to > shouldOverrideUrlLoading function. > > Is there any reason of doing this on the onPageStarted instead of using the > shouldOverrideUrlLoading? >
