Wednesday, 16 September 2020

WiFi scan on Android

I have an app that is scanning Wi-Fi networks. When one Wi-Fi scan is finished I’m starting new one. I’m testing this on Pixel3 and SamsungS10 phones. On both phones I disabled Wi-Fi scan throttling from developer options. I do scans in the office where is a lot of different Wi-Fi networks. The problem that I’m observing, is that on Pixel3 Wi-Fi scans are working just fine for some time, then they start to returning scan errors for like a dozen consecutive scans and after that scans are working just fine again. This is happening periodically. The issue does not occur on SamsungS10 phones at all. Here is how I’m doing the scan:

wifiManager.startScan();

BroadcastReceiver wifiScanReceiver = new BroadcastReceiver() {
  @Override
  public void onReceive(Context c, Intent intent) {
    boolean success = intent.getBooleanExtra(
                       WifiManager.EXTRA_RESULTS_UPDATED, false);
    if (success) {
      scanSuccess();
    } else {
      scanFailure();
    }

    wifiManager.startScan();
  }
}; 

Any idea why Wi-Fi scan are working much worse on Pixel3 phones? Is there any way to get exact Wi-Fi scan error code / error message instead of simple boolean from boolean success = intent.getBooleanExtra(WifiManager.EXTRA_RESULTS_UPDATED, false); ?



from WiFi scan on Android

No comments:

Post a Comment