Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background Location updates using Google API - Fused Location Provider not accurate

I have been working and testing on background location updates using GoogleApiClient for Interval and Displacement based updates. On testing and analyzing for a few days I figured out some variations in the output which I did not expect.

  1. While using setInterval and setFastestInterval for Interval based updates, say I have set an Interval as 15 mins and Fastest Interval as 10 mins, 90% of the time I am getting updates in the expected Interval (10 to 15 mins). But sometimes I noticed that the updates take much longer time than the specified Interval, like, the difference is around 30 mins and 60 mins. Any Idea about why is the difference?

  2. While using setMinimumDisplacement for Distance based updates, say I have set a Displacement as 200 meters, I am getting updates only on stationary points(While travelling it doesn't give updates even if it is more than 200 meters) which are 200 meters and above. Is this how it works normally?

I am using PendingIntent type of location requests in order to receive location updates in BroadcastReceiver for location updates in background.

fusedLocationProviderClient.requestLocationUpdates(locationRequest, pendingIntent);

While testing, the Location Services were ON and Location Mode was HIGH_ACCURACY.

like image 512
Joshua Avatar asked Dec 20 '17 10:12

Joshua


People also ask

How accurate is fused location provider?

Accuracy of defined location varies based on number of visible satellites, device hardware and environment. Usually it's about 3m in case if there are no high buildings or metallic structures (hiding satellites from your device sight) around.

Which of the following method will used to receive location updates in the background even when the application is not active?

Once a location request is in place you can start the regular updates by calling requestLocationUpdates() .

Which method is best suited for getting location updates?

Allow only while using the app This option is the recommended option for most apps. Also known as "while-in-use" or "foreground only" access, this option was added in Android 10 and allows developers to retrieve location only while the app is actively being used.

How does a fused location provider work?

The fused location provider manages the underlying location technologies, such as GPS and Wi-Fi, and provides a simple API that you can use to specify the required quality of service. For example, you can request the most accurate data available, or the best accuracy possible with no additional power consumption.


1 Answers

Please refer to the documentation to get the proper behavior of LocationRequest API.

LocationRequest Api documentation

From this documentation:

  • Applications cannot specify the exact location sources, such as GPS, that are used by the LocationClient. In fact, the system may have multiple location sources (providers) running and may fuse the results from several sources into a single Location object
  • Location requests from applications with ACCESS_COARSE_LOCATION and not ACCESS_FINE_LOCATION will be automatically throttled to a slower interval, and the location object will be obfuscated to only show a coarse level of accuracy.
  • All location requests are considered hints, and you may receive locations that are more/less accurate, and faster/slower than requested

For more detail description read full documentation from above link.

Hope this explanation may help you.

like image 166
Mitesh Vanaliya Avatar answered Sep 20 '22 08:09

Mitesh Vanaliya