# WifiManager.LocalOnlyHotspotReservation

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# LocalOnlyHotspotReservation

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/net/wifi/WifiManager.LocalOnlyHotspotReservation "View this page in Java")  

```
open class LocalOnlyHotspotReservation : AutoCloseable
```

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                       ||
| ↳ | [android.net.wifi.WifiManager.LocalOnlyHotspotReservation](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotReservation#) |

LocalOnlyHotspotReservation that contains the[SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration)for the active LocalOnlyHotspot request.

Applications requesting LocalOnlyHotspot for sharing will receive an instance of the LocalOnlyHotspotReservation in the[LocalOnlyHotspotCallback.onStarted(LocalOnlyHotspotReservation)](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotCallback#onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation))call. This reservation contains the relevant[SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration). When an application is done with the LocalOnlyHotspot, they should call[android.net.wifi.WifiManager.LocalOnlyHotspotReservation#close()](https://developer.android.com/reference/kotlin/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()](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotCallback#onStopped())callback.

## Summary

|                                                                                                                                                                                                                Public methods                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                               | [close](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotReservation#close())`()` <br />                                                                                                                                                                                           |
| open[SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration) | [getSoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotReservation#getSoftApConfiguration())`()` Returns the[SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration)of the current Local Only Hotspot (LOHS). |
| open[WifiConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration)?    | [getWifiConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotReservation#getWifiConfiguration())`()` Returns the[WifiConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/WifiConfiguration)of the current Local Only Hotspot (LOHS).         |

|                                                                                                      Protected methods                                                                                                      ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalize](https://developer.android.com/reference/kotlin/android/net/wifi/WifiManager.LocalOnlyHotspotReservation#finalize())`()` <br /> |

## Public methods

### close

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun close(): Unit
```

|                        Exceptions                        ||
|-----------------------|-----------------------------------|
| `java.lang.Exception` | if this resource cannot be closed |

### getSoftApConfiguration

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getSoftApConfiguration(): SoftApConfiguration
```

Returns the[SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration)of the current Local Only Hotspot (LOHS).

|                                                                 Return                                                                  ||
|------------------------------------------------------------------------------------------------------------|-----------------------------|
| [SoftApConfiguration](https://developer.android.com/reference/kotlin/android/net/wifi/SoftApConfiguration) | This value cannot be`null`. |

### getWifiConfiguration

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun getWifiConfiguration(): WifiConfiguration?
```

**Deprecated:** *Use`WifiManager#getSoftApConfiguration()`to get the LOHS configuration.*

Returns the[WifiConfiguration](https://developer.android.com/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`.

## Protected methods

### finalize

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected open fun finalize(): Unit
```

|                         Exceptions                         ||
|-----------------------|-------------------------------------|
| `java.lang.Throwable` | the`Exception`raised by this method |