I’m trying to resolve a small problem:
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 120000, 0, mLocationListener);
So I assumed that mLocationListener should wait for 2 mainutes before calling it’s onLocationChanged method. However, the method is called right after I send geo fix updates to emulator, every time I do it. Did I misunderstand the android developers guide, and do I have to to use timers or anything similar for organizing update rate I need?
Well after some research and meditation 🙂 I’ve come up with something like this: a service that can run in two modes (depending on the listenPeriod variable): 1) simply process coordinates once and shut self down afterwards (listenPeriod=0); 2) and process coordinates with specified rate (listenPeriod>0) until the service will be shut down.
So I have to initialize the listenPeriod variable before I start my service. And the service part looks like this:
}
and implementation of LocationListener:
}
I hope it will help someone…)
P.S. thanks to Dave MacLean and EboMike!; and feel free to ask questions;)