Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.


class CustomTabsSession
   ↳ androidx.browser.customtabs.CustomTabsSession

A class to be used for Custom Tabs related communication. Clients that want to launch Custom Tabs can use this class exclusively to handle all related communication.


Public methods
static CustomTabsSession
createMockSessionForTesting(@NonNull componentName: ComponentName)

Provides browsers a way to generate a mock CustomTabsSession for testing purposes.

mayLaunchUrl(@Nullable url: Uri?, @Nullable extras: Bundle?, @Nullable otherLikelyBundles: MutableList<Bundle!>?)

Tells the browser of a likely future navigation to a URL.

postMessage(@NonNull message: String, @Nullable extras: Bundle?)

Sends a postMessage request using the origin communicated via CustomTabsService#requestPostMessageChannel( * CustomTabsSessionToken, Uri).

receiveFile(@NonNull uri: Uri, purpose: Int, @Nullable extras: Bundle?)

Passes an URI of a file, e.

requestPostMessageChannel(@NonNull postMessageOrigin: Uri)

Sends a request to create a two way postMessage channel between the client and the browser.

setActionButton(@NonNull icon: Bitmap, @NonNull description: String)

This sets the action button on the toolbar with ID CustomTabsIntent#TOOLBAR_ACTION_BUTTON_ID.

setSecondaryToolbarViews(@Nullable remoteViews: RemoteViews?, @Nullable clickableIDs: IntArray?, @Nullable pendingIntent: PendingIntent?)

Updates the RemoteViews of the secondary toolbar in an existing custom tab session.

setToolbarItem(id: Int, @NonNull icon: Bitmap, @NonNull description: String)

Updates the visuals for toolbar items.

validateRelationship(relation: Int, @NonNull origin: Uri, @Nullable extras: Bundle?)

Requests to validate a relationship between the application and an origin.

Public methods


@NonNull static fun createMockSessionForTesting(@NonNull componentName: ComponentName): CustomTabsSession

Provides browsers a way to generate a mock CustomTabsSession for testing purposes.

componentName ComponentName: The component the session should be created for.
CustomTabsSession A mock session with no functionality.


fun mayLaunchUrl(
    @Nullable url: Uri?,
    @Nullable extras: Bundle?,
    @Nullable otherLikelyBundles: MutableList<Bundle!>?
): Boolean

Tells the browser of a likely future navigation to a URL. The most likely URL has to be specified first. Optionally, a list of other likely URLs can be provided. They are treated as less likely than the first one, and have to be sorted in decreasing priority order. These additional URLs may be ignored. All previous calls to this method will be deprioritized.

url Uri?: Most likely URL, may be null if otherLikelyBundles is provided.
extras Bundle?: Reserved for future use.
otherLikelyBundles MutableList<Bundle!>?: Other likely destinations, sorted in decreasing likelihood order. Inside each Bundle, the client should provide a Uri using CustomTabsService#KEY_URL with Bundle#putParcelable(String, android.os.Parcelable).
Boolean true for success.


fun postMessage(
    @NonNull message: String,
    @Nullable extras: Bundle?
): Int

Sends a postMessage request using the origin commun