I'm writing an android application which purpouse is to determine the user position via a wifi fingerprint, and in order to do that i need to get really frequent (as frequent as possible) scansions of present networks but I've found time limitations to do that.
In fact, no matter what, I can get a new scan roughtly every second and I was wondering if there could be a way to speed things up.
Past questions on the topic (as this one Android, wifi active scans) were not really useful.
here's the code:
public class WiFiScanReceiver extends BroadcastReceiver {
private static final String TAG = "WiFiScanReceiver";
private Main parent;
private ScanResult storedBest;
private String actualFileName;
private int nOfScans;
private long initialTime;
private FileSaver fs;
public WiFiScanReceiver(Main wifiDemo) {
super();
this.parent = wifiDemo;
storedBest = null;
actualFileName ="";
nOfScans = 0;
fs = new FileSaver(parent);
}
@Override
public void onReceive(Context c, Intent intent) {
List<ScanResult> results = parent.getWifiManager().getScanResults();
ScanResult bestSignal = null;
if(parent.isRecording()&& actualFileName!=""){
//Getting the fingerprint
}
if (parent.isRecording()) nOfScans ++;
parent.getWifiManager().startScan();
Log.d(TAG, "onReceive() message: " + message);
}
//VARIOUS GETTERs AND SETTERs
}