This commit is contained in:
jannis 2019-08-21 20:24:44 +02:00
parent 9e893c5fad
commit c708a8cc7e

View File

@ -64,7 +64,7 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
private static final double SIGNAL_BAD_THRESHOLD= 20; // In meters private static final double SIGNAL_BAD_THRESHOLD= 20; // In meters
private static final int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds private static final int SIGNAL_LOST_THRESHOLD= 10000; // In milliseconds
private Location lastFix; private Location lastFix= null;
private GpsStateChangedListener gpsStateChangedListener; private GpsStateChangedListener gpsStateChangedListener;
private GpsState gpsState= GpsState.SIGNAL_LOST; private GpsState gpsState= GpsState.SIGNAL_LOST;
@ -127,6 +127,9 @@ public class WorkoutRecorder implements LocationListener.LocationChangeListener
} }
private void checkSignalState(){ private void checkSignalState(){
if(lastFix==null){
return;
}
GpsState state; GpsState state;
if(System.currentTimeMillis() - lastFix.getTime() > SIGNAL_LOST_THRESHOLD){ if(System.currentTimeMillis() - lastFix.getTime() > SIGNAL_LOST_THRESHOLD){
state= GpsState.SIGNAL_LOST; state= GpsState.SIGNAL_LOST;