Package com.codename1.nearby.ranging
Ultra-wideband precision ranging: how far away another device is, and in which direction.
UWB measures distance by timing a radio round trip, which is worth about ten centimeters. That is a different kind of answer from a Bluetooth signal-strength estimate, which is worth a few meters on a good day and swings wildly when someone puts a hand over the phone -- so this is what makes "unlock as I walk up to the door" and "point me at my bag" work at all.
Start at Ranging. The shape of a session, and why it takes two steps,
is documented there.
What it costs to reference this package
On iOS the build links NearbyInteraction.framework and injects the two
Nearby Interaction privacy strings. On Android it adds the
androidx.core.uwb dependency and the UWB_RANGING permission, and
declares the UWB hardware feature as optional so the app still installs
on devices without the radio.
Hardware, not just platform
Ranging.isSupported() answers false on plenty of current phones --
iPhones before the 11, and most Android devices. Treat ranging as an
enhancement to a feature that also works without it rather than as the
feature itself.
-
ClassDescriptionPrecision ranging: how far away another device is, and in which direction.A
RangingListenerwhose methods all do nothing, so a caller interested in one event overrides one method.What the current device can actually measure.Receives everything aRangingSessionhas to say.Why a peer stopped being ranged, delivered toRangingListener.peerRemoved(RangingRemovalReason).Which end of a UWB session this device is.One ranging conversation with one peer or accessory, obtained fromRanging.prepareSession(RangingRole).The handle one device publishes so another can range against it.The unit a distance is read in.One measurement of where the peer is, delivered toRangingListener.updated(RangingUpdate)on the EDT.