Support for other protocols in Android webview

Viewed 25767

I've created a web view app, the page that is displayed features market:// links but upon clicking them I get the 404 screen along with the error that the protocol is not supported. I've tried looking through documentation but was unable to find anything relating to this. Any help is much appreciated.

7 Answers

Instead of adding check for particular scheme, Modifying @sven solution, this will work for all schemes

public boolean shouldOverrideUrlLoading(WebView view, String url) {
 String host= Uri.parse(url).getHost();
 if (host == null) {
    view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    return true;
   }

   view.loadUrl(url);
   return false;
 }
Related