I would like to know how can I generate one location using the gps or network providers while the phone is not moving more then something like 10 meters which means you at home, or in the same place.
The minTime parameter doesn’t really matters I guess (speaking about the requestLocationUpdates method of course), the minDistance is the one that should make the diffrence.
I tried to set the value to 100m but I keep getting locations while my didn’t moved(maybe 1 meter.. was tested while I were sleeping) so I kept raising the value and I stoped in 500 meters!! since it became useless.
Maybe there is a way to check the distance between 2 locations?or receiving information about the phone movement?
Bear in mind that GPS precision is on the order of +/- 20 meters. That, plus possible fluctuations in the available satellite signals due to environmental conditions, means that there is going to be some amount of change in the reported position, even for a stationary device.
The only reason
minDistancewould not be working for you is if it is feeding you positions where the reported positions are less than the minimum distance you requested.LocationManagercan only work with the reported positions; it has no other way to determine whether or not the device is actually moving.If you examine the data you get in your
LocationListener, and you can demonstrate that the device is ignoring theminDistanceparameter, report the bug to your device manufacturer. If, on the other hand, the issue is that you are getting fixes because the GPS subsystem thinks the device is moving (and therefore the positions differ by more thanminDistance), that’s a limitation of GPS and your hardware, and there is nothing you can do about that.