GPS update frequency

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

GPS update frequency

Postby baal00 » Tue Oct 13, 2009 2:53 am

Hi folks,

I'm working on a research project which uses Android as control and computation platform and predicts when a user returns home. To actually achieve a high location-prediction accuracy I need frequent location updates. As GPS is of course not exactly good for long stand-by time I implemented a method which changes the frequency of the location updates based on the movement of the mobile phone. Meaning if the user moves for more than a minute, which would indicate movement of the user, the locationEventListener is queried every minute and GPS is used if available. If the phone is not moved the update frequency goes up to 5 minutes and the network provider is used.

To change the frequency I use the removeUpdates method of the LocationManager:

Code: Select all
locationManager.requestLocationUpdates(provider, 60000, 0, locationEventListener);

In the debug console of Eclipse I see that adding and removing of the EventListener works quite well and the long update cycle too, but I have troubles with the short update cycle which uses GPS. Instead of querying the GPS every minute it's doing it every second or so. (I see the nice flashing GPS symbol) This of course puts quite a strain on the battery, so that my study participants only get about 8 hrs out of their phone.

Did anyone had similar problems in the past? And is my way of removing and adding the EventListener possible at all or do I maybe create some strange side-effects with it?

Thanks for your help,
Posts: 5
Joined: Mon Jun 08, 2009 6:10 pm
Location: Pittsburgh


Postby nypfyp » Mon Nov 09, 2009 4:15 am

try this.

LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 5000, 500.0f, this);
Posts: 2
Joined: Fri Nov 06, 2009 7:07 am


Return to Map Problems

Who is online

Users browsing this forum: No registered users and 3 guests