In order to use the Geofence API the user has to give the app ACCESS_FINE_LOCATION
. This location is considered to be dangerous and can be revoked at any time; once this permission is revoked, the app can not request the geofence updates.
How does ACCESS_BACKGROUND_LOCATION
permission fit in this picture? We know for sure that this permission is also dangerous and can be revoked at any time. Does it mean that if we want to register some IntentService
to be invoked every time the geofence change occurs, we also have to make sure the user has provided ACCESS_BACKGROUND_LOCATION
permission? Or do we need to use this permission only if we attempt to get a current location in our own background Service/BroadcastReceiver?
The reason I'm asking this question is that the documentation seems to be a bit vague at this point: the documentation describing the Q Developer Preview mentions that geofencing is one of the use cases for the background location retrieval, while the Geofencing API page does not mention ACCESS_BACKGROUND_LOCATION
among its requirements.
My guess the section "Re-register geofences only when required":
Registered geofences are kept in the
com.google.process.location
process owned by thecom.google.android.gms
package.
will be that it is not really needed, as com.google.process.location
should be the one getting the location data (so the one needing to request the ACCESS_BACKGROUND_LOCATION
permission).
That being said, following this logic ACCESS_FINE_LOCATION
permission should neither be needed. The fact that it is needed may be because of two reasons (I don't know the real reason):
For me, the second assumption makes more sense, meaning that even when technically will not be needed by the app (the process getting the location is Play Service), it is required for privacy/security reasons.
Following this logic, Google should (will?) also enforce the ACCESS_BACKGROUND_LOCATION
, both to ensure user's privacy/security and to reduce battery consumption.