Stay organized with collections
Save and categorize content based on your preferences.
ServiceListener
interface ServiceListener
An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service.
Summary
Public methods |
abstract Unit |
Called to notify the client when the proxy object has been connected to the service.
|
abstract Unit |
Called to notify the client that this proxy object has been disconnected from the service.
|
Public methods
onServiceConnected
abstract fun onServiceConnected(
profile: Int,
proxy: BluetoothProfile!
): Unit
Called to notify the client when the proxy object has been connected to the service.
onServiceDisconnected
abstract fun onServiceDisconnected(profile: Int): Unit
Called to notify the client that this proxy object has been disconnected from the service.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# BluetoothProfile.ServiceListener\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nServiceListener\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/bluetooth/BluetoothProfile.ServiceListener \"View this page in Java\") \n\n```\ninterface ServiceListener\n```\n\n|---------------------------------------------------------|\n| [android.bluetooth.BluetoothProfile.ServiceListener](#) |\n\nAn interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceConnected](#onServiceConnected(kotlin.Int,%20android.bluetooth.BluetoothProfile))`(`profile:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `proxy:` `[BluetoothProfile](/reference/kotlin/android/bluetooth/BluetoothProfile)!`)` Called to notify the client when the proxy object has been connected to the service. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onServiceDisconnected](#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. |\n\nPublic methods\n--------------\n\n### onServiceConnected\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onServiceConnected(\n profile: Int, \n proxy: BluetoothProfile!\n): Unit\n```\n\nCalled to notify the client when the proxy object has been connected to the service.\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `profile` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): - One of [HEADSET](/reference/kotlin/android/bluetooth/BluetoothProfile#HEADSET:kotlin.Int) or [A2DP](/reference/kotlin/android/bluetooth/BluetoothProfile#A2DP:kotlin.Int) |\n| `proxy` | [BluetoothProfile](/reference/kotlin/android/bluetooth/BluetoothProfile)!: - One of [BluetoothHeadset](/reference/kotlin/android/bluetooth/BluetoothHeadset) or [BluetoothA2dp](/reference/kotlin/android/bluetooth/BluetoothA2dp) |\n\n### onServiceDisconnected\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onServiceDisconnected(profile: Int): Unit\n```\n\nCalled to notify the client that this proxy object has been disconnected from the service.\n\n| Parameters ||\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `profile` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): - One of [HEADSET](/reference/kotlin/android/bluetooth/BluetoothProfile#HEADSET:kotlin.Int) or [A2DP](/reference/kotlin/android/bluetooth/BluetoothProfile#A2DP:kotlin.Int) |"]]