# RemotePlaybackClient.OnMessageReceivedListener

# RemotePlaybackClient.OnMessageReceivedListener

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/mediarouter/media/RemotePlaybackClient.OnMessageReceivedListener "View this page in Java")

<br />

```
interface RemotePlaybackClient.OnMessageReceivedListener
```

<br />

*** ** * ** ***

A callback that will receive messages from media sessions.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onMessageReceived](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/RemotePlaybackClient.OnMessageReceivedListener#onMessageReceived(java.lang.String,android.os.Bundle))`(sessionId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`, message: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?)` Called when a message received. |

## Public functions

### onMessageReceived

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

```
fun onMessageReceived(sessionId: String, message: Bundle?): Unit
```

Called when a message received.  

|                                           Parameters                                           |
|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
| `sessionId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | The session id.                                                                                                                                         |
| `message: `[Bundle](https://developer.android.com/reference/android/os/Bundle.html)`?`         | A bundle message denoting[EXTRA_MESSAGE](https://developer.android.com/reference/kotlin/androidx/mediarouter/media/MediaControlIntent#EXTRA_MESSAGE()). |