EngagementSignalsCallback


interface EngagementSignalsCallback


A callback class for custom tabs clients to get messages regarding the user's engagement with the webpage within their custom tabs. These methods may not be called for some webpages. In the implementation, all callbacks are sent to the Executor provided by the client or its UI thread if one is not provided.

Summary

Public functions

Unit
onGreatestScrollPercentageIncreased(
    scrollPercentage: @IntRange(from = 1, to = 100) Int,
    extras: Bundle
)

Called when a user has reached a greater scroll percentage on the page.

Unit
onSessionEnded(didUserInteract: Boolean, extras: Bundle)

Called when a CustomTabsSession is ending or when no further Engagement Signals callbacks are expected to report whether any user action has occurred during the session.

Unit
onVerticalScrollEvent(isDirectionUp: Boolean, extras: Bundle)

Called when a user scrolls the tab.

Public functions

onGreatestScrollPercentageIncreased

Added in 1.6.0
fun onGreatestScrollPercentageIncreased(
    scrollPercentage: @IntRange(from = 1, to = 100) Int,
    extras: Bundle
): Unit

Called when a user has reached a greater scroll percentage on the page. The greatest scroll percentage is reset if the user navigates to a different page. If the current page's total height changes, this method will be called again only if the scroll progress reaches a higher percentage based on the new and current height of the page.

Parameters
scrollPercentage: @IntRange(from = 1, to = 100) Int

An integer indicating the percent of scrollable progress the user has made down the current page.

extras: Bundle

Reserved for future use.

onSessionEnded

Added in 1.6.0
fun onSessionEnded(didUserInteract: Boolean, extras: Bundle): Unit

Called when a CustomTabsSession is ending or when no further Engagement Signals callbacks are expected to report whether any user action has occurred during the session.

Parameters
didUserInteract: Boolean

Whether the user has interacted with the page in any way, e.g. scrolling.

extras: Bundle

Reserved for future use.

onVerticalScrollEvent

Added in 1.6.0
fun onVerticalScrollEvent(isDirectionUp: Boolean, extras: Bundle): Unit

Called when a user scrolls the tab.

Parameters
isDirectionUp: Boolean

False when the user scrolls farther down the page, and true when the user scrolls back up toward the top of the page.

extras: Bundle

Reserved for future use.