mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-08 20:33:06 +02:00
Change MyTracksMapFragment to not listen to location changes.
This commit is contained in:
@@ -31,6 +31,8 @@ import java.util.Stack;
|
||||
*/
|
||||
public class LocationUtils {
|
||||
|
||||
private static final long MAX_LOCATION_AGE_MS = 60 * 1000; // 1 minute
|
||||
|
||||
private LocationUtils() {}
|
||||
|
||||
/**
|
||||
@@ -159,4 +161,14 @@ public class LocationUtils {
|
||||
return location != null && Math.abs(location.getLatitude()) <= 90
|
||||
&& Math.abs(location.getLongitude()) <= 180;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a location is old.
|
||||
*
|
||||
* @param location the location
|
||||
*/
|
||||
public static boolean isLocationOld(Location location) {
|
||||
return !LocationUtils.isValidLocation(location)
|
||||
|| (System.currentTimeMillis() - location.getTime() > MAX_LOCATION_AGE_MS);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user