MediaSessionManager

Added in 1.0.0
Deprecated in 1.3.0

class MediaSessionManager


Provides support for interacting with media sessions that applications have published in order to express their ongoing media playback state.

Summary

Public functions

java-static MediaSessionManager
getInstance(context: Context)

Gets an instance of MediaSessionManager associated with the context.

(Mutable)Set<SessionToken!>

Gets Set of SessionToken for MediaSessionService regardless of their activeness.

Public functions

getInstance

Added in 1.0.0
Deprecated in 1.3.0
java-static fun getInstance(context: Context): MediaSessionManager

Gets an instance of MediaSessionManager associated with the context.

Returns
MediaSessionManager

the MediaSessionManager instance for this context

getSessionServiceTokens

Added in 1.0.0
Deprecated in 1.3.0
fun getSessionServiceTokens(): (Mutable)Set<SessionToken!>

Gets Set of SessionToken for MediaSessionService regardless of their activeness. This list represents media apps that support background playback.

The app targeting API level 30 or higher must include a <queries> element in their manifest to get service tokens of other apps. See the following example and this guide for more information.

<intent>
  <action android:name="androidx.media2.session.MediaSessionService" />
</intent>
<intent>
  <action android:name="androidx.media2.session.MediaLibraryService" />
</intent>
<intent>
  <action android:name="android.media.browse.MediaBrowserService" />
</intent>
Returns
(Mutable)Set<SessionToken!>

set of tokens