As far as I understood from the previous posts, time for completing an active wifi scan (startScanActive()) should be around 0.7 s but on my phone it remains the same as for a passive scan (startScan ()). Also I can not see hidden SSIDs.Is there are any other way to get a wifi scan results and hidden SSIDs quicker?
Some background on active and passive scans:
Active scan scans all the non-passive channels actively by sending probe requests so the time spent on each channel is short. Passive scan is used generally for DFS channels where active scanning is not allowed and hence a device has to wait for one beacon interval to find all APs on that channel. Overall scanning passive channels should take more time than scanning active channels
In your case, you should be able to use in the android developer API reference to get scan results:
Request a scan for access points. Returns immediately. The availability of the
results is made known later by means of an asynchronous event sent on
completion of the scan.
To initiate a Wi-Fi scan, declare the Manifest.permission.CHANGE_WIFI_STATE
permission in the manifest, and perform these steps:
Invoke the following method: ((WifiManager)
getSystemService(WIFI_SERVICE)).startScan()
Register a BroadcastReceiver to listen to SCAN_RESULTS_AVAILABLE_ACTION.
When a broadcast is received, call: ((WifiManager)
getSystemService(WIFI_SERVICE)).getScanResults()
startScanActive
is not an exposed API in android reference. I recommend not using it. If you must use it, refer this - https://github.com/mozilla/MozStumbler/issues/40
Refs:
https://developer.android.com/reference/android/net/wifi/WifiManager#startScan() https://developer.android.com/reference/android/net/wifi/WifiManager#getScanResults() https://github.com/mozilla/MozStumbler/issues/40
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.