# 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)

*** ** * ** ***


```
public interface UwbManager extends AutoCloseable
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#clearUwbAvailabilityCallback()()` Unsubscribes from UWB availability. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbClientSessionScope` | `[clientSessionScope](https://developer.android.com/reference/androidx/core/uwb/UwbManager#clientSessionScope())()` **This method is deprecated.** Renamed to controleeSessionScope |
| `abstract void` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#close()()` Closes the UwbManager. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbControleeSessionScope` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#controleeSessionScope()()` |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbControllerSessionScope` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#controllerSessionScope()()` |
| `default static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbManager` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#createInstance(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Creates a new UwbManager that is used for creating UWB client sessions. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#isAvailable()()` Checks whether UWB service is available or not. |
| `abstract void` | `https://developer.android.com/reference/androidx/core/uwb/UwbManager#setUwbAvailabilityCallback(java.util.concurrent.Executor,androidx.core.uwb.UwbAvailabilityCallback)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/uwb/UwbAvailabilityCallback observer )` Subscribes to UWB availability. |

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

## Public methods

### clearUwbAvailabilityCallback

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

```
abstract void clearUwbAvailabilityCallback()
```

Unsubscribes from UWB availability.

### clientSessionScope

```
abstract @NonNull UwbClientSessionScope [clientSessionScope](https://developer.android.com/reference/androidx/core/uwb/UwbManager#clientSessionScope())()
```

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

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

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/core/uwb/exceptions/UwbServiceNotAvailableException` | if the UWB is turned off. |
| `https://developer.android.com/reference/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)

```
abstract void close()
```

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

### controleeSessionScope

```
abstract @NonNull UwbControleeSessionScope controleeSessionScope()
```

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

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

### controllerSessionScope

```
abstract @NonNull UwbControllerSessionScope controllerSessionScope()
```

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

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

### createInstance

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

```
default static final @NonNull UwbManager createInstance(@NonNull Context context)
```

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

### isAvailable

```
abstract boolean isAvailable()
```

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 |
|---|---|
| `boolean` | true if UWB service is available, false otherwise |

| Throws |
|---|---|
| `https://developer.android.com/reference/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)

```
abstract void setUwbAvailabilityCallback(
    @NonNull Executor executor,
    @NonNull UwbAvailabilityCallback observer
)
```

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

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

## Extension functions

### UwbManagerRx.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)

```
default final @NonNull Single<@NonNull UwbClientSessionScope> UwbManagerRx.[clientSessionScopeSingle](https://developer.android.com/reference/androidx/core/uwb/UwbManager#(androidx.core.uwb.UwbManager).clientSessionScopeSingle())(@NonNull UwbManager receiver)
```

> [!CAUTION]
> **This method 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/androidx/core/uwb/UwbClientSessionScope`.

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

### UwbManagerRx.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)

```
default final @NonNull Single<@NonNull UwbControleeSessionScope> UwbManagerRx.controleeSessionScopeSingle(@NonNull UwbManager receiver)
```

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

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

### UwbManagerRx.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)

```
default final @NonNull Single<@NonNull UwbControllerSessionScope> UwbManagerRx.controllerSessionScopeSingle(@NonNull UwbManager receiver)
```

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

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