EngagementSignalsCallback


public 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 methods

default void
onGreatestScrollPercentageIncreased(
    @IntRange(from = 1, to = 100) int scrollPercentage,
    @NonNull Bundle extras
)

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

default void
onSessionEnded(boolean didUserInteract, @NonNull Bundle extras)

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.

default void
onVerticalScrollEvent(boolean isDirectionUp, @NonNull Bundle extras)

Called when a user scrolls the tab.

Public methods

onGreatestScrollPercentageIncreased

Added in 1.6.0
default void onGreatestScrollPercentageIncreased(
    @IntRange(from = 1, to = 100) int scrollPercentage,
    @NonNull Bundle extras
)

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
@IntRange(from = 1, to = 100) int scrollPercentage

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

@NonNull Bundle extras

Reserved for future use.

onSessionEnded

Added in 1.6.0
default void onSessionEnded(boolean didUserInteract, @NonNull Bundle extras)

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
boolean didUserInteract

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

@NonNull Bundle extras

Reserved for future use.

onVerticalScrollEvent

Added in 1.6.0
default void onVerticalScrollEvent(boolean isDirectionUp, @NonNull Bundle extras)

Called when a user scrolls the tab.

Parameters
boolean isDirectionUp

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

@NonNull Bundle extras

Reserved for future use.