# MediaBrowser.ConnectionCallback

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

# ConnectionCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/browse/MediaBrowser.ConnectionCallback "View this page in Java")  

```
class ConnectionCallback
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                               ||
| ↳ | [android.media.browse.MediaBrowser.ConnectionCallback](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.ConnectionCallback#) |

Callbacks for connection related events.

## Summary

|                                                                     Public constructors                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ConnectionCallback](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.ConnectionCallback#ConnectionCallback())`()` <br /> |

|                                                                                                                                                                                            Public methods                                                                                                                                                                                            ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnected](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.ConnectionCallback#onConnected())`()` Invoked after[MediaBrowser.connect()](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser#connect())when the request has successfully completed. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnectionFailed](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.ConnectionCallback#onConnectionFailed())`()` Invoked when the connection to the media browser failed.                                                                                                        |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onConnectionSuspended](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser.ConnectionCallback#onConnectionSuspended())`()` Invoked when the client is disconnected from the media browser.                                                                                           |

## Public constructors

### ConnectionCallback

```
ConnectionCallback()
```

## Public methods

### onConnected

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

```
open fun onConnected(): Unit
```

Invoked after[MediaBrowser.connect()](https://developer.android.com/reference/kotlin/android/media/browse/MediaBrowser#connect())when the request has successfully completed.  

### onConnectionFailed

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

```
open fun onConnectionFailed(): Unit
```

Invoked when the connection to the media browser failed.  

### onConnectionSuspended

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

```
open fun onConnectionSuspended(): Unit
```

Invoked when the client is disconnected from the media browser.