Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Builder

class Builder : BuilderBase<MediaSession2!, MediaSession2.Builder!, MediaSession2.SessionCallback!>
androidx.media2.MediaSession2.Builder

Builder for MediaSession2.

Any incoming event from the MediaController2 will be handled on the thread that created session with the Builder#build().

Summary

Public constructors
<init>(context: Context!)

Public methods
MediaSession2.Builder
setId(@NonNull id: String)

MediaSession2.Builder
setPlaylistAgent(@NonNull playlistAgent: MediaPlaylistAgent)

MediaSession2.Builder
setPlayer(@NonNull player: MediaPlayerConnector)

MediaSession2.Builder

MediaSession2.Builder
setSessionCallback(@NonNull executor: Executor, @NonNull callback: MediaSession2.SessionCallback)

MediaSession2

Public constructors

<init>

Builder(context: Context!)

Public methods

setId

@NonNull fun setId(@NonNull id: String): MediaSession2.Builder

setPlaylistAgent

@NonNull fun setPlaylistAgent(@NonNull playlistAgent: MediaPlaylistAgent): MediaSession2.Builder

setPlayer

@NonNull fun setPlayer(@NonNull player: MediaPlayerConnector): MediaSession2.Builder

setSessionActivity

@NonNull fun setSessionActivity(@Nullable pi: PendingIntent?): MediaSession2.Builder

setSessionCallback

@NonNull fun setSessionCallback(@NonNull executor: Executor, @NonNull callback: MediaSession2.SessionCallback): MediaSession2.Builder

build

@NonNull fun build(): MediaSession2