'Chrome custom tabs activity result
I'm launching Chrome Custom Tabs using a similar function as below 👇 but I'm always getting the activity result as canceled which makes sense when clicking the close icon. but isn't really helping when I want to differentiate between a redirection to the app and the close icon click. is there a way to set the activity result for the custom tabs?
fun launchURL(context: Context, url: String, requestCode: Int) {
val builder = CustomTabsIntent.Builder()
val customTabsIntent = builder.build()
customTabsIntent.intent.data = Uri.parse(url)
(context as Activity).startActivityForResult(customTabsIntent.intent, requestCode)
}
Solution 1:[1]
AFAIK you cannot listen for specific url running in custom tab, so the only way you can handle the redirection to the app is to handle a deeplink. When user clicks the deeplink in the custom tab it will be treated like a normal deeplink in the system. If your app is registered to handle it - it will.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jakoss |
