I have developed an application for Android, for storing user's GPS location.
One of my customers gave me his device and I noticed that sometimes the accuracy of the device is really bad and unbelievable. Sometimes the device returns points about 200 kilometers away from the actual location.
You can see this in the following GPS location samples for that device. You see that two points are about 200 km away from the real location.
The device is Samsung SM-T111 with Android 4.2.2, and I only use a GPS provider for getting locations (LocationManager.GPS_PROVIDER
).
I want to know what causes the problem, for this kind of inaccuracy?
I directly store the points received from the provider. This is my code in onLocationChanged
:
UPDATE
@Override
public void onLocationChanged(Location location) {
try {
if (location.getAccuracy() <= MAX_DISTANCE_TOLERANCE) {
gotLocation(new GPSLocation(location.getLatitude(),
location.getLongitude(), location.getTime(),
location.getAccuracy(),
location.getProvider(), location.getSpeed()));
}
} catch (Exception e) {
MessageBox.showExceptionToast(_context, e);
}
}
I want to know what can be the problem for this kind of inaccuracy?
Hardware/firmware, most likely. In other words, blame Samsung.
It's unlikely to be your app. Assuming that the accuracy values that you are getting for those failed points are within MAX_DISTANCE_TOLERANCE
, and assuming that MAX_DISTANCE_TOLERANCE
is less than 200km, you are faithfully using the data that you get. If that data is flawed, those flaws are coming from the system itself.
You could create a more adaptive filter. In addition to testing the accuracy for MAX_DISTANCE_TOLERANCE
, you could:
Location
for this)For example, your first bad fix comes 20 minutes after the previous one. Unless you think the device might travel at 600 km/hour, you would reject the bad fix as being unrealistic.
This algorithm will only work after you have a few consistent fixes. You might ask for rapid location updates for a few minutes, examine that data, throw out any outliers, then apply the "could the device really have travelled that far?" test for future fixes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With