MediaSessionManager

class MediaSessionManager


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

Summary

Nested types

Information of a remote user of MediaSessionCompat or MediaBrowserServiceCompat.

Public functions

java-static MediaSessionManager

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

Boolean

Checks whether the remote user is a trusted app.

Public functions

getSessionManager

Added in 1.1.0
java-static fun getSessionManager(context: Context): MediaSessionManager

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

Returns
MediaSessionManager

The MediaSessionManager instance for this context.

isTrustedForMediaControl

Added in 1.1.0
fun isTrustedForMediaControl(userInfo: MediaSessionManager.RemoteUserInfo): Boolean

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 getCurrentControllerInfo and getCurrentBrowserInfo.

Returns
Boolean

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