UwbManager
public interface UwbManager
Interface for getting UWB capabilities and interacting with nearby UWB devices to perform ranging.
Summary
Public methods |
|
|---|---|
abstract void |
Unsubscribes from UWB availability. |
abstract @NonNull UwbClientSessionScope |
This method is deprecated. Renamed to controleeSessionScope |
abstract @NonNull UwbControleeSessionScope |
|
abstract @NonNull UwbControllerSessionScope |
|
default static final @NonNull UwbManager |
createInstance(@NonNull Context context)Creates a new UwbManager that is used for creating UWB client sessions. |
abstract boolean |
Checks whether UWB service is available or not. |
abstract void |
setUwbAvailabilityCallback(Subscribes to UWB availability. |
Extension functions |
|
|---|---|
default final @NonNull Single<@NonNull UwbClientSessionScope> |
UwbManagerRx.This method is deprecated. Renamed to controleeSessionScopeSingle |
default final @NonNull Single<@NonNull UwbControleeSessionScope> |
UwbManagerRx.controleeSessionScopeSingle(@NonNull UwbManager receiver)Returns a |
default final @NonNull Single<@NonNull UwbControllerSessionScope> |
Returns a |
Public methods
clearUwbAvailabilityCallback
abstract void clearUwbAvailabilityCallback()
Unsubscribes from UWB availability.
clientSessionScope
abstract @NonNull UwbClientSessionScopeclientSessionScope()
| Returns | |
|---|---|
@NonNull 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
abstract @NonNull UwbControleeSessionScope controleeSessionScope()
| Returns | |
|---|---|
@NonNull 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
abstract @NonNull UwbControllerSessionScope controllerSessionScope()
| Returns | |
|---|---|
@NonNull 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. |
createInstance
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 | |
|---|---|
androidx.core.uwb.exceptions.UwbHardwareNotAvailableException |
if the hardware is not available on the device. |
setUwbAvailabilityCallback
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 | |
|---|---|
@NonNull Executor executor |
an executor to execute the callback |
@NonNull UwbAvailabilityCallback observer |
a callback to receive UWB state change |
Extension functions
UwbManagerRx.clientSessionScopeSingle
default final @NonNull Single<@NonNull UwbClientSessionScope> UwbManagerRx.clientSessionScopeSingle(@NonNull UwbManager receiver)
Returns a Single of UwbClientSessionScope.
| See also | |
|---|---|
clientSessionScope |
UwbManagerRx.controleeSessionScopeSingle
default final @NonNull Single<@NonNull UwbControleeSessionScope> UwbManagerRx.controleeSessionScopeSingle(@NonNull UwbManager receiver)
Returns a Single of UwbControleeSessionScope.
| See also | |
|---|---|
controleeSessionScope |
UwbManagerRx.controllerSessionScopeSingle
default final @NonNull Single<@NonNull UwbControllerSessionScope> UwbManagerRx.controllerSessionScopeSingle(@NonNull UwbManager receiver)
Returns a Single of UwbControllerSessionScope.
| See also | |
|---|---|
controllerSessionScope |