# MediaController.Callback

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/media/session/MediaController.Callback#pubctors)\|[Methods](https://developer.android.com/reference/android/media/session/MediaController.Callback#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/media/session/MediaController.Callback#inhmethods)  

# MediaController.Callback

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/media/session/MediaController.Callback "View this page in Kotlin")\|Java

`
public
static

abstract
class
MediaController.Callback
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.session.MediaController.Callback |

<br />

*** ** * ** ***

Callback for receiving updates from the session. A Callback can be registered using[MediaController.registerCallback(Callback)](https://developer.android.com/reference/android/media/session/MediaController#registerCallback(android.media.session.MediaController.Callback)).

## Summary

|                                                 ### Public constructors                                                  ||
|-----------------------------------------------------------------------------------------------------------------------|---|
| ` `[Callback](https://developer.android.com/reference/android/media/session/MediaController.Callback#Callback())`() ` |

|                                                                                                                                                                                                                                     ### Public methods                                                                                                                                                                                                                                     ||
|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onAudioInfoChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onAudioInfoChanged(android.media.session.MediaController.PlaybackInfo))`(`[MediaController.PlaybackInfo](https://developer.android.com/reference/android/media/session/MediaController.PlaybackInfo)` playbackInfo) ` Signals a change in the session's[PlaybackInfo](https://developer.android.com/reference/android/media/session/MediaController.PlaybackInfo). |
| ` void` | ` `[onExtrasChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onExtrasChanged(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle)` extras) ` Override to handle changes to the[MediaSession](https://developer.android.com/reference/android/media/session/MediaSession)extras.                                                                                                               |
| ` void` | ` `[onMetadataChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onMetadataChanged(android.media.MediaMetadata))`(`[MediaMetadata](https://developer.android.com/reference/android/media/MediaMetadata)` metadata) ` Override to handle changes to the current metadata.                                                                                                                                                             |
| ` void` | ` `[onPlaybackStateChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onPlaybackStateChanged(android.media.session.PlaybackState))`(`[PlaybackState](https://developer.android.com/reference/android/media/session/PlaybackState)` state) ` Override to handle changes in playback state.                                                                                                                                            |
| ` void` | ` `[onQueueChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onQueueChanged(java.util.List<android.media.session.MediaSession.QueueItem>))`(`[List](https://developer.android.com/reference/java/util/List)`<`[MediaSession.QueueItem](https://developer.android.com/reference/android/media/session/MediaSession.QueueItem)`> queue) ` Override to handle changes to items in the queue.                                           |
| ` void` | ` `[onQueueTitleChanged](https://developer.android.com/reference/android/media/session/MediaController.Callback#onQueueTitleChanged(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` title) ` Override to handle changes to the queue title.                                                                                                                                                                            |
| ` void` | ` `[onSessionDestroyed](https://developer.android.com/reference/android/media/session/MediaController.Callback#onSessionDestroyed())`() ` Override to handle the session being destroyed.                                                                                                                                                                                                                                                                                         |
| ` void` | ` `[onSessionEvent](https://developer.android.com/reference/android/media/session/MediaController.Callback#onSessionEvent(java.lang.String,%20android.os.Bundle))`(`[String](https://developer.android.com/reference/java/lang/String)` event, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` extras) ` Override to handle custom events sent by the session owner without a specified interface.                                                          |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Callback

```
public Callback ()
```

<br />

<br />

## Public methods

### onAudioInfoChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onAudioInfoChanged (MediaController.PlaybackInfo playbackInfo)
```

Signals a change in the session's[PlaybackInfo](https://developer.android.com/reference/android/media/session/MediaController.PlaybackInfo).

<br />

|                                                                Parameters                                                                 ||
|----------------|---------------------------------------------------------------------------------------------------------------------------|
| `playbackInfo` | `MediaController.PlaybackInfo`: The latest known state of the session's playback info. This value cannot be`null`. <br /> |

### onExtrasChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onExtrasChanged (Bundle extras)
```

Override to handle changes to the[MediaSession](https://developer.android.com/reference/android/media/session/MediaSession)extras.

<br />

|                                                                                                    Parameters                                                                                                    ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `extras` | `Bundle`: The extras that can include other information associated with the[MediaSession](https://developer.android.com/reference/android/media/session/MediaSession). This value may be`null`. <br /> |

### onMetadataChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onMetadataChanged (MediaMetadata metadata)
```

Override to handle changes to the current metadata.

<br />

|                                        Parameters                                         ||
|------------|-------------------------------------------------------------------------------|
| `metadata` | `MediaMetadata`: The current metadata for the session or null if none. <br /> |

**See also:**

- [MediaMetadata](https://developer.android.com/reference/android/media/MediaMetadata)  

### onPlaybackStateChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onPlaybackStateChanged (PlaybackState state)
```

Override to handle changes in playback state.

<br />

|                                           Parameters                                            ||
|---------|----------------------------------------------------------------------------------------|
| `state` | `PlaybackState`: The new playback state of the session This value may be`null`. <br /> |

### onQueueChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onQueueChanged (List<MediaSession.QueueItem> queue)
```

Override to handle changes to items in the queue.

<br />

|                                                                                           Parameters                                                                                           ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `queue` | `List`: A list of items in the current play queue. It should include the currently playing item as well as previous and upcoming items if applicable. This value may be`null`. <br /> |

**See also:**

- [MediaSession.QueueItem](https://developer.android.com/reference/android/media/session/MediaSession.QueueItem)  

### onQueueTitleChanged

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onQueueTitleChanged (CharSequence title)
```

Override to handle changes to the queue title.

<br />

|                                                                         Parameters                                                                         ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| `title` | `CharSequence`: The title that should be displayed along with the play queue such as "Now Playing". May be null if there is no such title. <br /> |

### onSessionDestroyed

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onSessionDestroyed ()
```

Override to handle the session being destroyed. The session is no longer valid after this call and calls to it will be ignored.

<br />

### onSessionEvent

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void onSessionEvent (String event, 
                Bundle extras)
```

Override to handle custom events sent by the session owner without a specified interface. Controllers should only handle these for sessions they own.

<br />

|                                     Parameters                                     ||
|----------|--------------------------------------------------------------------------|
| `event`  | `String`: The event from the session. This value cannot be`null`. <br /> |
| `extras` | `Bundle`: Optional parameters for the event, may be null. <br />         |