# UwbAvailabilityCallback

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/UwbAvailabilityCallback.kt+class:androidx.core.uwb.UwbAvailabilityCallback) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core-uwb#1.0.0)

*** ** * ** ***


```
interface UwbAvailabilityCallback
```

<br />

*** ** * ** ***

Callback used for UWB availability.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_COUNTRY_CODE_ERROR() = 2` The state has changed either because no country code has been configured or due to UWB being unavailable as a result of regulatory constraints. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_SYSTEM_POLICY() = 1` The state has changed because UWB is turned on/off |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_UNKNOWN() = 0` The state has changed because of an unknown reason |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#onUwbStateChanged(kotlin.Boolean,kotlin.Int)(isAvailable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Callback when the UWB state is changed |

## Constants

### STATE_CHANGE_REASON_COUNTRY_CODE_ERROR

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

```
const val STATE_CHANGE_REASON_COUNTRY_CODE_ERROR = 2: Int
```

The state has changed either because no country code has been configured or due to UWB being unavailable as a result of regulatory constraints.

### STATE_CHANGE_REASON_SYSTEM_POLICY

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

```
const val STATE_CHANGE_REASON_SYSTEM_POLICY = 1: Int
```

The state has changed because UWB is turned on/off

### STATE_CHANGE_REASON_UNKNOWN

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

```
const val STATE_CHANGE_REASON_UNKNOWN = 0: Int
```

The state has changed because of an unknown reason

## Public functions

### onUwbStateChanged

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

```
fun onUwbStateChanged(isAvailable: Boolean, reason: Int): Unit
```

Callback when the UWB state is changed

| Parameters |
|---|---|
| `isAvailable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if UWB is switched on, false otherwise |
| `reason: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The reason of UWB state change. Possible reasons are `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_UNKNOWN()`, `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_SYSTEM_POLICY()` and `https://developer.android.com/reference/kotlin/androidx/core/uwb/UwbAvailabilityCallback#STATE_CHANGE_REASON_COUNTRY_CODE_ERROR()` Value is one of the following: - `0` - `1` - `2` <br /> |