Added in API level 30

RouteCallback

abstract class RouteCallback
kotlin.Any
   ↳ android.media.MediaRouter2.RouteCallback

Callback for receiving events about media route discovery.

Summary

Public constructors

Public methods
open Unit

Called when routes are added.

open Unit

Called when the properties of one or more existing routes are changed.

open Unit

Called when routes are removed.

open Unit

Called when the route list is updated, which can happen when routes are added, removed, or modified.

Public constructors

RouteCallback

RouteCallback()

Public methods

onRoutesAdded

Added in API level 30
Deprecated in API level 34
open fun onRoutesAdded(routes: MutableList<MediaRoute2Info!>): Unit

Deprecated: Use onRoutesUpdated(java.util.List) instead.

Called when routes are added. Whenever you register a callback, this will be invoked with known routes.

Parameters
routes MutableList<MediaRoute2Info!>: the list of routes that have been added. It's never empty. This value cannot be null.

onRoutesChanged

Added in API level 30
Deprecated in API level 34
open fun onRoutesChanged(routes: MutableList<MediaRoute2Info!>): Unit

Deprecated: Use onRoutesUpdated(java.util.List) instead.

Called when the properties of one or more existing routes are changed. For example, it is called when a route's name or volume have changed.

Parameters
routes MutableList<MediaRoute2Info!>: the list of routes that have been changed. It's never empty. This value cannot be null.

onRoutesRemoved

Added in API level 30
Deprecated in API level 34
open fun onRoutesRemoved(routes: MutableList<MediaRoute2Info!>): Unit

Deprecated: Use onRoutesUpdated(java.util.List) instead.

Called when routes are removed.

Parameters
routes MutableList<MediaRoute2Info!>: the list of routes that have been removed. It's never empty. This value cannot be null.

onRoutesUpdated

Added in API level 34
open fun onRoutesUpdated(routes: MutableList<MediaRoute2Info!>): Unit

Called when the route list is updated, which can happen when routes are added, removed, or modified. It will also be called when a route callback is registered.

Parameters
routes MutableList<MediaRoute2Info!>: the updated list of routes filtered by the callback's individual discovery preferences. This value cannot be null.