I created an application that sends every 1 min the phone location (using the GPS satellite) to my mysql db.
One location might give you diffrent result sometimes for example st. x # 5 or st. x # 2-8.
That’s a problem for me because if I stay in the same location for 12 hours (while sleeping) my db will be flooded with locations that are almost the same.
My question is how I avoid that and in the whole 12 hours I will get a single location and if it possible the most accurate(less important).. maybe there is an option to check if the phone is moving?and if not to stop the tracking?
As suggested by Android developers like this
by using min distance in the
requestLocationUpdate()method.To determine the min distance you could evaluate the accuracy of the last location and set the threshold to 1,5 times the accuracy.
In addition you can set a
minTimedepending on how often you want a location update. And there is a tutorial with code.http://developer.android.com/guide/topics/location/strategies.html#BestEstimate
where you can determine wether the current location is better than the new location and only
then send it to the server.