# BluetoothProfile.ServiceListener

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

# ServiceListener

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/bluetooth/BluetoothProfile.ServiceListener "View this page in Java")  

```
interface ServiceListener
```

|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [android.bluetooth.BluetoothProfile.ServiceListener](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile.ServiceListener#) |

An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service.

## Summary

|                                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                                     ||
|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceConnected](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile.ServiceListener#onServiceConnected(kotlin.Int,%20android.bluetooth.BluetoothProfile))`(`profile:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `proxy:` `[BluetoothProfile](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile)!`)` Called to notify the client when the proxy object has been connected to the service. |
| abstract[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceDisconnected](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile.ServiceListener#onServiceDisconnected(kotlin.Int))`(`profile:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called to notify the client that this proxy object has been disconnected from the service.                                                                                                                                              |

## Public methods

### onServiceConnected

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

```
abstract fun onServiceConnected(
    profile: Int, 
    proxy: BluetoothProfile!
): Unit
```

Called to notify the client when the proxy object has been connected to the service.

|                                                                                                                                                            Parameters                                                                                                                                                            ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `profile` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):- One of[HEADSET](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile#HEADSET:kotlin.Int)or[A2DP](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile#A2DP:kotlin.Int)         |
| `proxy`   | [BluetoothProfile](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile)!:- One of[BluetoothHeadset](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothHeadset)or[BluetoothA2dp](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothA2dp) |

### onServiceDisconnected

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

```
abstract fun onServiceDisconnected(profile: Int): Unit
```

Called to notify the client that this proxy object has been disconnected from the service.

|                                                                                                                                                        Parameters                                                                                                                                                        ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `profile` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):- One of[HEADSET](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile#HEADSET:kotlin.Int)or[A2DP](https://developer.android.com/reference/kotlin/android/bluetooth/BluetoothProfile#A2DP:kotlin.Int) |