public final class RangingCapabilities

  1. Object
  2. RangingCapabilities

What the current device can actually measure. Ask this before building a UI: a device may support distance but not direction, which is the common case on Android hardware and on any iPhone whose peer is behind it.

UNSUPPORTED is an all-false instance returned where ranging is absent, so calling code needs no null check.

Fields

public static final RangingCapabilities UNSUPPORTEDAll-false capabilities, returned by Ranging.getCapabilities() on a platform or device with no UWB at all.

Constructors

public RangingCapabilities(boolean distance, boolean direction, boolean elevation, boolean cameraAssistance, boolean accessoryRanging, boolean backgroundRanging)Ports construct this; application code reads it from Ranging.getCapabilities().

Methods

public boolean isDistanceSupported()true when the device can measure distance to a peer.
public boolean isDirectionSupported()true when the device can report the horizontal direction to a peer.
public boolean isElevationSupported()true when the device can report elevation as well as azimuth.
public boolean isCameraAssistanceSupported()true when the platform can use the camera to converge on a sharper direction.
public boolean isAccessoryRangingSupported()true when third-party UWB accessories can be ranged, as opposed to only other phones.
public boolean isBackgroundRangingSupported()true when a session may keep delivering updates while the app is in the background.
public String toString()Returns a string representation of the object.

Inherited methods

Field details

UNSUPPORTED

public static final RangingCapabilities UNSUPPORTED
All-false capabilities, returned by Ranging.getCapabilities() on a platform or device with no UWB at all.

Constructor details

RangingCapabilities

public RangingCapabilities(boolean distance, boolean direction, boolean elevation, boolean cameraAssistance, boolean accessoryRanging, boolean backgroundRanging)
Ports construct this; application code reads it from Ranging.getCapabilities().

Parameters

distance boolean
precise distance measurement is available
direction boolean
horizontal direction (azimuth) is available
elevation boolean
vertical direction (elevation) is available
cameraAssistance boolean
camera assistance can sharpen direction
accessoryRanging boolean
third-party UWB accessories can be ranged
backgroundRanging boolean
a session may keep running in the background

Method details

isDistanceSupported

public boolean isDistanceSupported()
true when the device can measure distance to a peer. This is the baseline capability: a device that answers false here has no usable UWB radio and Ranging.isSupported() will also be false.

isDirectionSupported

public boolean isDirectionSupported()
true when the device can report the horizontal direction to a peer. Both platforms only produce a direction while the peer is roughly in front of the device, so an update may still omit it – always check RangingUpdate.hasDirection() as well.

isElevationSupported

public boolean isElevationSupported()
true when the device can report elevation as well as azimuth.

isCameraAssistanceSupported

public boolean isCameraAssistanceSupported()
true when the platform can use the camera to converge on a sharper direction. iOS only, and only while an AR session is running; the Codename One API does not turn it on by itself.

isAccessoryRangingSupported

public boolean isAccessoryRangingSupported()
true when third-party UWB accessories can be ranged, as opposed to only other phones. See RangingSession.startAccessory.

isBackgroundRangingSupported

public boolean isBackgroundRangingSupported()
true when a session may keep delivering updates while the app is in the background. On iOS this additionally requires the com.apple.developer.nearby-interaction entitlement, which Codename One never injects on its own – see the developer guide.

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())