Question: I'm writing some tracking app for android at the moment and would like to use the onLocationChanged() method to receive updates.

Now i want to receive updates every once in a while, even if the location itself did not change, so i know the tracking device is still alive etc.

It seems like onLocationChanged will only be triggered if the actual coordinates change, the timestamp alone does not suffice.

I've worked my way around this by polling LocationManager.getLastKnownLocation( LocationManager.GPS\_PROVIDER ) every x-seconds and not using onLocationChanged. 

I'm afraid though, that this is not the most effective method.

I could imagine some mechanism that would send updates every 30secs while the vehicle is moving and every 10minutes if it's not (to get some heartbeat).

Any ideas?

Thanks!

Answer: 
Simply have a Thread that sleeps for 10 minutes but is interrupted when the location change is fired by the locationListener. When the thread wakes up it does it's stuff.

So have a thread that contains a method like this

```
void myUpdateMethod() {
 while (!shutdown) {
  try {
   Thread.sleep(1000 * 60 * 10);
  } catch (InterruptedException e) { }
  .. do update stuff here
 } 
}

```

and your listener would look like this

```
onLocationChanged(Location location) {
 otherThread.interrupt();
}

```

And now you're guaranteed to get an update at least every 10 minutes, or sooner if an update is received. Although the caveat here is you can't use interrupt alone to shutdown the other thread.
You can set time interval and minimun update distance in registration of Location listener method. So just put 0 to distance changes.