Skip to content

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() returns false).

Methods

LaunchUrl

public static void LaunchUrl(
    string url,
    CustomTabOptions options = null
)

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: If url is null, empty, or whitespace.

Remarks

  • Basic launch without session management.
  • Prefer LaunchUrlWithSession for better performance and access to all features.

LaunchUrlWithSession

public static void LaunchUrlWithSession(
    string url,
    CustomTabOptions options = null
)

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: If url is 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

public static void PrefetchUrl(string url)

Prefetches a URL in the background to improve perceived launch speed.

Parameters

  • url (string): The URL to prefetch.

Throws

  • ArgumentNullException: If url is null, empty, or whitespace.

IsEphemeralBrowsingSupported

public static bool IsEphemeralBrowsingSupported()

Checks whether ephemeral browsing is supported on the current device/browser setup.

Returns

  • true if supported; otherwise false.

Remarks

  • Requires androidx.browser 1.9.0 or higher.

UnbindCustomTabsService

public static void 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.