0

In my app, I need to keep track of the user location. To do so, I'm using FusedLocation, from which, I'm asking the location every 10s. Unfortunately, the location that is return has a accuracy of 500.0 meter or 164O feet. In the Android FusedLocation doc, it is stipulate that

location updates that are accurate to within a few feet

My request is set to :

    LocationRequest locationRequest = new LocationRequest();
    locationRequest.setSmallestDisplacement(10);
    locationRequest.setInterval(30000); // 30 s 
    locationRequest.setFastestInterval(10000); // 10 s
    locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);

Also, I'm asking the permission of both coarse and fine location.

How can I get a better accuracy ?

AskNilesh
  • 67,701
  • 16
  • 123
  • 163
Franck CHEN
  • 171
  • 6

1 Answers1

0

May be you can try asking the location form the NETWORK_PROVIDER this helped me fixing my problem with the user last known location.

Here is how i handled it:

LocationManager locationManager;
locationManager = (LocationManager)this.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, locationListener);
Location lastKnownLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
LatLng userLocation = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
General Grievance
  • 4,555
  • 31
  • 31
  • 45
  • I'm using the Google Play services instead of the Android framework location since more performant ( location and battery ). Using the Network-provider does provide a better accuracy (using locationRequest) but I don't necessary have a network connection, and it is when I m using the network that I get accuracy of 500m. I do understand that the accuracy will not be really good but having that much seem to be strange. Thanks for your answer . – Franck CHEN Jul 25 '18 at 08:48