Actually I know how to start the market app by URL filtering with my custom webview client, but I want to make it more generic, that is to check each URL, not only the market url, but also some other url protocol that the webview would not know how to deal with it, and start the ACTION_VIEW intent to handle that.
I thought maybe I can check if the url is not started with "http" "https" "ftp" "mailto", if the url is in these protocol, the webview can handle it by itself, for others, I will start a new Intent to try to handle that.
What is your idea? am I correct? any missing protocol that webview could handle?
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url != null && url.contains("://") && url.toLowerCase().startsWith("market:")) {
try {
view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
} catch (Exception ex) {
}
}
view.loadUrl(url);
return true;
}
});