Package com.codename1.nearby.ranging


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.