Stay organized with collections
Save and categorize content based on your preferences.
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. |
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.
[[["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-02-10 UTC."],[],[],null,["# PeerHandle\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nPeerHandle\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/aware/PeerHandle \"View this page in Java\") \n\n```\nopen class PeerHandle\n```\n\n|---|----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.wifi.aware.PeerHandle](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [ParcelablePeerHandle](/reference/kotlin/android/net/wifi/aware/ParcelablePeerHandle) |---------------------------------------------------------------------------------------|-------------------------------| | [ParcelablePeerHandle](/reference/kotlin/android/net/wifi/aware/ParcelablePeerHandle) | A Parcelable [PeerHandle](#). | |\n\nOpaque object used to represent a Wi-Fi Aware peer. Obtained from discovery sessions in [DiscoverySessionCallback.onServiceDiscovered(PeerHandle, byte[], java.util.List)](/reference/kotlin/android/net/wifi/aware/DiscoverySessionCallback#onServiceDiscovered(android.net.wifi.aware.PeerHandle,%20kotlin.ByteArray,%20kotlin.collections.MutableList)) or received messages in [DiscoverySessionCallback.onMessageReceived(PeerHandle, byte[])](/reference/kotlin/android/net/wifi/aware/DiscoverySessionCallback#onMessageReceived(android.net.wifi.aware.PeerHandle,%20kotlin.ByteArray)), and used when sending messages e,g, [DiscoverySession.sendMessage(PeerHandle, int, byte[])](/reference/kotlin/android/net/wifi/aware/DiscoverySession#sendMessage(android.net.wifi.aware.PeerHandle,%20kotlin.Int,%20kotlin.ByteArray)), or when configuring a network link to a peer, e.g. [DiscoverySession.createNetworkSpecifierOpen(PeerHandle)](/reference/kotlin/android/net/wifi/aware/DiscoverySession#createNetworkSpecifierOpen(android.net.wifi.aware.PeerHandle)) or [DiscoverySession.createNetworkSpecifierPassphrase(PeerHandle, String)](/reference/kotlin/android/net/wifi/aware/DiscoverySession#createNetworkSpecifierPassphrase(android.net.wifi.aware.PeerHandle,%20kotlin.String)).\n\nNote 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[])](/reference/kotlin/android/net/wifi/aware/DiscoverySession#sendMessage(android.net.wifi.aware.PeerHandle,%20kotlin.Int,%20kotlin.ByteArray)), and/or in the Publish configuration's service-specific information field, [PublishConfig.Builder.setServiceSpecificInfo(byte[])](/reference/kotlin/android/net/wifi/aware/PublishConfig.Builder#setServiceSpecificInfo(kotlin.ByteArray)), or match filter, [PublishConfig.Builder.setMatchFilter(java.util.List)](/reference/kotlin/android/net/wifi/aware/PublishConfig.Builder#setMatchFilter(kotlin.collections.MutableList)).\n\nA parcelable handle object is available with [ParcelablePeerHandle](/reference/kotlin/android/net/wifi/aware/ParcelablePeerHandle).\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` \u003cbr /\u003e |\n| open [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### equals\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun equals(other: Any?): Boolean\n```\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if this object is the same as the obj argument; `false` otherwise. |\n\n### hashCode\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun hashCode(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |"]]