Stay organized with collections
Save and categorize content based on your preferences.
android.net.wifi.rtt
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
class, which is acquired by calling
Context.getSystemService(Context.WIFI_RTT_RANGING_SERVICE)
Some APIs may require the following user permissions:
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>
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)
with FEATURE_WIFI_RTT
:
getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_RTT)
For an example of this functionality, see
Wi-Fi location: ranging
with RTT.
Classes
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-03-13 UTC.
[null,null,["Last updated 2025-03-13 UTC."],[],[],null,["# android.net.wifi.rtt\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nandroid.net.wifi.rtt\n====================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/net/wifi/rtt/package-summary \"View this page in Kotlin\") \\|Java\n\nProvides classes which allow applications to use Wi-Fi RTT (IEEE 802.11mc) to measure distance\nto supporting Access Points and peer devices.\n\nThe primary entry point to Wi-Fi RTT capabilities is the\n[WifiRttManager](/reference/android/net/wifi/rtt/WifiRttManager) class, which is acquired by calling\n[Context.getSystemService(Context.WIFI_RTT_RANGING_SERVICE)](/reference/android/content/Context#getSystemService(java.lang.String))\n\nSome APIs may require the following user permissions:\n\n- [ACCESS_WIFI_STATE](/reference/android/Manifest.permission#ACCESS_WIFI_STATE)\n- [CHANGE_WIFI_STATE](/reference/android/Manifest.permission#CHANGE_WIFI_STATE)\n- [ACCESS_FINE_LOCATION](/reference/android/Manifest.permission#ACCESS_FINE_LOCATION)\n\nUsage of the API is also gated by the device's Location Mode: whether it permits Wi-Fi based\nlocation to be queried.\n\n**Note:** Not all Android-powered devices support Wi-Fi RTT\nfunctionality.\nIf your application only works with Wi-Fi RTT (i.e. it should only be installed on devices which\nsupport Wi-Fi RTT), declare so with a [`\u003cuses-feature\u003e`](/guide/topics/manifest/uses-feature-element)\nelement in the manifest file: \n\n```\n \u003cmanifest ...\u003e\n \u003cuses-feature android:name=\"android.hardware.wifi.rtt\" /\u003e\n ...\n \u003c/manifest\u003e\n \n```\n\nAlternatively, if your application does not require Wi-Fi RTT but can take advantage of it if\navailable, you can perform\nthe check at run-time in your code using [hasSystemFeature(String)](/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String)) with [FEATURE_WIFI_RTT](/reference/android/content/pm/PackageManager#FEATURE_WIFI_RTT): \n\n```\n getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_RTT)\n \n```\n\nFor an example of this functionality, see\n[Wi-Fi location: ranging\nwith RTT](/guide/topics/connectivity/wifi-rtt).\n\nClasses\n-------\n\n|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [CivicLocationKeys](/reference/android/net/wifi/rtt/CivicLocationKeys) | Civic Address key types used to define address elements. |\n| [PasnConfig](/reference/android/net/wifi/rtt/PasnConfig) | Pre-association security negotiation (PASN) configuration. |\n| [PasnConfig.Builder](/reference/android/net/wifi/rtt/PasnConfig.Builder) | Builder for [PasnConfig](/reference/android/net/wifi/rtt/PasnConfig) |\n| [RangingRequest](/reference/android/net/wifi/rtt/RangingRequest) | Defines the ranging request to other devices. |\n| [RangingRequest.Builder](/reference/android/net/wifi/rtt/RangingRequest.Builder) | Builder class used to construct [RangingRequest](/reference/android/net/wifi/rtt/RangingRequest) objects. |\n| [RangingResult](/reference/android/net/wifi/rtt/RangingResult) | Ranging result for a request started by [WifiRttManager.startRanging(RangingRequest, java.util.concurrent.Executor, RangingResultCallback)](/reference/android/net/wifi/rtt/WifiRttManager#startRanging(android.net.wifi.rtt.RangingRequest,%20java.util.concurrent.Executor,%20android.net.wifi.rtt.RangingResultCallback)). |\n| [RangingResult.Builder](/reference/android/net/wifi/rtt/RangingResult.Builder) | Builder class used to construct [RangingResult](/reference/android/net/wifi/rtt/RangingResult) objects. |\n| [RangingResultCallback](/reference/android/net/wifi/rtt/RangingResultCallback) | Base class for ranging result callbacks. |\n| [ResponderConfig](/reference/android/net/wifi/rtt/ResponderConfig) | Defines the configuration of an IEEE 802.11mc Responder. |\n| [ResponderConfig.Builder](/reference/android/net/wifi/rtt/ResponderConfig.Builder) | Builder class used to construct [ResponderConfig](/reference/android/net/wifi/rtt/ResponderConfig) objects. |\n| [ResponderLocation](/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. |\n| [SecureRangingConfig](/reference/android/net/wifi/rtt/SecureRangingConfig) | Secure ranging configuration. |\n| [SecureRangingConfig.Builder](/reference/android/net/wifi/rtt/SecureRangingConfig.Builder) | Builder for [SecureRangingConfig](/reference/android/net/wifi/rtt/SecureRangingConfig) |\n| [WifiRttManager](/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. |\n\n-\n\n Classes\n -------\n\n - [CivicLocationKeys](/reference/android/net/wifi/rtt/CivicLocationKeys)\n - [PasnConfig](/reference/android/net/wifi/rtt/PasnConfig)\n - [PasnConfig.Builder](/reference/android/net/wifi/rtt/PasnConfig.Builder)\n - [RangingRequest](/reference/android/net/wifi/rtt/RangingRequest)\n - [RangingRequest.Builder](/reference/android/net/wifi/rtt/RangingRequest.Builder)\n - [RangingResult](/reference/android/net/wifi/rtt/RangingResult)\n - [RangingResult.Builder](/reference/android/net/wifi/rtt/RangingResult.Builder)\n - [RangingResultCallback](/reference/android/net/wifi/rtt/RangingResultCallback)\n - [ResponderConfig](/reference/android/net/wifi/rtt/ResponderConfig)\n - [ResponderConfig.Builder](/reference/android/net/wifi/rtt/ResponderConfig.Builder)\n - [ResponderLocation](/reference/android/net/wifi/rtt/ResponderLocation)\n - [SecureRangingConfig](/reference/android/net/wifi/rtt/SecureRangingConfig)\n - [SecureRangingConfig.Builder](/reference/android/net/wifi/rtt/SecureRangingConfig.Builder)\n - [WifiRttManager](/reference/android/net/wifi/rtt/WifiRttManager)"]]