When an app requests a device’s location, it can either wait for the request response or, by using active location listeners, get an opportunistic location update. This was available (unrestricted) in Android 9 and lower, and was provided when an app specified only the active location update rate, leaving the passive rate blank. (Passive location listeners don't receive opportunistic location updates because they don't specify a location update rate.)
Starting in Android 10, to get opportunistic
location updates, developers must specify that they need passive location
updates from the
Fused location provider
Apps can specify the rate at which they get opportunistic location updates from the
FusedLocationProviderClient class in two ways.
- Specify a value in the
setFastestIntervalmethod that’s lower than the value of the
setIntervalparameter. (Use a value of 0 ms or greater.)
- Let the value be set automatically by leaving
If you don't provide a value for
setFastestInterval, your app may experience a significant
reduction in location updates delivered to it.
You don’t need to do anything to implement this feature other
than to use the suggested values for the