Commit 1d72a53d authored by Chris Scott's avatar Chris Scott

Move initial call to setPace in onStartCommand out if if(intent) {} block. ...

Move initial call to setPace in onStartCommand out if if(intent) {} block.  This may have been causing major issues where tracking fails to start after OS kills service due to lack of memory.  Also return START_REDELIVER_INTENT, which also may have been causing problems
parent 7da0878b
......@@ -58,7 +58,7 @@ public class LocationUpdateService extends Service implements LocationListener {
private Location lastLocation;
private long lastUpdateTime = 0l;
private String authToken = "HypVBMmDxbh76pHpwots";
private String authToken = "FAKE_TOKEN";
private String url = "http://192.168.2.15:3000/users/current_location.json";
private float stationaryRadius;
......@@ -73,10 +73,10 @@ public class LocationUpdateService extends Service implements LocationListener {
private Integer stationaryLocationAttempts = 0;
private Integer speedAcquisitionAttempts = 0;
private Integer desiredAccuracy;
private Integer distanceFilter;
private Integer desiredAccuracy = 100;
private Integer distanceFilter = 30;
private Integer scaledDistanceFilter;
private Integer locationTimeout;
private Integer locationTimeout = 30;
private Boolean isDebugging;
private ToneGenerator toneGenerator;
......@@ -141,7 +141,7 @@ public class LocationUpdateService extends Service implements LocationListener {
desiredAccuracy = Integer.parseInt(intent.getStringExtra("desiredAccuracy"));
locationTimeout = Integer.parseInt(intent.getStringExtra("locationTimeout"));
isDebugging = Boolean.parseBoolean(intent.getStringExtra("isDebugging"));
}
Log.i(TAG, "- url: " + url);
Log.i(TAG, "- token: " + authToken);
Log.i(TAG, "- stationaryRadius: " + stationaryRadius);
......@@ -151,7 +151,6 @@ public class LocationUpdateService extends Service implements LocationListener {
Log.i(TAG, "- isDebugging: " + isDebugging);
this.setPace(false);
}
/**
* Experimental cell-location-change handler. Hoping to implement something like ios Significant Changes system
*
......@@ -161,7 +160,7 @@ public class LocationUpdateService extends Service implements LocationListener {
*/
//We want this service to continue running until it is explicitly stopped
return START_STICKY;
return START_REDELIVER_INTENT;
}
@Override
......@@ -347,7 +346,7 @@ public class LocationUpdateService extends Service implements LocationListener {
private Integer calculateDistanceFilter(Float speed) {
Double newDistanceFilter = (double) distanceFilter;
if (speed > 3 && speed < 100) {
if (speed < 100) {
float roundedDistanceFilter = (round(speed / 5) * 5);
newDistanceFilter = pow(roundedDistanceFilter, 2) + (double) distanceFilter;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment