added in version 24.1.0
belongs to Maven artifact com.android.support:customtabs:28.0.0-alpha1

CustomTabsSession

public final class CustomTabsSession
extends Object

java.lang.Object
   ↳ android.support.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.

Summary

Public methods

static CustomTabsSession createMockSessionForTesting(ComponentName componentName)

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

boolean mayLaunchUrl(Uri url, Bundle extras, List<Bundle> otherLikelyBundles)

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

int postMessage(String message, Bundle extras)

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

boolean requestPostMessageChannel(Uri postMessageOrigin)

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

boolean setActionButton(Bitmap icon, String description)

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

boolean setSecondaryToolbarViews(RemoteViews remoteViews, int[] clickableIDs, PendingIntent pendingIntent)

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

boolean setToolbarItem(int id, Bitmap icon, String description)

This method was deprecated in API level 25.1.0. Use CustomTabsSession#setSecondaryToolbarViews(RemoteViews, int[], PendingIntent)

boolean validateRelationship(int relation, Uri origin, Bundle extras)

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

Inherited methods

From class java.lang.Object

Public methods

createMockSessionForTesting

added in version 27.1.0
CustomTabsSession createMockSessionForTesting (ComponentName componentName)

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

Parameters
componentName ComponentName: The component the session should be created for.

Returns
CustomTabsSession A mock session with no functionality.

mayLaunchUrl

added in version 24.1.0
boolean mayLaunchUrl (Uri url, 
                Bundle extras, 
                List<