MediaLibraryService
public
abstract
class
MediaLibraryService
extends MediaSessionService
| java.lang.Object | |||||
| ↳ | android.content.Context | ||||
| ↳ | android.content.ContextWrapper | ||||
| ↳ | android.app.Service | ||||
| ↳ | androidx.media2.MediaSessionService | ||||
| ↳ | androidx.media2.MediaLibraryService | ||||
Base class for media library services, which is the service containing
MediaLibraryService.MediaLibrarySession.
Media library 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 MediaSession.
When extending this class, also add the following to your AndroidManifest.xml.
<service android:name="component_name_of_your_implementation" >
<intent-filter>
<action android:name="androidx.media2.MediaLibraryService" />
</intent-filter>
</service>
You may also declare
android.media.browse.MediaBrowserServicefor compatibility with
MediaBrowserCompat. This service can handle it automatically.
See also:
Summary
Nested classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
class |
MediaLibraryService.LibraryParams
Contains information that the library service needs to send to the client. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
class |
MediaLibraryService.LibraryResult
Result class to be used with |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
class |
MediaLibraryService.MediaLibrarySession
Session for the |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constants | |
|---|---|
String |
SERVICE_INTERFACE
The |
Inherited constants | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
androidx.media2.MediaSessionService
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
android.app.Service
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
android.content.Context
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From interface
android.content.ComponentCallbacks2
|
Public constructors | |
|---|---|
MediaLibraryService()
|
|
Public methods | |
|---|---|
IBinder
|
onBind(Intent intent)
Default implementation for |
abstract
MediaLibraryService.MediaLibrarySession
|
onGetSession()
Called when another app has requested to get |
Inherited methods | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
androidx.media2.MediaSessionService
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
android.app.Service
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
android.content.ContextWrapper
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
android.content.Context
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From class
java.lang.Object
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From interface
android.content.ComponentCallbacks2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
From interface
android.content.ComponentCallbacks
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constants
SERVICE_INTERFACE
public static final String SERVICE_INTERFACE
The Intent that must be declared as handled by the service.
Constant Value: "androidx.media2.MediaLibraryService"
Public constructors
MediaLibraryService
public MediaLibraryService ()
Public methods
onBind
public IBinder onBind (Intent intent)
Default implementation for MediaSessionService to handle incoming binding
request. If the request is for getting the session, the intent will have action
SERVICE_INTERFACE.
Override this method if this service also needs to handle binder requests other than
SERVICE_INTERFACE. Derived classes MUST call through to the super class's
implementation of this method.
| Returns | |
|---|---|
IBinder |
Binder |
onGetSession
public abstract MediaLibraryService.MediaLibrarySession onGetSession ()
Called when another app has requested to get MediaLibraryService.MediaLibrarySession.
Session returned here will be added to this service automatically. You don't need to call
MediaSessionService.addSession(MediaSession) for that.
This method will be called on the main thread.
| Returns | |
|---|---|
MediaLibraryService.MediaLibrarySession |
a new library session |
Interfaces
Classes
- CallbackMediaItem
- CallbackMediaItem.Builder
- DataSourceCallback
- FileMediaItem
- FileMediaItem.Builder
- HeartRating
- MediaBrowser
- MediaBrowser.BrowserCallback
- MediaBrowser.BrowserResult
- MediaController
- MediaController.ControllerCallback
- MediaController.ControllerResult
- MediaController.PlaybackInfo
- MediaItem
- MediaItem.Builder
- MediaLibraryService
- MediaLibraryService.LibraryParams
- MediaLibraryService.LibraryParams.Builder
- MediaLibraryService.LibraryResult
- MediaLibraryService.MediaLibrarySession
- MediaLibraryService.MediaLibrarySession.Builder
- MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback
- MediaMetadata
- MediaMetadata.Builder
- MediaPlayer
- MediaPlayer.PlayerCallback
- MediaPlayer.TrackInfo
- MediaSession
- MediaSession.Builder
- MediaSession.CommandButton
- MediaSession.CommandButton.Builder
- MediaSession.ControllerInfo
- MediaSession.SessionCallback
- MediaSession.SessionResult
- MediaSessionManager
- MediaSessionService
- MediaSessionService.MediaNotification
- MediaTimestamp
- PercentageRating
- PlaybackParams
- PlaybackParams.Builder
- SessionCommand
- SessionCommandGroup
- SessionCommandGroup.Builder
- SessionPlayer
- SessionPlayer.PlayerCallback
- SessionPlayer.PlayerResult
- SessionToken
- StarRating
- SubtitleData
- ThumbRating
- TimedMetaData
- UriMediaItem
- UriMediaItem.Builder
- VideoSize
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.