Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#constants) \| [Methods](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#inhmethods)

# WifiRttManager

*** ** * ** ***

` public class WifiRttManager `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.net.wifi.rtt.WifiRttManager |

<br />

*** ** * ** ***

This class provides the primary API for measuring distance (range) to other devices using the IEEE 802.11mc Wi-Fi Round Trip Time (RTT) technology.

The devices which can be ranged include:
- Access Points (APs)
- Wi-Fi Aware peers Ranging requests are triggered using `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#startRanging(android.net.wifi.rtt.RangingRequest,%20java.util.concurrent.Executor,%20android.net.wifi.rtt.RangingResultCallback)`. Results (in case of successful operation) are returned in the `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback#onRangingResults(java.util.List<android.net.wifi.rtt.RangingResult>)` callback.

  Wi-Fi RTT may not be usable at some points, e.g. when Wi-Fi is disabled. To validate that the functionality is available use the `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#isAvailable()` function. To track changes in RTT usability register for the `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED` broadcast. Note that this broadcast is not sticky - you should register for it and then check the above API to avoid a race condition.   

  Restricted for SDK Runtime environment in API level 34.

  ## Summary

  | ### Constants ||
  |---|---|
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED` Broadcast intent action to indicate that the state of Wi-Fi RTT availability has changed. |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_LCI` Bundle key to access if getting the Location Configuration Information(LCI) from responder is supported. |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_LCR` Bundle key to access if getting the Location Civic Report(LCR) from responder is supported. |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_NTB_INITIATOR` Bundle key to access if device supports to be a IEEE 802.11az non-trigger based initiator |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_ONE_SIDED_RTT` Bundle key to access if one-sided Wi-Fi RTT is supported. |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_RANGING_FRAME_PROTECTION_SUPPORTED` Bundle key to access if device supports ranging frame protection. |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_SECURE_HE_LTF_SUPPORTED` Bundle key to access if device supports secure HE-LTF (High Efficiency Long Training Field). |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_BOOLEAN_STA_RESPONDER` Bundle key to access if device supports to be a responder in station mode |
  | `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#CHARACTERISTICS_KEY_INT_MAX_SUPPORTED_SECURE_HE_LTF_PROTO_VERSION` Bundle key to access the maximum supported secure HE-LTF protocol version. |

  | ### Public methods ||
  |---|---|
  | ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#getRttCharacteristics()() ` Returns a Bundle which represents the characteristics of the Wi-Fi RTT interface: a set of parameters which specify feature support. |
  | ` boolean` | ` https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#isAvailable()() ` Returns the current status of RTT API: whether or not RTT is available. |
  | ` void` | ` https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#startRanging(android.net.wifi.rtt.RangingRequest,%20java.util.concurrent.Executor,%20android.net.wifi.rtt.RangingResultCallback)(https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback callback) ` Initiate a request to range to a set of devices specified in the `https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest`. |

  ### Inherited methods

  From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

  Creates and returns a copy of this object.
  ` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

  Indicates whether some other object is "equal to" this one.
  ` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

  Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
  ` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

  Returns the runtime class of this `Object`.
  ` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

  Returns a hash code value for the object.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

  Wakes up a single thread that is waiting on this object's monitor.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

  Wakes up all threads that are waiting on this object's monitor.
  ` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

  Returns a string representation of the object.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
  ` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

  Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

  ## Constants

  ### ACTION_WIFI_RTT_STATE_CHANGED

  Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String ACTION_WIFI_RTT_STATE_CHANGED
  ```

  Broadcast intent action to indicate that the state of Wi-Fi RTT availability has changed. Use the `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#isAvailable()` to query the current status. This broadcast is **not** sticky, use the `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#isAvailable()` API after registering the broadcast to check the current state of Wi-Fi RTT.

  Note: The broadcast is only delivered to registered receivers - no manifest registered components will be launched.

  <br />

  Constant Value: "android.net.wifi.rtt.action.WIFI_RTT_STATE_CHANGED"

  ### CHARACTERISTICS_KEY_BOOLEAN_LCI

  Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_LCI
  ```

  Bundle key to access if getting the Location Configuration Information(LCI) from responder is supported.

  <br />

  **See also:**
  - `https://developer.android.com/reference/android/net/wifi/rtt/ResponderLocation`

  Constant Value: "key_lci"

  ### CHARACTERISTICS_KEY_BOOLEAN_LCR

  Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_LCR
  ```

  Bundle key to access if getting the Location Civic Report(LCR) from responder is supported.

  <br />

  **See also:**
  - `https://developer.android.com/reference/android/net/wifi/rtt/ResponderLocation`

  Constant Value: "key_lcr"

  ### CHARACTERISTICS_KEY_BOOLEAN_NTB_INITIATOR

  Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_NTB_INITIATOR
  ```

  Bundle key to access if device supports to be a IEEE 802.11az non-trigger based initiator

  <br />

  Constant Value: "key_ntb_initiator"

  ### CHARACTERISTICS_KEY_BOOLEAN_ONE_SIDED_RTT

  Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_ONE_SIDED_RTT
  ```

  Bundle key to access if one-sided Wi-Fi RTT is supported. When it is not supported, only two-sided RTT can be performed, which requires responder supports IEEE 802.11mc and this can be determined by the method `https://developer.android.com/reference/android/net/wifi/ScanResult#is80211mcResponder()`

  <br />

  Constant Value: "key_one_sided_rtt"

  ### CHARACTERISTICS_KEY_BOOLEAN_RANGING_FRAME_PROTECTION_SUPPORTED

  Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_RANGING_FRAME_PROTECTION_SUPPORTED
  ```

  Bundle key to access if device supports ranging frame protection. IEEE 802.11az introduces Protected Management Frames for FTM (Fine Timing Measurement), adding a layer of encryption and integrity protection to these frames.

  <br />

  Constant Value: "key_rnm_mfp_supported"

  ### CHARACTERISTICS_KEY_BOOLEAN_SECURE_HE_LTF_SUPPORTED

  Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_SECURE_HE_LTF_SUPPORTED
  ```

  Bundle key to access if device supports secure HE-LTF (High Efficiency Long Training Field). Secure HE-LTF is a critical security enhancement in the IEEE 802.11az standard that aims to protect ranging measurements from spoofing and manipulation.

  <br />

  Constant Value: "key_secure_he_ltf_supported"

  ### CHARACTERISTICS_KEY_BOOLEAN_STA_RESPONDER

  Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_BOOLEAN_STA_RESPONDER
  ```

  Bundle key to access if device supports to be a responder in station mode

  <br />

  Constant Value: "key_sta_responder"

  ### CHARACTERISTICS_KEY_INT_MAX_SUPPORTED_SECURE_HE_LTF_PROTO_VERSION

  Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public static final String CHARACTERISTICS_KEY_INT_MAX_SUPPORTED_SECURE_HE_LTF_PROTO_VERSION
  ```

  Bundle key to access the maximum supported secure HE-LTF protocol version.

  <br />

  Constant Value: "key_max_supported_secure_he_ltf_proto_ver"

  ## Public methods

  ### getRttCharacteristics

  Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public Bundle getRttCharacteristics ()
  ```

  Returns a Bundle which represents the characteristics of the Wi-Fi RTT interface: a set of parameters which specify feature support. Each parameter can be accessed by the specified Bundle key, one of the `CHARACTERISTICS_KEY_*` value.

  May return an empty Bundle if the Wi-Fi RTT service is not initialized.   

  Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE`

  <br />

  | Returns ||
  |---|---|
  | `https://developer.android.com/reference/android/os/Bundle` | A Bundle specifying feature support of RTT. This value cannot be `null`. <br /> |

  ### isAvailable

  Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public boolean isAvailable ()
  ```

  Returns the current status of RTT API: whether or not RTT is available. To track changes in the state of RTT API register for the `https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager#ACTION_WIFI_RTT_STATE_CHANGED` broadcast.

  Note: availability of RTT does not mean that the app can use the API. The app's permissions and platform Location Mode are validated at run-time.

  <br />

  | Returns ||
  |---|---|
  | `boolean` | A boolean indicating whether the app can use the RTT API at this time (true) or not (false). <br /> |

  ### startRanging

  Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

  ```
  public void startRanging (RangingRequest request, 
                  Executor executor, 
                  RangingResultCallback callback)
  ```

  Initiate a request to range to a set of devices specified in the `https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest`. Results will be returned in the `https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback` set of callbacks.

  Ranging request with only Wifi Aware peers can be performed with either `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES` with android:usesPermissionFlags="neverForLocation", or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`. All other types of ranging requests require `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`.   

  Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` and `https://developer.android.com/reference/android/Manifest.permission#CHANGE_WIFI_STATE` and `https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE` and `https://developer.android.com/reference/android/Manifest.permission#NEARBY_WIFI_DEVICES`

  <br />

  | Parameters ||
  |---|---|
  | `request` | `RangingRequest`: A request specifying a set of devices whose distance measurements are requested. This value cannot be `null`. <br /> |
  | `executor` | `Executor`: The Executor on which to run the callback. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
  | `callback` | `RangingResultCallback`: A callback for the result of the ranging request. This value cannot be `null`. <br /> |