public final class SelectionInfo


Information about a route selection.

This information is available in callbacks like onRouteSelected for apps to know the reason and the source of the event. For example, you can check if the route was selected by the app (SELECTION_SOURCE_APP) (this includes in-app UI interactions) or via the system output switcher (SELECTION_SOURCE_SYSTEM). Similarly, apps can know if the previous route was unselected because it was disconnected (UNSELECT_REASON_DISCONNECTED) or simply stopped (UNSELECT_REASON_STOPPED).

Summary

Nested types

public final class SelectionInfo.Builder

Builder for SelectionInfo.

Constants

static final int

The route was selected because the application explicitly requested it (for example, by calling selectRoute).

static final int

The route was selected because the provider changed the route (for example, fallback to default route when the active route is disconnected by the provider).

static final int

The route was selected because of a system/platform event (for example, System Output Switcher selection).

static final int

Passed when the reason the route was selected is unknown.

Public methods

int

Returns the source of the route selection.

int

Returns the unselect reason of the previously selected route.

Constants

SELECTION_SOURCE_APP

Added in 1.9.0-alpha02
public static final int SELECTION_SOURCE_APP = 1

The route was selected because the application explicitly requested it (for example, by calling selectRoute).

SELECTION_SOURCE_PROVIDER

Added in 1.9.0-alpha02
public static final int SELECTION_SOURCE_PROVIDER = 3

The route was selected because the provider changed the route (for example, fallback to default route when the active route is disconnected by the provider).

SELECTION_SOURCE_SYSTEM

Added in 1.9.0-alpha02
public static final int SELECTION_SOURCE_SYSTEM = 2

The route was selected because of a system/platform event (for example, System Output Switcher selection).

SELECTION_SOURCE_UNKNOWN

Added in 1.9.0-alpha02
public static final int SELECTION_SOURCE_UNKNOWN = 0

Passed when the reason the route was selected is unknown.

Public methods

getSelectionSource

Added in 1.9.0-alpha02
public int getSelectionSource()

Returns the source of the route selection.

getUnselectReason

Added in 1.9.0-alpha02
public int getUnselectReason()

Returns the unselect reason of the previously selected route.