# MediaSessionManager

Artifact: [androidx.media:media](https://developer.android.com/jetpack/androidx/releases/media) [View Source](https://cs.android.com/search?q=file:androidx/media/MediaSessionManager.java+class:androidx.media.MediaSessionManager) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

*** ** * ** ***


```
public final class MediaSessionManager
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> androidx.media is deprecated. Please migrate to [androidx.media3](https://developer.android.com/media/media3).

Provides support for interacting with `https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat` that applications have published to express their ongoing media playback state.

| See also |
|---|---|
| `https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat` |   |
| `https://developer.android.com/reference/android/support/v4/media/session/MediaControllerCompat` |   |

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/media/MediaSessionManager.RemoteUserInfo` **This class is deprecated.** androidx.media is deprecated. <br /> |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/media/MediaSessionManager` | `[getSessionManager](https://developer.android.com/reference/androidx/media/MediaSessionManager#getSessionManager(android.content.Context))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` **This method is deprecated.** Deprecated in Java |
| `boolean` | `[isTrustedForMediaControl](https://developer.android.com/reference/androidx/media/MediaSessionManager#isTrustedForMediaControl(androidx.media.MediaSessionManager.RemoteUserInfo))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/media/MediaSessionManager.RemoteUserInfo userInfo )` **This method is deprecated.** Deprecated in Java |

## Public methods

### getSessionManager

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public static @NonNull MediaSessionManager [getSessionManager](https://developer.android.com/reference/androidx/media/MediaSessionManager#getSessionManager(android.content.Context))(@NonNull Context context)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/media/MediaSessionManager` | The MediaSessionManager instance for this context. |

### isTrustedForMediaControl

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/media#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/media#1.8.0)

```
public boolean [isTrustedForMediaControl](https://developer.android.com/reference/androidx/media/MediaSessionManager#isTrustedForMediaControl(androidx.media.MediaSessionManager.RemoteUserInfo))(
    @NonNull MediaSessionManager.RemoteUserInfo userInfo
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/media/MediaSessionManager.RemoteUserInfo userInfo` | The remote user info from either `https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat#getCurrentControllerInfo()` and `https://developer.android.com/reference/androidx/media/MediaBrowserServiceCompat#getCurrentBrowserInfo()`. |

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