Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.

belongs to Maven artifact androidx.media2:media2:1.0.0-alpha03

MediaLibraryService2.MediaLibrarySession

public static final class MediaLibraryService2.MediaLibrarySession
extends MediaSession2

java.lang.Object
   ↳ androidx.media2.MediaSession2
     ↳ androidx.media2.MediaLibraryService2.MediaLibrarySession


Session for the MediaLibraryService2. Build this object with MediaLibraryService2.MediaLibrarySession.Builder and return in MediaLibraryService2.onCreateSession(String).

Summary

Nested classes

class MediaLibraryService2.MediaLibrarySession.Builder

Builder for MediaLibraryService2.MediaLibrarySession

class MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback

Callback for the MediaLibraryService2.MediaLibrarySession

Inherited constants

Public methods

void notifyChildrenChanged(String parentId, int itemCount, Bundle extras)

Notify all controllers that subscribed to the parent about change in the parent's children, regardless of the extra bundle supplied by MediaBrowser2.subscribe(String, Bundle).

void notifyChildrenChanged(MediaSession2.ControllerInfo controller, String parentId, int itemCount, Bundle extras)

Notify the controller of the change in a parent's children.

void notifySearchResultChanged(MediaSession2.ControllerInfo controller, String query, int itemCount, Bundle extras)

Notify controller about change in the search result.

Inherited methods

Public methods

notifyChildrenChanged

public void notifyChildrenChanged (String parentId, 
                int itemCount, 
                Bundle extras)

Notify all controllers that subscribed to the parent about change in the parent's children, regardless of the extra bundle supplied by MediaBrowser2.subscribe(String, Bundle).

Parameters
parentId String: parent id

itemCount int: number of children

extras Bundle: extra information from session to controller

notifyChildrenChanged

public void notifyChildrenChanged (MediaSession2.ControllerInfo controller, 
                String parentId, 
                int itemCount, 
                Bundle extras)

Notify the controller of the change in a parent's children.

If the controller hasn't subscribed to the parent, the API will do nothing.

Controllers will use MediaBrowser2.getChildren(String, int, int, Bundle) to get the list of children.

Parameters
controller MediaSession2.ControllerInfo: controller to notify

parentId String: parent id with changes in its children

itemCount int: number of children.

extras Bundle: extra information from session to controller

notifySearchResultChanged

public void notifySearchResultChanged (MediaSession2.ControllerInfo controller, 
                String query, 
                int itemCount, 
                Bundle extras)

Notify controller about change in the search result.

Parameters
controller MediaSession2.ControllerInfo: controller to notify

query String: previously sent search query from the controller.

itemCount int: the number of items that have been found in the search.

extras Bundle: extra bundle