Is it possible to make a Chrome CustomTabs intent not open an external application? Is it possible to make a Chrome CustomTabs intent not open an external application? google-chrome google-chrome

Is it possible to make a Chrome CustomTabs intent not open an external application?


This question is not clear to me. I think you wanted to say that you want always open the url in the Chrome Custom Tab without displaying choosing dialog for Chrome or any external application.

If my understanding is Okay, then in case of Chrome Browser, you should set the CustomTabIntent with the package of Chrome browser before launching the url.

private void launchURL(String url) {    CustomTabsIntent.Builder builderCustomTabs = new CustomTabsIntent.Builder();    CustomTabsIntent intentCustomTabs = builderCustomTabs.build();    intentCustomTabs.intent.setPackage("com.android.chrome");    intentCustomTabs.intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);    intentCustomTabs.launchUrl(this, Uri.parse(url));}

For details, check: custom chrome tabs asks for multiple browser to choose


In case the above answer doesn't solve your issue, you can occasionally add the "m." prefix to your URLs to get the mobile version of a website.

In my situation, opening "https://www.wikipedia.org" would always open the Wikipedia app and not a custom tab. Once I changed the URL to "https://en.m.wikipedia.org", the URL would always open in my Chrome Custom tab and even if the user navigates to different pages, they never leave my app.