CustomTabsUriHandler
class CustomTabsUriHandler(context: Context, toolbarColor: Int? = null, darkTheme: Boolean? = null, preferNativeApp: Boolean = false) : UriHandler(source)
Opens web links in a Custom Tab: the user's browser inside the app, with the app's colours and a way back, as Android recommends for links in content. Other schemes (mailto:, tel:, app links) go to the app that handles them.
AiElementsTheme provides one as LocalUriHandler, so citations, sources, Markdown links, A2UI and MCP Apps links all open this way.
Parameters
preferNativeApp
open a link in an installed app that handles it (e.g. a video in its app) before falling back to the Custom Tab (Android 11+, FLAG_ACTIVITY_REQUIRE_NON_BROWSER).