CustomTab¶
Static API for launching and managing Android Custom Tabs.
Overview¶
- Initialization is handled automatically during plugin startup.
- Cleanup is registered automatically on
Application.quitting. - On non-Android platforms, Custom Tab initialization is skipped and calls are ignored (
IsEphemeralBrowsingSupported()returnsfalse).
Methods¶
LaunchUrl¶
Launches the specified URL in a Custom Tab without a session.
Parameters
url(string): The URL to open.options(CustomTabOptions, optional): Visual and behavioral configuration.
Throws
ArgumentNullException: Ifurlis null, empty, or whitespace.
Remarks
- Basic launch without session management.
- Prefer
LaunchUrlWithSessionfor better performance and access to all features.
LaunchUrlWithSession¶
Launches the specified URL using a Custom Tabs session, enabling all features, URL prefetching, and consistent tab management.
Parameters
url(string): The URL to open.options(CustomTabOptions, optional): Visual and behavioral configuration.
Throws
ArgumentNullException: Ifurlis null, empty, or whitespace.
Remarks
- Preferred method for all URL launches. Use this by default.
- Automatically handles previously minimized tabs by removing them before launching a new tab.
- Provides faster load times through URL prefetching capabilities.
PrefetchUrl¶
Prefetches a URL in the background to improve perceived launch speed.
Parameters
url(string): The URL to prefetch.
Throws
ArgumentNullException: Ifurlis null, empty, or whitespace.
IsEphemeralBrowsingSupported¶
Checks whether ephemeral browsing is supported on the current device/browser setup.
Returns
trueif supported; otherwisefalse.
Remarks
- Requires
androidx.browser1.9.0 or higher.
UnbindCustomTabsService¶
Unbinds the Custom Tabs service connection.
Remarks
- Usually not required for normal usage because cleanup is already registered at app quit.
- Use only for advanced/manual lifecycle control.