Stay organized with collections
Save and categorize content based on your preferences.
ReceiveCallback
interface ReceiveCallback
TransportHandle callback.
Summary
Public methods |
abstract Unit |
Notifies the receiver that the TransportHandle instance can't be used anymore to receive or send data.
|
abstract Unit |
Notifies the receiver that the TransportHandle instance can't be used to receive or send data until {@see onReconnect()} is called.
|
abstract Unit |
Notifies and provides data received from the peer device.
|
abstract Unit |
Notifies the receiver the TransportHandle instance can be used again to send and receive data.
|
abstract Unit |
Called when a data send operation fails.
|
Public methods
onClose
abstract fun onClose(): Unit
Notifies the receiver that the TransportHandle instance can't be used anymore to receive or send data. Also call this in AutoCloseable.close()
.
onDisconnect
abstract fun onDisconnect(): Unit
Notifies the receiver that the TransportHandle instance can't be used to receive or send data until {@see onReconnect()} is called.
onReceiveData
abstract fun onReceiveData(data: ByteArray): Unit
Notifies and provides data received from the peer device.
Parameters |
data |
ByteArray: the data received from the peer device. Must not be null. |
onReconnect
abstract fun onReconnect(): Unit
Notifies the receiver the TransportHandle instance can be used again to send and receive data. Should only be called if {@see onDisconnect()} preceded it.
onSendFailed
abstract fun onSendFailed(): Unit
Called when a data send operation fails.
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-03-13 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-13 UTC."],[],[],null,["# TransportHandle.ReceiveCallback\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nReceiveCallback\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/ranging/oob/TransportHandle.ReceiveCallback \"View this page in Java\") \n\n```\ninterface ReceiveCallback\n```\n\n|----------------------------------------------------------|\n| [android.ranging.oob.TransportHandle.ReceiveCallback](#) |\n\nTransportHandle callback.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onClose](#onClose())`()` Notifies the receiver that the TransportHandle instance can't be used anymore to receive or send data. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onDisconnect](#onDisconnect())`()` Notifies the receiver that the TransportHandle instance can't be used to receive or send data until {@see onReconnect()} is called. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onReceiveData](#onReceiveData(kotlin.ByteArray))`(`data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Notifies and provides data received from the peer device. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onReconnect](#onReconnect())`()` Notifies the receiver the TransportHandle instance can be used again to send and receive data. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onSendFailed](#onSendFailed())`()` Called when a data send operation fails. |\n\nPublic methods\n--------------\n\n### onClose\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onClose(): Unit\n```\n\nNotifies the receiver that the TransportHandle instance can't be used anymore to receive or send data. Also call this in [AutoCloseable.close()](../../../java/lang/AutoCloseable.html#close()). \n\n### onDisconnect\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onDisconnect(): Unit\n```\n\nNotifies the receiver that the TransportHandle instance can't be used to receive or send data until {@see onReconnect()} is called. \n\n### onReceiveData\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onReceiveData(data: ByteArray): Unit\n```\n\nNotifies and provides data received from the peer device.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `data` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the data received from the peer device. Must not be null. |\n\n### onReconnect\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onReconnect(): Unit\n```\n\nNotifies the receiver the TransportHandle instance can be used again to send and receive data. Should only be called if {@see onDisconnect()} preceded it. \n\n### onSendFailed\n\nAdded in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onSendFailed(): Unit\n```\n\nCalled when a data send operation fails."]]