Double check GPS Lost
This commit is contained in:
parent
72f73faaec
commit
d146f1f140
2 changed files with 11 additions and 3 deletions
|
@ -183,7 +183,8 @@ public class NavigationService extends Service implements LocationListener {
|
|||
Message msg = Message.obtain(handler, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (routingHelper.getLeftDistance() > 0 && !settings.MAP_ACTIVITY_ENABLED.get()) {
|
||||
if (routingHelper.getLeftDistance() > 0 && !settings.MAP_ACTIVITY_ENABLED.get() &&
|
||||
!handler.hasMessages(LOST_LOCATION_MSG_ID)) {
|
||||
routingHelper.getVoiceRouter().gpsLocationLost();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -738,7 +738,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
}
|
||||
}
|
||||
|
||||
public void setLocation(Location location){
|
||||
public void setLocation(final Location location){
|
||||
if(Log.isLoggable(LogUtil.TAG, Log.DEBUG)){
|
||||
Log.d(LogUtil.TAG, "Location changed " + location.getProvider()); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -772,7 +772,14 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
|
|||
// Check with delay that gps location is not lost
|
||||
if(location != null && routingHelper.getLeftDistance() > 0){
|
||||
Message msg = Message.obtain(uiHandler, new Runnable() {
|
||||
@Override public void run() {
|
||||
@Override
|
||||
public void run() {
|
||||
long fixTime = location.getTime();
|
||||
Location lastKnown = getLastKnownLocation();
|
||||
if(lastKnown != null && lastKnown.getTime() - fixTime < LOST_LOCATION_CHECK_DELAY) {
|
||||
// false positive case, still strange how we got here with removeMessages
|
||||
return;
|
||||
}
|
||||
if (routingHelper.getLeftDistance() > 0 && settings.MAP_ACTIVITY_ENABLED.get()) {
|
||||
routingHelper.getVoiceRouter().gpsLocationLost();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue