Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid frequent location updates?

Tags:

android

gps

I am new to android. I want to get GPS locations at an interval of 3 minutes, but I'm getting location updates on every second.

How can I avoid this?

Please suggest something. I'm using the following code:

captureFrequencey=3*60*1000;    
LocationMngr.requestLocationUpdates(
    LocationManager.GPS_PROVIDER, captureFrequencey, 0, this);
like image 230
Sachin Suryavanshi Avatar asked Apr 17 '13 07:04

Sachin Suryavanshi


1 Answers

LocationMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, captureFrequencey, 0, this);

Thats because you set the minimum distance to 0. Change it to 100 meters and check!

LocationMngr.requestLocationUpdates(LocationManager.GPS_PROVIDER, captureFrequencey, 100, this);


Refer to the documentation.

like image 141
Lazy Ninja Avatar answered Oct 29 '22 15:10

Lazy Ninja