I currently use CustomTabsIntent to open a browser-tab despite the presence of another app that supports a given deep link:
class UrlOpener {
private var mClient: CustomTabsClient? = null
private var mSession: CustomTabsSession? = null
private val mConnection: CustomTabsServiceConnection = object : CustomTabsServiceConnection() {
override fun onCustomTabsServiceConnected(
name: ComponentName,
client: CustomTabsClient
) {
mClient = client
// Warm up the browser process
client.warmup(0 /* placeholder for future use */)
// Create a new browser session
mSession = client.newSession(CustomTabsCallback())
}
override fun onServiceDisconnected(name: ComponentName) {
mClient = null
mSession = null
}
}
init {
CustomTabsClient.getPackageName(context, null)?.let {
CustomTabsClient.bindCustomTabsService(context, it, mConnection)
}
}
fun openInAppBrowserTab(url: String) {
val customTabsIntent = CustomTabsIntent.Builder(mSession)
.build().launchUrl(context, Uri.parse(url))
}
}
This works fine for opening a browser tab. In the flow after opening the website, there is another redirect to the url supported by the app though, which then actually opens the app. Is there a way to configure a CustomTabsIntent in a way that it always stays inside the browser, even when facing redirects that would be handeled by another installed app?
I tried looking through the parameters that can be set in the CustomTabsIntentBuilder, but I couldn't find anything useful there..