Stay organized with collections
Save and categorize content based on your preferences.
AttachCallback
open class AttachCallback
Base class for Aware attach callbacks. Should be extended by applications and set when calling WifiAwareManager.attach(AttachCallback, android.os.Handler)
. These are callbacks applying to the Aware connection as a whole - not to specific publish or subscribe sessions - for that see DiscoverySessionCallback
.
Summary
Public constructors
AttachCallback
AttachCallback()
Public methods
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,["# AttachCallback\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nAttachCallback\n==============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/aware/AttachCallback \"View this page in Java\") \n\n```\nopen class AttachCallback\n```\n\n|---|--------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.wifi.aware.AttachCallback](#) |\n\nBase class for Aware attach callbacks. Should be extended by applications and set when calling [WifiAwareManager.attach(AttachCallback, android.os.Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)). These are callbacks applying to the Aware connection as a whole - not to specific publish or subscribe sessions - for that see [DiscoverySessionCallback](/reference/kotlin/android/net/wifi/aware/DiscoverySessionCallback).\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------------------|---|\n| [AttachCallback](#AttachCallback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAttachFailed](#onAttachFailed())`()` Called when Aware attach operation [WifiAwareManager.attach(AttachCallback, android.os.Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)) failed. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAttached](#onAttached(android.net.wifi.aware.WifiAwareSession))`(`session:` `[WifiAwareSession](/reference/kotlin/android/net/wifi/aware/WifiAwareSession)!`)` Called when Aware attach operation [WifiAwareManager.attach(AttachCallback, android.os.Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)) is completed and that we can now start discovery sessions or connections. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAwareSessionTerminated](#onAwareSessionTerminated())`()` Called when Aware attach session get from [onAttached(android.net.wifi.aware.WifiAwareSession)](#onAttached(android.net.wifi.aware.WifiAwareSession)) is terminated. |\n\nPublic constructors\n-------------------\n\n### AttachCallback\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nAttachCallback()\n```\n\nPublic methods\n--------------\n\n### onAttachFailed\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAttachFailed(): Unit\n```\n\nCalled when Aware attach operation [WifiAwareManager.attach(AttachCallback, android.os.Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)) failed. \n\n### onAttached\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAttached(session: WifiAwareSession!): Unit\n```\n\nCalled when Aware attach operation [WifiAwareManager.attach(AttachCallback, android.os.Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)) is completed and that we can now start discovery sessions or connections.\n\n| Parameters ||\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `session` | [WifiAwareSession](/reference/kotlin/android/net/wifi/aware/WifiAwareSession)!: The Aware object on which we can execute further Aware operations - e.g. discovery, connections. |\n\n### onAwareSessionTerminated\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onAwareSessionTerminated(): Unit\n```\n\nCalled when Aware attach session get from [onAttached(android.net.wifi.aware.WifiAwareSession)](#onAttached(android.net.wifi.aware.WifiAwareSession)) is terminated. Use [WifiAwareManager.attach(AttachCallback, Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.os.Handler)) or [WifiAwareManager.attach(AttachCallback, IdentityChangedListener, Handler)](/reference/kotlin/android/net/wifi/aware/WifiAwareManager#attach(android.net.wifi.aware.AttachCallback,%20android.net.wifi.aware.IdentityChangedListener,%20android.os.Handler)) to get a new active session."]]