Android Question FusedLocationProvider requesting location in the background

yo3ggx

Active Member
Licensed User
Longtime User
Today Google decided to remove one of my applications from Play Store for the following reason:
"Your app requests location in the background for either unapproved and/or undisclosed purposes. Apps that request location in the background must successfully complete a console-based declaration process and adequately disclose use to users."

I'm using FusedLocationProvider for a few years already to get location information in order to calculate distance to my correspondent during a ham radio call.
Any recommendation on how to prevent this mechanism working in the background?

Thank you.
 

yo3ggx

Active Member
Licensed User
Longtime User
How to test? I have the following permissions removed explicitly in the manifest file.
1645264670671.png
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Longtime User
Nothing in the manifest file related to FusedLocation.

All the code containing FusedLocation is in the Main module, nothing in the services.
if any of thoses services is a foreground service started from the background, location requests require ACCESS_BACKGROUND_LOCATION permission. (here)
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
if any of thoses services is a foreground service started from the background, location requests require ACCESS_BACKGROUND_LOCATION permission. (here)
So if I'm using RemovePermission(android.permission.ACCESS_BACKGROUND_LOCATION) in the manifest file solve this?
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Longtime User
my understanding (from what you say) is that you're not accessing location from the background (because all your location requests take place on the main thread).

from the link i provided, google seems to be saying that if you have any foreground service and if you are requesting location (even if from the main thread), the user has to grant ACCESS_BACKGROUND_LOCATION to your app. my understanding of that would be you have to keep that permission in your manifest (as well as request the permission when the app runs. do you have any foreground service which might be started from the background? if yes, then you have to have the permission. if you have no foreground services, then - regrettably - the answer is elsewhere.

if google won't accept your explanation, either you didn't explain it well enough or you are doing something google doesn't want you to do (and that we do not understand what that might be). you might be able to do things differently, but if location sharing is involved, you're going to have a hard time convincing google.

i don't know what your app does, but you do mention determining how far away another ham operator is. i would guess frequency is not enough. i would think the only way you could know where a fellow ham operator is is if he tells you (or sends the co-ordinates to a server). that would be an example of location sharing.
 
Last edited:
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
i don't know what your app does, but you do mention determining how far away another ham operator is. i would guess frequency is not enough. i would think the only way you could know where a fellow ham operator is is if he tells you (or sends the co-ordinates to a server). that would be an example of location sharing.
I'm calculating the distance between my location and the grid of the other operator, but this is not relevant for my issue.
I don't need at all location services in the background, then why tro request it?
I will try to push tomorrow the updated version with RemovePermission(android.permission.ACCESS_BACKGROUND_LOCATION in the manifest file, to see if is accepted.
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
Longtime User
1) if ham radio grids are a type of geo fence, you may need the permission. (google's rule)
2) it doesn't matter if location services are not in the background. if you have any foreground services, and you also have location services, you need the permission. (goodle's rule)
3) good luck removing the permission. i hope that is the simple solution.
 
Upvote 0

yo3ggx

Active Member
Licensed User
Longtime User
1) if ham radio grids are a type of geo fence, you may need the permission. (google's rule)
Is not geofence. Is a 4 or 6 char locator that is declared by each operator during the call, or can be automatically extracted from a site.
2) it doesn't matter if location services are not in the background. if you have any foreground services, and you also have location services, you need the permission. (goodle's rule)
As stated in one of my previous replies, the user is asked for location permissions, but only when app is active or a single time, never for background.
3) good luck removing the permission. i hope that is the simple solution.
Thank you. I hope too.
 
Upvote 0
Top