See what premium Google Developer Program benefits can do for you. Learn more
Stay organized with collections
Save and categorize content based on your preferences.
OnPayloadReceivedCallback
interface OnPayloadReceivedCallback
Listener that is notified when a payload received.
Summary
Public methods
|
abstract Unit |
Called when the connection is closed.
|
abstract Unit |
Called when receive raw bytes on a named channel from the remote device.
|
Public methods
onConnectionClosed
abstract fun onConnectionClosed(reason: String?): Unit
Called when the connection is closed.
Parameters |
reason: String? |
The reason provided by the remote participant |
onPayloadReceived
abstract fun onPayloadReceived(
channelName: String,
token: IBinder,
bytes: ByteArray
): Unit
Called when receive raw bytes on a named channel from the remote device.
Parameters |
channelName: String |
Name of the channel from which the payload is received. |
token: IBinder |
The token representing the device from which this payload is received. This is the
same token in SelectedDevice. |
bytes: ByteArray |
The message payload received. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 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 2024-10-31 UTC."],[[["`OnPayloadReceivedCallback` is a listener interface that gets notified about events related to receiving payloads and connection status."],["It provides two callback methods: `onPayloadReceived` and `onConnectionClosed`."],["`onPayloadReceived` is triggered when raw bytes are received on a specific channel from a remote device, providing the channel name, device token, and the received bytes."],["`onConnectionClosed` is called when the connection to the remote device is closed, potentially providing a reason for the closure."]]],[]]