-
-
Save virendersran01/82361e8bb66d62bf44cc195abcb871fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mRttBroadcastReceiver = new BroadcastReceiver() { | |
@Override public void onReceive(Context context, Intent intent) | |
{ | |
try | |
{ | |
for (ScanResult scanResult: mWifiManager.getScanResults()) | |
{ | |
if (scanResult.is80211mcResponder()) | |
{ | |
RangingRequest.Builder rB = new RangingRequest.Builder(); | |
rB.addAccessPoint(scanResult); | |
WifiRttManager rttManager = (WifiRttManager) mContext.getSystemService(Context.WIFI_RTT_RANGING_SERVICE); | |
RangingResultCallback callback = mCallback; // your callback is here | |
rttManager.startRanging(rangingRequestBuilder.build(), | |
mContext.getMainExecutor(), | |
callback); | |
} | |
} | |
} | |
catch (Throwable e) { } | |
} | |
}; | |
mContext.registerReceiver(mWifiBroadcastReceiver, newIntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment