From baf7a99d5b15cffce29c710e4fa90b78c9d0f40c Mon Sep 17 00:00:00 2001 From: mendhak Date: Fri, 7 Jul 2023 19:30:58 +0100 Subject: [PATCH] Allow passive locations, but check that its time is greater than any previous time Issue #1059 --- .../java/com/mendhak/gpslogger/GpsLoggingService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java index a47b785a4..777472069 100644 --- a/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java +++ b/gpslogger/src/main/java/com/mendhak/gpslogger/GpsLoggingService.java @@ -836,6 +836,14 @@ void onLocationChanged(Location loc) { return; } + // Even if it's a passive location, the time should be greater than the previous location's time. + if(isPassiveLocation && session.getPreviousLocationInfo() != null && loc.getTime() <= session.getPreviousLocationInfo().getTime()){ + LOG.debug("Passive location time: " + loc.getTime() + ", previous location's time: " + session.getPreviousLocationInfo().getTime()); + LOG.debug("Passive location received, but its time was less than the previous point's time."); + return; + } + + //Don't log a point if user has been still // However, if user has set an annotation, just log the point, disregard time and distance filters if(userHasBeenStillForTooLong()) {