# UwbManager

Artifact: [androidx.core.uwb:uwb](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/UwbManager.kt+class:androidx.core.uwb.UwbManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

*** ** * ** ***


```
interface UwbManager : AutoCloseable
```

<br />

*** ** * ** ***

Interface for getting UWB capabilities and interacting with nearby UWB devices to perform ranging.

## Summary

| ### Public companion functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#createInstance(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Creates a new UwbManager that is used for creating UWB client sessions. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#clearUwbAvailabilityCallback()()` Unsubscribes from UWB availability. |
| `suspend https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbClientSessionScope` | `[clientSessionScope](https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#clientSessionScope())()` **This function is deprecated.** Renamed to controleeSessionScope |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#close()()` Closes the UwbManager. |
| `suspend https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#controleeSessionScope()()` |
| `suspend https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#controllerSessionScope()()` |
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#isAvailable()()` Checks whether UWB service is available or not. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#setUwbAvailabilityCallback(java.util.concurrent.Executor,androidx.core.uwb.UwbAvailabilityCallback)( executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, observer: https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback )` Subscribes to UWB availability. |

| ### Extension functions |
|---|---|
| `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html<https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbClientSessionScope>` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager.[clientSessionScopeSingle](https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#(androidx.core.uwb.UwbManager).clientSessionScopeSingle())()` **This function is deprecated.** Renamed to controleeSessionScopeSingle |
| `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html<https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope>` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager.https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#(androidx.core.uwb.UwbManager).controleeSessionScopeSingle()()` Returns a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html` of `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope`. |
| `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html<https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope>` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager.https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#(androidx.core.uwb.UwbManager).controllerSessionScopeSingle()()` Returns a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html` of `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope`. |

## Public companion functions

### createInstance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
fun createInstance(context: Context): UwbManager
```

Creates a new UwbManager that is used for creating UWB client sessions.

## Public functions

### clearUwbAvailabilityCallback

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
fun clearUwbAvailabilityCallback(): Unit
```

Unsubscribes from UWB availability.

### clientSessionScope

```
suspend fun [clientSessionScope](https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#clientSessionScope())(): UwbClientSessionScope
```

> [!CAUTION]
> **This function is deprecated.**   
> Renamed to controleeSessionScope

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbClientSessionScope` | a new `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbClientSessionScope` that tracks the lifecycle of a UWB connection. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbServiceNotAvailableException` | if the UWB is turned off. |
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException` | if the hardware is not available on the device. |

### close

Added in [1.1.0-alpha03](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.1.0-alpha03)

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

Closes the UwbManager. This releases any resources held by the manager, such as unbinding from the UWB backend service.

### controleeSessionScope

```
suspend fun controleeSessionScope(): UwbControleeSessionScope
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope` | a new `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope` that tracks the lifecycle of a UWB connection. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbServiceNotAvailableException` | if the UWB is turned off. |
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException` | if the hardware is not available on the device. |

### controllerSessionScope

```
suspend fun controllerSessionScope(): UwbControllerSessionScope
```

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope` | a new `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope` that tracks the lifecycle of a UWB connection. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbServiceNotAvailableException` | if the UWB is turned off. |
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException` | if the hardware is not available on the device. |

### isAvailable

```
suspend fun isAvailable(): Boolean
```

Checks whether UWB service is available or not. Airplane mode or turning the UWB off will cause the uwb service to be unavailable. When unavailable, the user cannot create session scope through this interface. Also, user should check the hardware support for UWB by using `PackageManager.hasSystemFeature("android.hardware.uwb")`.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | true if UWB service is available, false otherwise |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/exceptions/UwbHardwareNotAvailableException` | if the hardware is not available on the device. |

### setUwbAvailabilityCallback

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

```
fun setUwbAvailabilityCallback(
    executor: Executor,
    observer: UwbAvailabilityCallback
): Unit
```

Subscribes to UWB availability. The user will be notified by the callback when UWB state changes.

| Parameters |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | an executor to execute the callback |
| `observer: https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback` | a callback to receive UWB state change |

## Extension functions

### UwbManager.clientSessionScopeSingle

Artifact: [androidx.core.uwb:uwb-rxjava3](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/rxjava3/UwbManagerRx.kt+function:clientSessionScopeSingle)

```
fun UwbManager.[clientSessionScopeSingle](https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#(androidx.core.uwb.UwbManager).clientSessionScopeSingle())(): Single<UwbClientSessionScope>
```

> [!CAUTION]
> **This function is deprecated.**   
> Renamed to controleeSessionScopeSingle

Returns a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html` of `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbClientSessionScope`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#clientSessionScope()` |   |

### UwbManager.controleeSessionScopeSingle

Artifact: [androidx.core.uwb:uwb-rxjava3](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/rxjava3/UwbManagerRx.kt+function:controleeSessionScopeSingle)

```
fun UwbManager.controleeSessionScopeSingle(): Single<UwbControleeSessionScope>
```

Returns a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html` of `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControleeSessionScope`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#controleeSessionScope()` |   |

### UwbManager.controllerSessionScopeSingle

Artifact: [androidx.core.uwb:uwb-rxjava3](https://developer.android.com/jetpack/androidx/releases/core-uwb) [View Source](https://cs.android.com/search?q=file:androidx/core/uwb/rxjava3/UwbManagerRx.kt+function:controllerSessionScopeSingle)

```
fun UwbManager.controllerSessionScopeSingle(): Single<UwbControllerSessionScope>
```

Returns a `http://reactivex.io/RxJava/3.x/javadoc/io/reactivex/rxjava3/core/Single.html` of `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbControllerSessionScope`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbManager#controllerSessionScope()` |   |