Gps - Geo-location points android and Accuracy

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have a very complicated problem and hope anyone can help me

I am building android application that track user movement in some specific predefined points, and I want to report the arrival and leaving of user to and from these points.

The problem is I am using distanceTo method to get the distance between current user place and location come from location service, to be able to know if the user arrive or left

but the accuracy is a big problem here, some times it is "10" and some other times it is "60" based on the best provider of my gps service, so the user is reporting arrive and leave many times from the same place.

Can any one help me ??

Answers

Using location.GetAccuracy() is a good way to go about it. You can filter out gps data that doesn t meet your requirements. Please note that getting 10 meter accuracy all the time is highly unlikely, in my experience 10 meters is about the best you can get. Do it like this:

@Override
public void onLocationChanged(Location location) {
    if (location != null) {
        // discard any location greater than 20 meters
        if (location.getAccuracy() < 20.0f) {
            // use your location data here
        }
    }
}

You can see a full working sample in my open source Gps Tracker project:

https://github.com/nickfox/GpsTracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java https://github.com/nickfox/GpsTracker/blob/master/phoneClients/android/app/src/main/java/com/websmithing/gpstracker/LocationService.java

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/27224474/geo-location-points-android-and-accuracy

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils