public final class

MediaLibraryService.MediaLibrarySession.Builder

extends androidx.media2.MediaSession.BuilderBase<MediaLibraryService.MediaLibrarySession, MediaLibraryService.MediaLibrarySession.Builder, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback>

 java.lang.Object

↳androidx.media2.MediaSession.BuilderBase<MediaLibraryService.MediaLibrarySession, MediaLibraryService.MediaLibrarySession.Builder, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback>

↳androidx.media2.MediaLibraryService.MediaLibrarySession.Builder

Overview

Builder for MediaLibraryService.MediaLibrarySession.

Summary

Constructors
publicBuilder(MediaLibraryService service, SessionPlayer player, java.util.concurrent.Executor callbackExecutor, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback callback)

Methods
abstract MediaSessionbuild()

Build MediaSession.

androidx.media2.MediaSession.BuilderBase<T, U, C>setId(java.lang.String id)

Set ID of the session.

androidx.media2.MediaSession.BuilderBase<T, U, C>setSessionActivity(PendingIntent pi)

Set an intent for launching UI for this Session.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(MediaLibraryService service, SessionPlayer player, java.util.concurrent.Executor callbackExecutor, MediaLibraryService.MediaLibrarySession.MediaLibrarySessionCallback callback)

Methods

androidx.media2.MediaSession.BuilderBase<T, U, C> setSessionActivity(PendingIntent pi)

Set an intent for launching UI for this Session. This can be used as a quick link to an ongoing media screen. The intent should be for an activity that may be started using .

Parameters:

pi: The intent to launch to show UI for this session.

androidx.media2.MediaSession.BuilderBase<T, U, C> setId(java.lang.String id)

Set ID of the session. If it's not set, an empty string with used to create a session.

Use this if and only if your app supports multiple playback at the same time and also wants to provide external apps to have finer controls of them.

Parameters:

id: id of the session. Must be unique per package.

Returns:

abstract MediaSession build()

Build MediaSession.

Returns:

a new session