UwbManager
interface UwbManager
Interface for getting UWB capabilities and interacting with nearby UWB devices to perform ranging.
Summary
Public companion functions |
|
|---|---|
UwbManager |
createInstance(context: Context)Creates a new UwbManager that is used for creating UWB client sessions. |
Public functions |
|
|---|---|
Unit |
Unsubscribes from UWB availability. |
suspend UwbClientSessionScope |
This function is deprecated. Renamed to controleeSessionScope |
suspend UwbControleeSessionScope |
|
suspend UwbControllerSessionScope |
|
suspend Boolean |
Checks whether UWB service is available or not. |
Unit |
setUwbAvailabilityCallback(Subscribes to UWB availability. |
Extension functions |
|
|---|---|
Single<UwbClientSessionScope> |
This function is deprecated. Renamed to controleeSessionScopeSingle |
Single<UwbControleeSessionScope> |
Returns a |
Single<UwbControllerSessionScope> |
Returns a |
Public companion functions
createInstance
fun createInstance(context: Context): UwbManager
Creates a new UwbManager that is used for creating UWB client sessions.
Public functions
clearUwbAvailabilityCallback
fun clearUwbAvailabilityCallback(): Unit
Unsubscribes from UWB availability.
clientSessionScope
suspend funclientSessionScope(): UwbClientSessionScope
| Returns | |
|---|---|
UwbClientSessionScope |
a new |
| Throws | |
|---|---|
androidx.core.uwb.exceptions.UwbServiceNotAvailableException |
if the UWB is turned off. |
androidx.core.uwb.exceptions.UwbHardwareNotAvailableException |
if the hardware is not available on the device. |
controleeSessionScope
suspend fun controleeSessionScope(): UwbControleeSessionScope
| Returns | |
|---|---|
UwbControleeSessionScope |
a new |
| Throws | |
|---|---|
androidx.core.uwb.exceptions.UwbServiceNotAvailableException |
if the UWB is turned off. |
androidx.core.uwb.exceptions.UwbHardwareNotAvailableException |
if the hardware is not available on the device. |
controllerSessionScope
suspend fun controllerSessionScope(): UwbControllerSessionScope
| Returns | |
|---|---|
UwbControllerSessionScope |
a new |
| Throws | |
|---|---|
androidx.core.uwb.exceptions.UwbServiceNotAvailableException |
if the UWB is turned off. |
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 | |
|---|---|
Boolean |
true if UWB service is available, false otherwise |
| Throws | |
|---|---|
androidx.core.uwb.exceptions.UwbHardwareNotAvailableException |
if the hardware is not available on the device. |
setUwbAvailabilityCallback
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: Executor |
an executor to execute the callback |
observer: UwbAvailabilityCallback |
a callback to receive UWB state change |
Extension functions
clientSessionScopeSingle
fun UwbManager.clientSessionScopeSingle(): Single<UwbClientSessionScope>
Returns a Single of UwbClientSessionScope.
| See also | |
|---|---|
clientSessionScope |
controleeSessionScopeSingle
fun UwbManager.controleeSessionScopeSingle(): Single<UwbControleeSessionScope>
Returns a Single of UwbControleeSessionScope.
| See also | |
|---|---|
controleeSessionScope |
controllerSessionScopeSingle
fun UwbManager.controllerSessionScopeSingle(): Single<UwbControllerSessionScope>
Returns a Single of UwbControllerSessionScope.
| See also | |
|---|---|
controllerSessionScope |