fused location API sometimes returns freak values, how to identify and discard

Viewed 147

I'm developing an app that tracks walks, bicycle rides, car rides etc. I need precise info, so I basically would like to use only GPS. Still most sources I found recommend using Googles fused API e.g. for power saving reasons, so I went for the fused API. Now once in a while (once or twice a month) I get one freak value among thousands of good ones. a few of them I got near railway stations, where the freak value is at another railway station, several kilometers away, so I assume it is a wrong interpreted WiFi based position.

Here's one example, where I ride my bicycle from the river towards the main railway station located east of the river. Once I arrive at the main station, I get no position for 126 s (I asked for every 10 sec, so I probably lost the GPS signal), and then suddenly I get a freak GPS value at another railway station 3450m away on the other side of the river. The reported accuracy for the freak value is 20 m.

enter image description here

The problem is that I cannot easily identify and filter these freak values.

Calling currentLocation.getProvider() always returns "fused", which is not very helpful. Also Location.getAccuracy() returns typical values below 100m.

So today I filter based on evaluating speed combined with unrealistic changes in bearing, but I'm afraid I might also discard good samples in the process.


I scanned a lot of Stackoverflow, but strangely enough I didn't find any relevant answers yet. I now feel like moving to the old framework location API and use GPS based data only. But is that really necessary, or does anybody have an idea how to avoid getting the freak values, or alternatively how to easily identify and discard all wifi based positions? And will using the framework location API have bad battery life as a result?

0 Answers
Related