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 Unit

open MediaRouter!

Gets the media router instance.

open Int

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

open MediaRouteSelector!

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

open Unit

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

open MediaRouter.Callback!

Called to create the callback that will be registered.

open Unit

Inherited functions

Public constructors

<init>

MediaRouteDiscoveryFragment()

Public methods

onStart

open fun onStart(): Unit

getMediaRouter

open fun getMediaRouter(): MediaRouter!

Gets the media router instance.

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.

getRouteSelector

open fun getRouteSelector(): MediaRouteSelector!

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

Return
MediaRouteSelector!: The selector, never null.

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.

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.

onStop

open fun onStop(): Unit