问题
In Google Play Location Services, in the LocationRequest class, is there any documented behavior to what happens when you use setFastestInterval with a value slower than the one set with setInterval?
What seems to happen, according to my test in 2 different phones, is that the updates are delivered to the listener at the (slower) rate set by setFastestInterval.
However, there is an additional detail. If, for example, I call set setFastestInterval with 1 minute, but setInterval to 5 seconds, I get the updates every 1 minute, but these updates have a consistently better accuracy than if I simply set both intervals as 5 minutes (about the same high levels of accuracy as if I set both intervals to 5 seconds). This seems to indicate that, under the hood, the locations are fetched at the faster value set by setInterval, but delivered at the slower rate set by setFastestInterval.
Could anyone please confirm if this is the case and whether I can rely on this behavior?
As far as I could find, the documentation has the following to say about this situation:
If setFastestInterval(long) is set slower than setInterval(long), then your effective fastest interval is setInterval(long).
and
The system will never provide location updates faster than the minimum of getFastestInterval() and getInterval().
来源:https://stackoverflow.com/questions/55869773/android-locationrequest-calling-setfastestinterval-with-slower-value-than-seti