CustomTabsCallback

open class CustomTabsCallback
kotlin.Any
   ↳ androidx.browser.customtabs.CustomTabsCallback

A callback class for custom tabs client to get messages regarding events in their custom tabs. In the implementation, all callbacks are sent to the UI thread for the client.

Summary

Constants

static Int

Sent when loading was aborted by a user action before it finishes like clicking on a link or refreshing the page.

static Int

Sent when the tab couldn't finish loading due to a failure.

static Int

Sent when the tab has finished loading a page.

static Int

Sent when the tab has started loading a page.

static Int

Sent when the tab becomes hidden.

static Int

Sent when the tab becomes visible.

Public constructors

A callback class for custom tabs client to get messages regarding events in their custom tabs.

Public methods

open Unit
extraCallback(callbackName: String!, args: Bundle!)

Unsupported callbacks that may be provided by the implementation.

open Unit

Called when CustomTabsSession has requested a postMessage channel through CustomTabsService#requestPostMessageChannel( * CustomTabsSessionToken, android.net.Uri) and the channel is ready for sending and receiving messages on both ends.

open Unit
onNavigationEvent(navigationEvent: Int, extras: Bundle!)

To be called when a navigation event happens.

open Unit
onPostMessage(message: String!, extras: Bundle!)

Called when a tab controlled by this CustomTabsSession has sent a postMessage.

open Unit
onRelationshipValidationResult(relation: Int, requestedOrigin: Uri!, result: Boolean, extras: Bundle!)

Called when a relationship validation result is available.

Constants

NAVIGATION_ABORTED

static val NAVIGATION_ABORTED: Int

Sent when loading was aborted by a user action before it finishes like clicking on a link or refreshing the page.

Value: 4

NAVIGATION_FAILED

static val NAVIGATION_FAILED: Int

Sent when the tab couldn't finish loading due to a failure.

Value: 3

NAVIGATION_FINISHED

static val NAVIGATION_FINISHED: Int

Sent when the tab has finished loading a page.

Value: 2

NAVIGATION_STARTED

static val NAVIGATION_STARTED: Int

Sent when the tab has started loading a page.

Value: 1

TAB_HIDDEN

static val TAB_HIDDEN: Int

Sent when the tab becomes hidden.

Value: 6

TAB_SHOWN

static val TAB_SHOWN: Int

Sent when the tab becomes visible.

Value: 5

Public constructors

<init>

CustomTabsCallback()

A callback class for custom tabs client to get messages regarding events in their custom tabs. In the implementation, all callbacks are sent to the UI thread for the client.

Public methods

extraCallback

open fun extraCallback(callbackName: String!, args: Bundle!): Unit

Unsupported callbacks that may be provided by the implementation.

Note:Clients should never rely on this callback to be called and/or to have a defined behavior, as it is entirely implementation-defined and not supported.

This can be used by implementations to add extra callbacks, for testing or experimental purposes.

Parameters
callbackName String!: Name of the extra callback.
args String!: Arguments for the calback

onMessageChannelReady

open fun onMessageChannelReady(extras: Bundle!): Unit

Called when CustomTabsSession has requested a postMessage channel through CustomTabsService#requestPostMessageChannel( * CustomTabsSessionToken, android.net.Uri) and the channel is ready for sending and receiving messages on both ends.

Parameters
extras Bundle!: Reserved for future use.

onNavigationEvent

open fun onNavigationEvent(navigationEvent: Int, extras: Bundle!): Unit

To be called when a navigation event happens.

Parameters
navigationEvent Int: The code corresponding to the navigation event.
extras Int: Reserved for future use.

onPostMessage

open fun onPostMessage(message: String!, extras: Bundle!): Unit

Called when a tab controlled by this CustomTabsSession has sent a postMessage. If postMessage() is called from a single thread, then the messages will be posted in the same order. When received on the client side, it is the client's responsibility to preserve the ordering further.

Parameters
message String!: The message sent.
extras String!: Reserved for future use.

onRelationshipValidationResult

open fun onRelationshipValidationResult(relation: Int, requestedOrigin: Uri!, result: Boolean, extras: Bundle!): Unit

Called when a relationship validation result is available.

Parameters
relation Int: Relation for which the result is available. Value previously passed to CustomTabsSession#validateRelationship(int, Uri, Bundle). Must be one of the CustomTabsService#RELATION_* constants.
requestedOrigin Int: Origin requested. Value previously passed to CustomTabsSession#validateRelationship(int, Uri, Bundle).
result Int: Whether the relation was validated.
extras Int: Reserved for future use.