is FusedLocationProviderApi.getLastLocation is HIGH_ACCURACY?

622 views Asked by At

I want to ask if getLastLocation() from FusedLocationProviderApi get Location with HIGH_ACCURACCY or not?

when I read the documentation, it says:

public abstract Location getLastLocation (GoogleApiClient client)

Returns the best most recent location currently available.

If a location is not available, which should happen very rarely, null will be returned. The best accuracy available while respecting the location permissions will be returned.

This method provides a simplified way to get location. It is particularly well suited for applications that do not require an accurate location and that do not want to maintain extra logic for location updates.

does the best means get the most accurate location? or like automatically request last location using LocationRequest.PRIORITY_HIGH_ACCURACY?

1

There are 1 answers

0
singhnikhil On BEST ANSWER

getLastLocation will not create a new request to get the current location. It gives already available/saved location based on previous location request.

This already available/saved location details is based on the last location data requested by any client/app on the user's device.

Eg: If user has Google Maps installed and running , it gives you the accurate location of the device. In this case once you start your app and check for last location it will give you location with high accuracy.

In case your device doesn't have Google Maps but another app which requested location updates with low accuracy , your getLastLocation will return that low accuracy location .