# Class RangingCapabilities

java.lang.Object
com.codename1.nearby.ranging.RangingCapabilities

public final class RangingCapabilities extends Object

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.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final RangingCapabilities`
  `UNSUPPORTED`
  All-false capabilities, returned by `Ranging.getCapabilities()` on a platform or device with no UWB at all.

- ## Constructor Summary

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

- ## Method Summary

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

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## 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`: precise distance measurement is available
    - `direction`: horizontal direction (azimuth) is available
    - `elevation`: vertical direction (elevation) is available
    - `cameraAssistance`: camera assistance can sharpen direction
    - `accessoryRanging`: third-party UWB accessories can be ranged
    - `backgroundRanging`: 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(byte[])`.

  - ### 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()
    Description copied from class: `Object`
    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())
    Overrides:
      `toString` in class `Object`