0

We are using Google Play Services to get location updates:

LocationRequest mLocationRequestHighAccuracy = LocationRequest.create() 
                .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
                .setFastestInterval(500)
                .setInterval(500);

FusedLocationProviderClient locationProviderClient = LocationServices.getFusedLocationProviderClient(context);

Task<Void> task = locationProviderClient.requestLocationUpdates(getLocationRequestHighAccuracy(context), getActivityDetectionPendingIntent(context));

task.addOnSuccessListener(new OnSuccessListener<Void>() {<snip>}

For some reason, most of the time, we only get accuracy of 10m.

BUT, if we register to LocationManager in android.location, we get accuracy of 4m and sometimes even 3m. Code snippet:

android.location.LocationManager locationManager = (android.location.LocationManager) 
appContext.getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(android.location.LocationManager.GPS_PROVIDER, 500, 0, mLocationListener);

We want to use Google Play Services for its faster fix time, and the fusion with more sensors, but we need the most accurate result. I don’t understand how the fused location provider provides less accurate result than the gps provider.

Does anyone know how to force Google Play Services to give us more accurate results? Our only solution thus far is to register to both, get the lat/lon from Google Play Services and the accuracy from the raw GPS (if it’s lower).. But that seems like a hack…

Thanks.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
TalL
  • 1,661
  • 16
  • 16
  • Possible duplicate of [Why does FusedLocationProviderApi never report accuracy better than 10m? Is this documented?](https://stackoverflow.com/questions/49289206/why-does-fusedlocationproviderapi-never-report-accuracy-better-than-10m-is-this) – paul Jul 11 '18 at 20:31

1 Answers1

0

If you want the most accurate results, use GPS. The idea of a Fused location is that you're trading off accuracy in exchange for faster fix time, less battery use, etc. If that's not what you need, just use GPS. You don't get to have your cake and eat it too.

As for how it provides less accuracy than GPS- its relying more on network location and less on GPS data to save battery. The only thing that's more accurate than GPS is short range signal triangulation, and for that you need bluetooth beacons everywhere and an accurate map of them. There's a reason why phones have GPS hardware- because it is the most accurate way of getting location outside of rare circumstances. If Fused was more accurate they'd remove it and save on hardware costs.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • No, this is a bug. There are many questions about it and it has been reported on the issue tracker. https://issuetracker.google.com/issues/79189573. And, the FusedProvider set to PRIORITY_HIGH_ACCURACY can use GPS according to the docs. – paul Jul 10 '18 at 18:06
  • "The priority of the request is a strong hint to the LocationClient for which location sources to use. For example, PRIORITY_HIGH_ACCURACY is more likely to use GPS, and PRIORITY_BALANCED_POWER_ACCURACY is more likely to use WIFI & Cell tower positioning, but it also depends on many other factors (such as which sources are available) and is implementation dependent." – paul Jul 10 '18 at 18:09
  • @paul Should, not will. If you need high accuracy, don't rely on should- just use GPS. Whether an app really needs that kind of accuracy is always a good question to ask, but if you do you shouldn't be using fused. – Gabe Sechan Jul 10 '18 at 18:11
  • I don't think this is accurate. Its true its a not a guarantee. Actually GPS provider isn't either since users can disable GPS. But Fused isn't a different provider like GPS and Network. It is a combination of both + sensors. In my experience before this bug, fused would usually be more accurate than GPS alone (I assume because of whatever google is doing with sensor data). If you use only GPS provider you can be leaving some accuracy on the table even outdoors. Using GPS as a fallback makes sense, but I don't agree about ruling out Fused from an accuracy standpoint. – paul Jul 11 '18 at 08:57
  • @paul It is true it isn't a garuntee. You're letting FusedProvider pick. The user turning off GPS is an entirely different issue- if they turn off GPS, then the GPS provider will tell you its disabled, and you can choose wether to use a less accurate means, or tell the user to enable it. (For that matter they can turn off all location, including Fused). Fused is never more accurate than GPS, it can be as accurate- if it decides to just use GPS. But you're not going to get more accurate than the most accurate signal. – Gabe Sechan Jul 11 '18 at 14:12
  • "Fused is never more accurate than GPS". According to Google, FLP uses gyro, magnetometer, accelerometer, and barometer to improve GPS accuracy. https://youtu.be/OEvycEMoLUg?t=25m15s – paul Jul 11 '18 at 20:20