Stay organized with collections
Save and categorize content based on your preferences.
LocalOnlyHotspotReservation
open class LocalOnlyHotspotReservation : AutoCloseable
LocalOnlyHotspotReservation that contains the SoftApConfiguration
for the active LocalOnlyHotspot request.
Applications requesting LocalOnlyHotspot for sharing will receive an instance of the LocalOnlyHotspotReservation in the LocalOnlyHotspotCallback.onStarted(LocalOnlyHotspotReservation)
call. This reservation contains the relevant SoftApConfiguration
. When an application is done with the LocalOnlyHotspot, they should call android.net.wifi.WifiManager.LocalOnlyHotspotReservation#close()
. Once this happens, the application will not receive any further callbacks. If the LocalOnlyHotspot is stopped due to a user triggered mode change, applications will be notified via the android.net.wifi.WifiManager.LocalOnlyHotspotCallback#onStopped()
callback.
Summary
Protected methods |
open Unit |
|
Public methods
close
open fun close(): Unit
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
getWifiConfiguration
open fun getWifiConfiguration(): WifiConfiguration?
Deprecated: Use WifiManager#getSoftApConfiguration()
to get the LOHS configuration.
Returns the WifiConfiguration
of the current Local Only Hotspot (LOHS). May be null if hotspot enabled and security type is not WifiConfiguration.KeyMgmt.None
or WifiConfiguration.KeyMgmt.WPA2_PSK
.
Protected methods
finalize
protected open fun finalize(): Unit
Exceptions |
java.lang.Throwable |
the Exception raised by this method |
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,["# WifiManager.LocalOnlyHotspotReservation\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nLocalOnlyHotspotReservation\n===========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/net/wifi/WifiManager.LocalOnlyHotspotReservation \"View this page in Java\") \n\n```\nopen class LocalOnlyHotspotReservation : AutoCloseable\n```\n\n|---|---------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.net.wifi.WifiManager.LocalOnlyHotspotReservation](#) |\n\nLocalOnlyHotspotReservation that contains the [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration) for the active LocalOnlyHotspot request.\n\nApplications requesting LocalOnlyHotspot for sharing will receive an instance of the LocalOnlyHotspotReservation in the [LocalOnlyHotspotCallback.onStarted(LocalOnlyHotspotReservation)](/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotCallback#onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation)) call. This reservation contains the relevant [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration). When an application is done with the LocalOnlyHotspot, they should call [android.net.wifi.WifiManager.LocalOnlyHotspotReservation#close()](#close()). Once this happens, the application will not receive any further callbacks. If the LocalOnlyHotspot is stopped due to a user triggered mode change, applications will be notified via the [android.net.wifi.WifiManager.LocalOnlyHotspotCallback#onStopped()](/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotCallback#onStopped()) callback.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [close](#close())`()` \u003cbr /\u003e |\n| open [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration) | [getSoftApConfiguration](#getSoftApConfiguration())`()` Returns the [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration) of the current Local Only Hotspot (LOHS). |\n| open [WifiConfiguration](/reference/kotlin/android/net/wifi/WifiConfiguration)? | [getWifiConfiguration](#getWifiConfiguration())`()` Returns the [WifiConfiguration](/reference/kotlin/android/net/wifi/WifiConfiguration) of the current Local Only Hotspot (LOHS). |\n\n| Protected methods ||\n|-----------------------------------------------------------------------------------|------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalize](#finalize())`()` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### close\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun close(): Unit\n```\n\n| Exceptions ||\n|-----------------------|-----------------------------------|\n| `java.lang.Exception` | if this resource cannot be closed |\n\n### getSoftApConfiguration\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getSoftApConfiguration(): SoftApConfiguration\n```\n\nReturns the [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration) of the current Local Only Hotspot (LOHS).\n\n| Return ||\n|-------------------------------------------------------------------------------|------------------------------|\n| [SoftApConfiguration](/reference/kotlin/android/net/wifi/SoftApConfiguration) | This value cannot be `null`. |\n\n### getWifiConfiguration\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun getWifiConfiguration(): WifiConfiguration?\n```\n\n**Deprecated:** *Use `WifiManager#getSoftApConfiguration()` to get the LOHS configuration.*\n\nReturns the [WifiConfiguration](/reference/kotlin/android/net/wifi/WifiConfiguration) of the current Local Only Hotspot (LOHS). May be null if hotspot enabled and security type is not `WifiConfiguration.KeyMgmt.None` or `WifiConfiguration.KeyMgmt.WPA2_PSK`.\n\nProtected methods\n-----------------\n\n### finalize\n\nAdded in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nprotected open fun finalize(): Unit\n```\n\n| Exceptions ||\n|-----------------------|---------------------------------------|\n| `java.lang.Throwable` | the `Exception` raised by this method |"]]