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

MediaBrowserServiceCompat

public abstract class MediaBrowserServiceCompat
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.support.v4.media.MediaBrowserServiceCompat


Base class for media browse services.

Media browse services enable applications to browse media content provided by an application and ask the application to start playing it. They may also be used to control content that is already playing by way of a MediaSessionCompat.

To extend this class, you must declare the service in your manifest file with an intent filter with the SERVICE_INTERFACE action. For example:

 <service android:name=".MyMediaBrowserServiceCompat"
          android:label="@string/service_name" >
     <intent-filter>
         <action android:name="android.media.browse.MediaBrowserService" />
     </intent-filter>
 </service>
 

Developer Guides

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

Summary

Nested classes

class MediaBrowserServiceCompat.BrowserRoot

Contains information that the browser service needs to send to the client when first connected. 

class MediaBrowserServiceCompat.Result<T>

Completion handler for asynchronous callback methods in MediaBrowserServiceCompat

Constants

String SERVICE_INTERFACE

The Intent that must be declared as handled by the service.

Inherited constants

From class android.app.Service
From class android.content.Context
From interface android.content.ComponentCallbacks2

Public constructors

MediaBrowserServiceCompat()

Public methods

void dump(FileDescriptor fd, PrintWriter writer, String[] args)
final Bundle getBrowserRootHints()

Gets the root hints sent from the currently connected MediaBrowserCompat.

MediaSessionCompat.Token getSessionToken()

Gets the session token, or null if it has not yet been created or if it has been destroyed.

void notifyChildrenChanged(String parentId)

Notifies all connected media browsers that the children of the specified parent id have changed in some way.

void notifyChildrenChanged(String parentId, Bundle options)

Notifies all connected media browsers that the children of the specified parent id have changed in some way.

IBinder onBind(Intent intent)
void onCreate()
void onCustomAction(String action, Bundle extras, Result<Bundle> result)

Called to request a custom action to this service.

abstract MediaBrowserServiceCompat.BrowserRoot onGetRoot(String clientPackageName, int clientUid, Bundle rootHints)

Called to get the root information for browsing by a particular client.

abstract void onLoadChildren(String parentId, Result<List<MediaBrowserCompat.MediaItem>> result)

Called to get information about the children of a media item.

void onLoadChildren(String parentId, Result<List<MediaBrowserCompat.MediaItem>> result, Bundle options)

Called to get information about the children of a media item.

void onLoadItem(String itemId, Result<MediaBrowserCompat.MediaItem> result)

Called to get information about a specific media item.

void onSearch(String query, Bundle extras, Result<List<MediaBrowserCompat.MediaItem>> result)

Called to get the search result.

void setSessionToken(MediaSessionCompat.Token token)

Call to set the media session.

Inherited methods

From class android.app.Service