belongs to Maven artifact androidx.media:media:1.0.0-alpha1

MediaSessionManager

public final class MediaSessionManager
extends Object

java.lang.Object
   ↳ androidx.media.MediaSessionManager


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

Summary

Nested classes

class MediaSessionManager.RemoteUserInfo

Information of a remote user of MediaSessionCompat or MediaBrowserServiceCompat

Public methods

static MediaSessionManager getSessionManager(Context context)

Gets an instance of the media session manager associated with the context.

boolean isTrustedForMediaControl(MediaSessionManager.RemoteUserInfo userInfo)

Checks whether the remote user is a trusted app.

Inherited methods

Public methods

getSessionManager

MediaSessionManager getSessionManager (Context context)

Gets an instance of the media session manager associated with the context.

Parameters
context Context

Returns
MediaSessionManager The MediaSessionManager instance for this context.

isTrustedForMediaControl

boolean isTrustedForMediaControl (MediaSessionManager.RemoteUserInfo userInfo)

Checks whether the remote user is a trusted app.

An app is trusted if the app holds the android.Manifest.permission.MEDIA_CONTENT_CONTROL permission or has an enabled notification listener.

Parameters
userInfo MediaSessionManager.RemoteUserInfo: The remote user info from either MediaSessionCompat.getCurrentControllerInfo() and MediaBrowserServiceCompat.getCurrentBrowserInfo().

Returns
boolean true if the remote user is trusted and its package name matches with the UID. false otherwise.