I searched here but nearly all questions are opposite.. now I ask; I have an webview app for android studio. It opens all URLs located in HTML page via my webview app.
But I want to add some exception. For example, I want https://play.google.com.... in default Google Play app, not my webview app.
summary: webview app must open some normal URLs via app itself, but some exceptional URLs via native another app...
my webviewclient code is so;
public class MyAppWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().endsWith("http://play.google.com")) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
view.getContext().startActivity(intent);
return true;
}
}