Android APIs
public final class

MediaRouteDescriptor

extends Object
java.lang.Object
   ↳ android.support.v7.media.MediaRouteDescriptor

Class Overview

Describes the properties of a route.

Each route is uniquely identified by an opaque id string. This token may take any form as long as it is unique within the media route provider.

This object is immutable once created using a MediaRouteDescriptor.Builder instance.

Summary

Nested Classes
class MediaRouteDescriptor.Builder Builder for media route descriptors
Public Methods
Bundle asBundle()
Converts this object to a bundle for serialization.
boolean canDisconnectAndKeepPlaying()
Gets whether the route can be disconnected without stopping playback.
static MediaRouteDescriptor fromBundle(Bundle bundle)
Creates an instance from a bundle.
List<IntentFilter> getControlFilters()
Gets the route's media control intent filters.
String getDescription()
Gets the user-visible description of the route.
Bundle getExtras()
Gets a bundle of extras for this route descriptor.
String getId()
Gets the unique id of the route.
String getName()
Gets the user-visible name of the route.
int getPlaybackStream()
Gets the route's playback stream.
int getPlaybackType()
Gets the route's playback type.
int getPresentationDisplayId()
Gets the route's presentation display id, or -1 if none.
IntentSender getSettingsActivity()
Gets an IntentSender for starting a settings activity for this route.
int getVolume()
Gets the route's current volume, or 0 if unknown.
int getVolumeHandling()
Gets the route's volume handling.
int getVolumeMax()
Gets the route's maximum volume, or 0 if unknown.
boolean isConnecting()
Gets whether the route is connecting.
boolean isEnabled()
Gets whether the route is enabled.
boolean isValid()
Returns true if the route descriptor has all of the required fields.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public Bundle asBundle ()

Converts this object to a bundle for serialization.

Returns
  • The contents of the object represented as a bundle.

public boolean canDisconnectAndKeepPlaying ()

Gets whether the route can be disconnected without stopping playback. To specify that the route should disconnect without stopping use unselect(int) with UNSELECT_REASON_DISCONNECTED.

public static MediaRouteDescriptor fromBundle (Bundle bundle)

Creates an instance from a bundle.

Parameters
bundle The bundle, or null if none.
Returns
  • The new instance, or null if the bundle was null.

public List<IntentFilter> getControlFilters ()

Gets the route's media control intent filters.

public String getDescription ()

Gets the user-visible description of the route.

The route description describes the kind of destination represented by the route. It may be a user-supplied string, a model number or brand of device.

public Bundle getExtras ()

Gets a bundle of extras for this route descriptor. The extras will be ignored by the media router but they may be used by applications.

public String getId ()

Gets the unique id of the route.

The route id associated with a route descriptor functions as a stable identifier for the route and must be unique among all routes offered by the provider.

public String getName ()

Gets the user-visible name of the route.

The route name identifies the destination represented by the route. It may be a user-supplied name, an alias, or device serial number.

public int getPlaybackStream ()

Gets the route's playback stream.

public int getPlaybackType ()

Gets the route's playback type.

public int getPresentationDisplayId ()

Gets the route's presentation display id, or -1 if none.

public IntentSender getSettingsActivity ()

Gets an IntentSender for starting a settings activity for this route. The activity may have specific route settings or general settings for the connected device or route provider.

Returns

public int getVolume ()

Gets the route's current volume, or 0 if unknown.

public int getVolumeHandling ()

Gets the route's volume handling.

public int getVolumeMax ()

Gets the route's maximum volume, or 0 if unknown.

public boolean isConnecting ()

Gets whether the route is connecting.

public boolean isEnabled ()

Gets whether the route is enabled.

public boolean isValid ()

Returns true if the route descriptor has all of the required fields.

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.