Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Hofmann committed May 22, 2023
2 parents 86acb1a + eee0db8 commit 6fee0a4
Showing 1 changed file with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ public IBinder onBind(Intent intent) {
return null;
}




@Override
public void onLocationChanged(Location location) {
//txtLat = (TextView) findViewById(R.id.textview1);
Expand All @@ -363,6 +366,11 @@ public void onLocationChanged(Location location) {
@Override
public void onProviderDisabled(String provider) {
Log.d("Latitude","disable");

//GPS is probably lost, so clear variables
loc_lat = 0d;
loc_lon = 0d;
loc_radius = 0;
}

@Override
Expand Down Expand Up @@ -398,35 +406,33 @@ public void onReceive(Context c, Intent intent) {

jobj.put("contributor", contributor);

JSONArray arrnetworks = new JSONArray();
JSONArray arrNetworks = new JSONArray();


for (ScanResult res : mScanResults) {
System.out.println(res);
JSONObject netobj = new JSONObject();
JSONObject netObj = new JSONObject();


netobj.put("bssid", res.BSSID);
netobj.put("essid", res.SSID);
netobj.put("signalstrenght", res.level);
netobj.put("frequency", res.frequency);
netobj.put("capabilities", res.capabilities);
netObj.put("bssid", res.BSSID);
netObj.put("essid", res.SSID);
netObj.put("signalstrenght", res.level);
netObj.put("frequency", res.frequency);
netObj.put("capabilities", res.capabilities);

arrnetworks.put(netobj);
arrNetworks.put(netObj);

}

jobj.put("networks", arrnetworks);


jobj.put("networks", arrNetworks);

if(loc_lat == 0 || loc_lon == 0){
//No Position found
}else{
if(wsclient.isOpen()){
wsclient.send(jobj.toString());
}
if(offlinemode){
}else if(!wsclient.isOpen() || offlinemode){
//Append to offline records, even if there is currently no connection
libfile.appendWifiRecord(getApplicationContext(), jobj);
}
}
Expand Down

0 comments on commit 6fee0a4

Please sign in to comment.