added in version 24.1.0
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1

MediaBrowserCompat

public final class MediaBrowserCompat
extends Object

java.lang.Object
   ↳ android.support.v4.media.MediaBrowserCompat


Browses media content offered by a MediaBrowserServiceCompat.

This object is not thread-safe. All calls should happen on the thread on which the browser was constructed.

All callback methods will be called from the thread on which the browser was constructed.

Developer Guides

For information about building your media application, read the Media Apps developer guide.

Summary

Nested classes

class MediaBrowserCompat.ConnectionCallback

Callbacks for connection related events. 

class MediaBrowserCompat.CustomActionCallback

Callback for receiving the result of sendCustomAction(String, Bundle, MediaBrowserCompat.CustomActionCallback)

class MediaBrowserCompat.ItemCallback

Callback for receiving the result of getItem(String, MediaBrowserCompat.ItemCallback)

class MediaBrowserCompat.MediaItem

A class with information on a single media item for use in browsing/searching media. 

class MediaBrowserCompat.SearchCallback

Callback for receiving the result of search(String, Bundle, MediaBrowserCompat.SearchCallback)

class MediaBrowserCompat.SubscriptionCallback

Callbacks for subscription related events. 

Constants

String CUSTOM_ACTION_DOWNLOAD

Predefined custom action to ask the connected service to download a specific MediaBrowserCompat.MediaItem for offline playback.

String CUSTOM_ACTION_REMOVE_DOWNLOADED_FILE

Predefined custom action to ask the connected service to remove the downloaded file of MediaBrowserCompat.MediaItem by the download action.

String EXTRA_DOWNLOAD_PROGRESS

Used as a float extra field to denote the current progress during download.

String EXTRA_MEDIA_ID

Used as a string extra field to denote the target MediaBrowserCompat.MediaItem.

String EXTRA_PAGE

Used as an int extra field to denote the page number to subscribe.

String EXTRA_PAGE_SIZE

Used as an int extra field to denote the number of media items in a page.

Public constructors

MediaBrowserCompat(Context context, ComponentName serviceComponent, MediaBrowserCompat.ConnectionCallback callback, Bundle rootHints)

Creates a media browser for the specified media browse service.

Public methods

void connect()

Connects to the media browse service.

void disconnect()

Disconnects from the media browse service.

Bundle getExtras()

Gets any extras for the media service.

void getItem(String mediaId, MediaBrowserCompat.ItemCallback cb)

Retrieves a specific MediaBrowserCompat.MediaItem from the connected service.

String getRoot()

Gets the root id.