# android.net.wifi.rtt

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

# android.net.wifi.rtt

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/net/wifi/rtt/package-summary "View this page in Kotlin")\|Java

Provides classes which allow applications to use Wi-Fi RTT (IEEE 802.11mc) to measure distance to supporting Access Points and peer devices.

The primary entry point to Wi-Fi RTT capabilities is the[WifiRttManager](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager)class, which is acquired by calling[Context.getSystemService(Context.WIFI_RTT_RANGING_SERVICE)](https://developer.android.com/reference/android/content/Context#getSystemService(java.lang.String))

Some APIs may require the following user permissions:

- [ACCESS_WIFI_STATE](https://developer.android.com/reference/android/Manifest.permission#ACCESS_WIFI_STATE)
- [CHANGE_WIFI_STATE](https://developer.android.com/reference/android/Manifest.permission#CHANGE_WIFI_STATE)
- [ACCESS_FINE_LOCATION](https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION)

Usage of the API is also gated by the device's Location Mode: whether it permits Wi-Fi based location to be queried.

**Note:** Not all Android-powered devices support Wi-Fi RTT functionality. If your application only works with Wi-Fi RTT (i.e. it should only be installed on devices which support Wi-Fi RTT), declare so with a[`<uses-feature>`](https://developer.android.com/guide/topics/manifest/uses-feature-element)element in the manifest file:  

```
 <manifest ...>
     <uses-feature android:name="android.hardware.wifi.rtt" />
     ...
 </manifest>
 
```

Alternatively, if your application does not require Wi-Fi RTT but can take advantage of it if available, you can perform the check at run-time in your code using[hasSystemFeature(String)](https://developer.android.com/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String))with[FEATURE_WIFI_RTT](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_WIFI_RTT):  

```
     getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_RTT)
 
```

For an example of this functionality, see[Wi-Fi location: ranging with RTT](https://developer.android.com/guide/topics/connectivity/wifi-rtt).

## Classes

|-------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [CivicLocationKeys](https://developer.android.com/reference/android/net/wifi/rtt/CivicLocationKeys)                     | Civic Address key types used to define address elements.                                                                                                                                                                                                                                                                                                  |
| [PasnConfig](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig)                                   | Pre-association security negotiation (PASN) configuration.                                                                                                                                                                                                                                                                                                |
| [PasnConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder)                   | Builder for[PasnConfig](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig)                                                                                                                                                                                                                                                          |
| [RangingRequest](https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest)                           | Defines the ranging request to other devices.                                                                                                                                                                                                                                                                                                             |
| [RangingRequest.Builder](https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest.Builder)           | Builder class used to construct[RangingRequest](https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest)objects.                                                                                                                                                                                                                      |
| [RangingResult](https://developer.android.com/reference/android/net/wifi/rtt/RangingResult)                             | Ranging result for a request started by[WifiRttManager.startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback)](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)). |
| [RangingResult.Builder](https://developer.android.com/reference/android/net/wifi/rtt/RangingResult.Builder)             | Builder class used to construct[RangingResult](https://developer.android.com/reference/android/net/wifi/rtt/RangingResult)objects.                                                                                                                                                                                                                        |
| [RangingResultCallback](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback)             | Base class for ranging result callbacks.                                                                                                                                                                                                                                                                                                                  |
| [ResponderConfig](https://developer.android.com/reference/android/net/wifi/rtt/ResponderConfig)                         | Defines the configuration of an IEEE 802.11mc Responder.                                                                                                                                                                                                                                                                                                  |
| [ResponderConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/ResponderConfig.Builder)         | Builder class used to construct[ResponderConfig](https://developer.android.com/reference/android/net/wifi/rtt/ResponderConfig)objects.                                                                                                                                                                                                                    |
| [ResponderLocation](https://developer.android.com/reference/android/net/wifi/rtt/ResponderLocation)                     | ResponderLocation is both a Location Configuration Information (LCI) decoder and a Location Civic Report (LCR) decoder for information received from a Wi-Fi Access Point (AP) during Wi-Fi RTT ranging process.                                                                                                                                          |
| [SecureRangingConfig](https://developer.android.com/reference/android/net/wifi/rtt/SecureRangingConfig)                 | Secure ranging configuration.                                                                                                                                                                                                                                                                                                                             |
| [SecureRangingConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/SecureRangingConfig.Builder) | Builder for[SecureRangingConfig](https://developer.android.com/reference/android/net/wifi/rtt/SecureRangingConfig)                                                                                                                                                                                                                                        |
| [WifiRttManager](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager)                           | 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.                                                                                                                                                                                                       |

-

  ## Classes

  - [CivicLocationKeys](https://developer.android.com/reference/android/net/wifi/rtt/CivicLocationKeys)
  - [PasnConfig](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig)
  - [PasnConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/PasnConfig.Builder)
  - [RangingRequest](https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest)
  - [RangingRequest.Builder](https://developer.android.com/reference/android/net/wifi/rtt/RangingRequest.Builder)
  - [RangingResult](https://developer.android.com/reference/android/net/wifi/rtt/RangingResult)
  - [RangingResult.Builder](https://developer.android.com/reference/android/net/wifi/rtt/RangingResult.Builder)
  - [RangingResultCallback](https://developer.android.com/reference/android/net/wifi/rtt/RangingResultCallback)
  - [ResponderConfig](https://developer.android.com/reference/android/net/wifi/rtt/ResponderConfig)
  - [ResponderConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/ResponderConfig.Builder)
  - [ResponderLocation](https://developer.android.com/reference/android/net/wifi/rtt/ResponderLocation)
  - [SecureRangingConfig](https://developer.android.com/reference/android/net/wifi/rtt/SecureRangingConfig)
  - [SecureRangingConfig.Builder](https://developer.android.com/reference/android/net/wifi/rtt/SecureRangingConfig.Builder)
  - [WifiRttManager](https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager)