Android Pie Wifi RTT

Google launched Wi-Fi RTT feature with Android newely launched Android Pie version.


What is Wi-Fi RTT?

Wi-Fi RTT(Round-Trip-Time) is a part of the IEEE 802.11mc(iEEE_802.11mc) specification. This specification defines how to determine a device’s distance from peer devices and supporting Access Points. Given the location and distances from three(two or more) different WiFi Access Points(APs).

Benifits of Wi-Fi RTT

  • Indoor navigation
  • Smart home voice commands

How Does Wi-Fi RTT Work?

Deterime the device’s distance from supporting acces points using physics formula, distance = speed * time. Which can be used in the multilateration algorithm.

Requirements

  • The hardware of the device making the ranging request implement the 802.11mc FTM standard.
  • The access point implement the IEEE 802.11mc(iEEE_802.11mc) FTM standard.
  • The device making the ranging request must have Wi-Fi scanning turned on and location services enabled.
  • The app making the ranging request have the ACCESS_FINE_LOCATION permission(ACCESS_CORE_LOCATION, GPS HARDWARE).
  • The device making the ranging request be running Android Pie or later.

Setup
  • Add the below permissions in your app’s manifest
ACCESS_FINE_LOCATION
ACCESS_WIFI_STATE
CHANGE_WIFI_STATE
  • Add uses feature for this:
    android:name="android.hardware.wifi.rtt"
     
  • Check the Wi-Fi RTT support in your device
    context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI_RTT);
  • Check whether Wi-Fi RTT is available
    IntentFilter filter = new IntentFilter(WifiRttManager.ACTION_WIFI_RTT_STATE_CHANGED);
    myReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent)
             {
                 if (wifiRttManager.isAvailable()) {
                 }
                 else {
                 }
             }
         };
    context.registerReceiver(myReceiver, filter);
     
  • Ranging request is created by a list of Aps or wifi aware peers to which range is requested.
    RangingRequest.Builder requestBuilder = new RangingRequest.Builder();
    requestBuilder.addAccessPoint(ap1ScanResult);
    requestBuilder.addAccessPoint(ap2ScanResult);
    RangingRequest req = requestBuilder.build();
     
  • From here, you would then use the WifiRttManager you previously referenced to startRanging and within the callback’s onRangingResult(), you would then be able to access each of the AP’s RangingResult object.
    WifiRttManager mgr=(WifiRttManager)Context.getSystemService(Context.WIFI_RTT_RANGING_SERVICE);
    RangingRequest request ...;
        mgr.startRanging(request, executor, new RangingRequestCallback() {
         Override
         public void onRangingFailure(int code) { … }
         @Override
         public void onRangingResults(List<RangingResult> results) { … }
    });



    Use a multilateration algorithm to determine the location.


    Conclusion

    Wi-Fi Rtt is very useful for performing the realm of automation, indoor navigation, and smart home voice commands.We can get accurate location using Wi-Fi RTT(Indoor).

Comments

Popular posts from this blog

Multipeer Connectivity Framework in IOS

RxSwift : Introduction Benefits And its Uses