Gps location service onlocationchange distance calculation way off the mark for android

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I asked a similar question about a year ago and was given some good advice (to use location.getAccuracy() ) and if the accuracy is under some threshold, not handle the location change. This worked well on my phone at the time but my new phone is all over the map (no pun intended) in terms of receiving location updates. Unfortunately, they are not very accurate and so if I look for an accuracy value of say, less than 7 meters, my logic inside the onlocationchanged handler isn t reached. As a result, when the points are plotted on my google map, it catches some and then draws a straight line over some terrain on my hike that I would love to be able to cover, but I m pretty sure that not even Superman could. What really bothers me though is the fact that my distance calculation is significantly shorter than it really should be (which is obvious because it thinks I m able to fly directly from point A to point B).

I tried to resolve this by keeping a tally of each time the location changed handler was called but didn t meet my threshold and if that tally reaches 20, log the point anyway then reset the counter. This got me a little closer to the actual distance, but still isn t very accurate. I ve changed that value to 30, and 40 etc but it seems silly that I d have to keep tweaking that to find a sweet spot for this one phone specifically. As a control test, I installed MapMyRun and its distance calculation is spot on and it is only using GPS location services as well.

I m at a loss of what else I can do to get my distance calculations to be more accurate. It obviously can be done because MapMyRun works just fine.

Anyone have some suggestions as to other ideas to try?

TIA

Answers

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/31972392/gps-location-service-onlocationchange-distance-calculation-way-off-the-mark-fo

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils