I want to check if the scan is complete before data logging. Is there any flag or function that checks wifi.startScan (), is complete or not, before registering data. Could you help me with the code.
Yes, a mechanism is provided for this. To achieve your goal, you need to implement BroadcastReceiver , which will listen to WiFi scans.
All you need to do is create a BroadcastReceiver with the corresponding IntentFilter . So you need this action for the filter:
WifiManager.SCAN_RESULTS_AVAILABLE_ACTION
This action means that the access point verification is complete and the results are available. And then just create a BroadcastReceiver (statically or dynamically, it doesn't matter).
If you do not know how to start, look at this tutorial:
source share