Register now for Android Dev Summit 2019!

MediaRouteDiscoveryFragment

open class MediaRouteDiscoveryFragment : Fragment
kotlin.Any
   ↳ androidx.fragment.app.Fragment
   ↳ androidx.mediarouter.app.MediaRouteDiscoveryFragment

Media route discovery fragment.

This fragment takes care of registering a callback for media route discovery during the onStart() phase and removing it during the onStop() phase.

The application must supply a route selector to specify the kinds of routes to discover. The application may also override onCreateCallback to provide the MediaRouter callback to register.

Note that the discovery callback makes the application be connected with all the media route provider services while it is registered.

Summary

Public constructors

Public methods

open MediaRouter!

Gets the media router instance.

open MediaRouteSelector!

Gets the media route selector for filtering the routes to be discovered.

open MediaRouter.Callback!

Called to create the callback that will be registered.

open Int

Called to prepare the callback flags that will be used when the callback is registered.

open Unit

open Unit

open Unit

Sets the media route selector for filtering the routes to be discovered.

Inherited functions

Public constructors

<init>

MediaRouteDiscoveryFragment()

Public methods

getMediaRouter

open fun getMediaRouter(): MediaRouter!

Gets the media router instance.

getRouteSelector

open fun getRouteSelector(): MediaRouteSelector!

Gets the media route selector for filtering the routes to be discovered.

Return
MediaRouteSelector!: The selector, never null.

onCreateCallback

open fun onCreateCallback(): MediaRouter.Callback!

Called to create the callback that will be registered.

The default callback does nothing. The application may override this method to supply its own callback.

Return
MediaRouter.Callback!: The new callback, or null if no callback should be registered.

onPrepareCallbackFlags

open fun onPrepareCallbackFlags(): Int

Called to prepare the callback flags that will be used when the callback is registered.

The default implementation returns MediaRouter#CALLBACK_FLAG_REQUEST_DISCOVERY.

Return
Int: The desired callback flags.

onStart

open fun onStart(): Unit

onStop

open fun onStop(): Unit

setRouteSelector

open fun setRouteSelector(selector: MediaRouteSelector!): Unit

Sets the media route selector for filtering the routes to be discovered. This method must be called before the fragment is added.

Parameters
selector MediaRouteSelector!: The selector to set.