# MediaPlaybackManager

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/media/MediaPlaybackManager.java+class:androidx.car.app.media.MediaPlaybackManager) Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.4.0)

*** ** * ** ***


```
@RequiresCarApi(value = 8)
public class MediaPlaybackManager implements Manager
```

<br />

*** ** * ** ***

Manager for communicating Media Session Token the host.

Apps must use this interface to coordinate with the car system to allow media playback.

## Summary

| ### Public methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/car/app/media/MediaPlaybackManager#registerMediaPlaybackToken(android.support.v4.media.session.MediaSessionCompat.Token)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token token)` Sends a media session token to the host in order to allow the host to read the media session playback state. |

## Public methods

### registerMediaPlaybackToken

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.4.0)

```
@MainThread
public void registerMediaPlaybackToken(@NonNull MediaSessionCompat.Token token)
```

Sends a media session token to the host in order to allow the host to read the media session playback state.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/support/v4/media/session/MediaSessionCompat.Token token` | to be sent to the host |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if any of the token cannot be serialized |
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if this is not called from the main thread. |