Restrict opportunistic locations

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 FusedLocationProviderClient class.

Fused location provider

Apps can specify the rate at which they get opportunistic location updates from the FusedLocationProviderClient class in two ways.

Impact

If you don't provide a value for setFastestInterval, your app may experience a significant reduction in location updates delivered to it.

Implementation

You don't need to do anything to implement this feature other than to use the suggested values for the FusedLocationProviderClient class setFastestInterval method.