forked from upstream-mirrors/OpenTracks
Cleanup.
This commit is contained in:
@@ -33,10 +33,6 @@ public class LocationManagerConnector {
|
|||||||
private final Handler handler;
|
private final Handler handler;
|
||||||
private final LocationManager locationManager;
|
private final LocationManager locationManager;
|
||||||
|
|
||||||
private LocationListener requestLocationUpdates;
|
|
||||||
private float requestLocationUpdatesDistance;
|
|
||||||
private long requestLocationUpdatesTime;
|
|
||||||
|
|
||||||
public LocationManagerConnector(Context context, Looper looper) {
|
public LocationManagerConnector(Context context, Looper looper) {
|
||||||
this.handler = new Handler(looper);
|
this.handler = new Handler(looper);
|
||||||
|
|
||||||
@@ -55,10 +51,7 @@ public class LocationManagerConnector {
|
|||||||
@Override
|
@Override
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
public void run() {
|
public void run() {
|
||||||
requestLocationUpdatesTime = minTime;
|
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime, minDistance, locationListener);
|
||||||
requestLocationUpdatesDistance = minDistance;
|
|
||||||
requestLocationUpdates = locationListener;
|
|
||||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, requestLocationUpdatesTime, requestLocationUpdatesDistance, locationListener);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -70,6 +63,5 @@ public class LocationManagerConnector {
|
|||||||
*/
|
*/
|
||||||
public void removeLocationUpdates(final LocationListener locationListener) {
|
public void removeLocationUpdates(final LocationListener locationListener) {
|
||||||
locationManager.removeUpdates(locationListener);
|
locationManager.removeUpdates(locationListener);
|
||||||
requestLocationUpdates = null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,13 +80,13 @@ import de.dennisguse.opentracks.util.UnitConversions;
|
|||||||
public class TrackRecordingService extends Service {
|
public class TrackRecordingService extends Service {
|
||||||
|
|
||||||
// The name of extra intent property to indicate whether we want to resume a previously recorded track.
|
// The name of extra intent property to indicate whether we want to resume a previously recorded track.
|
||||||
public static final String RESUME_TRACK_EXTRA_NAME = "de.dennisguse.opentracks.RESUME_TRACK";
|
public static final String RESUME_TRACK_EXTRA_NAME = "RESUME_TRACK";
|
||||||
|
private static final int NOTIFICATION_ID = 123;
|
||||||
|
|
||||||
public static final double PAUSE_LATITUDE = 100.0;
|
public static final double PAUSE_LATITUDE = 100.0;
|
||||||
public static final double RESUME_LATITUDE = 200.0;
|
public static final double RESUME_LATITUDE = 200.0;
|
||||||
|
|
||||||
// Anything faster than that (in meters per second) will be considered moving.
|
// Anything faster than that (in meters per second) will be considered moving.
|
||||||
|
|
||||||
public static final double MAX_NO_MOVEMENT_SPEED = 0.224;
|
public static final double MAX_NO_MOVEMENT_SPEED = 0.224;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS = 3;
|
static final int MAX_AUTO_RESUME_TRACK_RETRY_ATTEMPTS = 3;
|
||||||
@@ -423,7 +423,7 @@ public class TrackRecordingService extends Service {
|
|||||||
.setSmallIcon(R.drawable.ic_logo_color_24dp)
|
.setSmallIcon(R.drawable.ic_logo_color_24dp)
|
||||||
.setCategory(Notification.CATEGORY_SERVICE)
|
.setCategory(Notification.CATEGORY_SERVICE)
|
||||||
.setWhen(System.currentTimeMillis());
|
.setWhen(System.currentTimeMillis());
|
||||||
startForeground(1, builder.build());
|
startForeground(NOTIFICATION_ID, builder.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user