PeerHandle
open class PeerHandle
Opaque object used to represent a Wi-Fi Aware peer. Obtained from discovery sessions in DiscoverySessionCallback.onServiceDiscovered(PeerHandle, byte[], java.util.List)
or received messages in DiscoverySessionCallback.onMessageReceived(PeerHandle, byte[])
, and used when sending messages e,g, DiscoverySession.sendMessage(PeerHandle, int, byte[])
, or when configuring a network link to a peer, e.g. DiscoverySession.createNetworkSpecifierOpen(PeerHandle)
or DiscoverySession.createNetworkSpecifierPassphrase(PeerHandle, String)
.
Note that while a PeerHandle
can be used to track a particular peer (i.e. you can compare the values received from subsequent messages) - it is good practice not to rely on it. Instead use an application level peer identifier encoded in the message, DiscoverySession.sendMessage(PeerHandle, int, byte[])
, and/or in the Publish configuration's service-specific information field, PublishConfig.Builder.setServiceSpecificInfo(byte[])
, or match filter, PublishConfig.Builder.setMatchFilter(java.util.List)
.
A parcelable handle object is available with ParcelablePeerHandle
.
Summary
Public methods
equals
open fun equals(other: Any?): Boolean
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is the same as the obj argument; false otherwise. |
hashCode
open fun hashCode(): Int
Return |
Int |
a hash code value for this object. |