Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Callback

abstract class Callback
kotlin.Any
   ↳ androidx.mediarouter.media.MediaRouter.Callback

Interface for receiving events about media routing changes. All methods of this interface will be called from the application's main thread.

A Callback will only receive events relevant to routes that the callback was registered for unless the MediaRouter#CALLBACK_FLAG_UNFILTERED_EVENTS flag was specified in MediaRouter#addCallback(MediaRouteSelector, Callback, int).

Summary

Public constructors

Interface for receiving events about media routing changes.

Public methods

open Unit

Called when a media route provider has been added.

open Unit

Called when a property of the indicated media route provider has changed.

open Unit

Called when a media route provider has been removed.

open Unit

Called when a media route has been added.

open Unit

Called when a property of the indicated media route has changed.

open Unit

Called when a media route's presentation display changes.

open Unit

Called when a media route has been removed.

open Unit

Called when the supplied media route becomes selected as the active route.

open Unit

Called when the supplied media route becomes unselected as the active route.

open Unit

Called when the supplied media route becomes unselected as the active route.

open Unit

Called when a media route's volume changes.

Public constructors

<init>

Callback()

Interface for receiving events about media routing changes. All methods of this interface will be called from the application's main thread.

A Callback will only receive events relevant to routes that the callback was registered for unless the MediaRouter#CALLBACK_FLAG_UNFILTERED_EVENTS flag was specified in MediaRouter#addCallback(MediaRouteSelector, Callback, int).

Public methods

onProviderAdded

open fun onProviderAdded(router: MediaRouter!, provider: MediaRouter.ProviderInfo!): Unit

Called when a media route provider has been added.

Parameters
router MediaRouter!: The media router reporting the event.
provider MediaRouter!: The provider that has become available for use.

onProviderChanged

open fun onProviderChanged(router: MediaRouter!, provider: MediaRouter.ProviderInfo!): Unit

Called when a property of the indicated media route provider has changed.

Parameters
router MediaRouter!: The media router reporting the event.
provider MediaRouter!: The provider that was changed.

onProviderRemoved

open fun onProviderRemoved(router: MediaRouter!, provider: MediaRouter.ProviderInfo!): Unit

Called when a media route provider has been removed.

Parameters
router MediaRouter!: The media router reporting the event.
provider MediaRouter!: The provider that has been removed from availability.

onRouteAdded

open fun onRouteAdded(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when a media route has been added.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that has become available for use.

onRouteChanged

open fun onRouteChanged(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when a property of the indicated media route has changed.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that was changed.

onRoutePresentationDisplayChanged

open fun onRoutePresentationDisplayChanged(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when a media route's presentation display changes.

This method is called whenever the route's presentation display becomes available, is removed or has changes to some of its properties (such as its size).

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route whose presentation display changed.

onRouteRemoved

open fun onRouteRemoved(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when a media route has been removed.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that has been removed from availability.

onRouteSelected

open fun onRouteSelected(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when the supplied media route becomes selected as the active route.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that has been selected.

onRouteUnselected

open fun onRouteUnselected(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when the supplied media route becomes unselected as the active route. For detailed reason, override onRouteUnselected(MediaRouter, RouteInfo, int) instead.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that has been unselected.

onRouteUnselected

open fun onRouteUnselected(router: MediaRouter!, route: MediaRouter.RouteInfo!, reason: Int): Unit

Called when the supplied media route becomes unselected as the active route. The default implementation calls onRouteUnselected.

The reason provided will be one of the following:

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route that has been unselected.
reason MediaRouter!: The reason for unselecting the route.

onRouteVolumeChanged

open fun onRouteVolumeChanged(router: MediaRouter!, route: MediaRouter.RouteInfo!): Unit

Called when a media route's volume changes.

Parameters
router MediaRouter!: The media router reporting the event.
route MediaRouter!: The route whose volume changed.