Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!

MediaLibraryService2.LibraryRoot

public static final class MediaLibraryService2.LibraryRoot
extends Object

java.lang.Object
   ↳ androidx.media2.MediaLibraryService2.LibraryRoot


Contains information that the library service needs to send to the client when MediaBrowser2.getLibraryRoot(Bundle) is called.

Summary

Constants

String EXTRA_OFFLINE

The lookup key for a boolean that indicates whether the library service should return a library root for offline media items.

String EXTRA_RECENT

The lookup key for a boolean that indicates whether the library service should return a librar root for recently played media items.

String EXTRA_SUGGESTED

The lookup key for a boolean that indicates whether the library service should return a library root for suggested media items.

Public constructors

MediaLibraryService2.LibraryRoot(String rootId, Bundle extras)

Constructs a library root.

Public methods

Bundle getExtras()

Gets any extras about the library service.

String getRootId()

Gets the root id for browsing.

Inherited methods

Constants

EXTRA_OFFLINE

public static final String EXTRA_OFFLINE

The lookup key for a boolean that indicates whether the library service should return a library root for offline media items.

When creating a media browser for a given media library service, this key can be supplied as a root hint for retrieving media items that are can be played without an internet connection. If the media library service can provide such media items, the implementation must return the key in the root hint when MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback.onGetLibraryRoot(MediaLibraryService2.MediaLibrarySession, MediaSession2.ControllerInfo, Bundle) is called back.

The root hint may contain multiple keys.

Constant Value: "android.media.extra.OFFLINE"

EXTRA_RECENT

public static final String EXTRA_RECENT

The lookup key for a boolean that indicates whether the library service should return a librar root for recently played media items.

When creating a media browser for a given media library service, this key can be supplied as a root hint for retrieving media items that are recently played. If the media library service can provide such media items, the implementation must return the key in the root hint when MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback.onGetLibraryRoot(MediaLibraryService2.MediaLibrarySession, MediaSession2.ControllerInfo, Bundle) is called back.

The root hint may contain multiple keys.

Constant Value: "android.media.extra.RECENT"

EXTRA_SUGGESTED

public static final String EXTRA_SUGGESTED

The lookup key for a boolean that indicates whether the library service should return a library root for suggested media items.

When creating a media browser for a given media library service, this key can be supplied as a root hint for retrieving the media items suggested by the media library service. The list of media items is considered ordered by relevance, first being the top suggestion. If the media library service can provide such media items, the implementation must return the key in the root hint when MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback.onGetLibraryRoot(MediaLibraryService2.MediaLibrarySession, MediaSession2.ControllerInfo, Bundle) is called back.

The root hint may contain multiple keys.

Constant Value: "android.media.extra.SUGGESTED"

Public constructors

MediaLibraryService2.LibraryRoot

public MediaLibraryService2.LibraryRoot (String rootId, 
                Bundle extras)

Constructs a library root.

Parameters
rootId String: The root id for browsing.

extras Bundle: Any extras about the library service.

Public methods

getExtras

public Bundle getExtras ()

Gets any extras about the library service.

Returns
Bundle

getRootId

public String getRootId ()

Gets the root id for browsing.

Returns
String