1

.launchUrl(this@MainActivity, Uri.parse(url))

When url is https://www.amazon.com, the Amazon app is opening instead of the custom tab browser. Is there any way to prevent this from happening and forcing to use the custom tab browser instead of default apps?

Hillcow
  • 890
  • 3
  • 19
  • 48
  • Interesting, but we have the opposite problem. We _want_ the Chrome Custom Tab to open the native app, but it doesn't (and there is no "Open in the app" menu item) – nZeus Jul 08 '22 at 08:55
  • 1
    Does this help -> https://stackoverflow.com/questions/38156787/is-it-possible-to-make-a-chrome-customtabs-intent-not-open-an-external-applicati ? – balu Jul 20 '22 at 12:59

1 Answers1

0

If you add chrome package to the Custom Tabs intent it will open the custom tab instead of the app, i.e. tabsIntent.intent.setPackage("com.android.chrome"); before calling tabsIntent.launchUrl(context, Uri.parse("https://www.amazon.com"));

But will crash the app if Google Chrome is not installed.

Julio Cesar
  • 265
  • 1
  • 8