1

I'm developing an app that capture user latitude and longitude for every 60 seconds and calculate the distance travelled by user. Sometime my phone is at the same location for more than one hour but the GPS jumps to different location that leads to wrong distance calculation.

How to reduce the gps jump and improve distance accuracy?

Saravana
  • 81
  • 1
  • 8
  • The GPS jumps are dependent on the quality of GPS antenna your phone is using. That means, better the Phone better will be its GPS antenna and hence better will be the accuracy. Else You can use some logic for distance calculation but that will cost you delay. – Rudra Jan 12 '17 at 06:44

2 Answers2

0

The accuracy of GPS will not be uniform across the session. But there are means to overcome this. Even if user is not changing the location, still the latitide , longitude value will differ in successive periods. Check out the following way how to modify these anomaly.

// for location updates
private int locationupdate = 8000; //in milliseconds
private int locationdistance = 10; // in meters

While creating a location request, mention the setSmallestDisplacement as well as setInterval as per your requirement as shown below

protected void createLocationRequest() {
    locationRequest = new LocationRequest();
    locationRequest.setInterval(locationupdate); //in milliseconds
    locationRequest.setFastestInterval(5000); //in milliseconds
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    locationRequest.setSmallestDisplacement(locationdistance);
}

Check out this link for more information

Sreehari
  • 5,621
  • 2
  • 25
  • 59
0

You have to check the location accuracy if not's good enough don't use it.

can't find the exact current location in android

Community
  • 1
  • 1
danny117
  • 5,581
  • 1
  • 26
  • 35