tags:

views:

85

answers:

1

I have successfully been getting GPS data through the registerLocationListener() and onLocationChanged() methods. The only problem with this is that the speed reading of my app freezes if there is no more GPS data (e.g. when I go indoors, enter a tunnel, etc). The behavior I want for my app is that the user is somehow notified that the speed reading is probably not accurate due to a lack of fresh data (set speed to zero, blink the speed reading, etc).

How can I do that? I though of checking periodically whether the GPS unit was detecting any satellites, but I'm not sure how to force periodic checks.

+3  A: 

Maybe you could just start a periodic timer. If timer sees that last GPS fix is old it displays notification. Application should remember when the last fix was.

Fedor
This is pretty much what I ended up doing after an unsuccessful attempt at using GpsStatus.getSatellites() and GpsSatellite.usedInFix(). Whenever I get a new Location object in my LocationListener, I set a timestamp with System.currentTimeMillis() and then compare the time each time I receive an update in my GpsStatus.Listener. It's primitive, but so far it's the only solution I found that works...
Chris Dickinson