Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - LocationManager vs FusedLocation

I tried Fused Location (GoogleApiClient) and it was inaccurate when getting a location, it gave me my previous location even when I ask for a new (current) one, I asked for 10 requests (in order to be as accurate as possible) but after 4-6 times it simply stopped requesting and the ones it did get, were very inaccurate (881m accuracy).

On the other hand, when using LocationManager, it always gave me my location more or less, it never stopped in the middle for no reason and in general was much more stable.

So in what way fused location is better than location manager?

like image 301
Amos Avatar asked Jan 10 '15 10:01

Amos


1 Answers

Weird!!! Fused location should be faster and should provide more accurate location.

Make sure you are requesting location updates

LocationServices.FusedLocationApi.requestLocationUpdates(
    mGoogleApiClient, mLocationRequest, this
);

instead of getting last known location

mLastLocation = LocationServices.FusedLocationApi.getLastLocation(
    mGoogleApiClient
);

and you're using LocationRequest.PRIORITY_HIGH_ACCURACY(GPS).

Main difference between Fused Location and Location Manager is the latter does not depend on Google Play Services.

like image 55
j4rey Avatar answered Nov 09 '22 02:11

j4rey