0

I have a similar issue to this post How to make my Android app comply with the "Background Location Policy" but that post doesn't have an answer.

I have a web browser app, which on occasion will ask for location permissions if the user visits a website that requests that. App targets API 29. The app manifest has <uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" /> which is API 23 and higher because I didn't want to force location permission on older phones.

Today I got an email saying I have until March to fix this, but I don't understand what I have to do, I'm not requesting background location anywhere.

Anyone have any idea what I have to do?

Edit: I have read the help center, and I'm wondering if that my issue is the ACCESS_FINE_LOCATION, maybe something is accessing it on the background. I don't know how I would prevent ad networks from that if they do it. I already pause the WebViews the app is not on the foreground so websites should not be using it.

Edit2: Is there maybe a way I can log background location access so that I can monitor my app a few days to see if it happens?

casolorz
  • 8,486
  • 19
  • 93
  • 200
  • I have no concrete information, but given my understanding, it's possible that the Play Store does some automatic analysis of our APK and decided that you request location data from some place that they consider "Background". [This article](https://developer.android.com/training/location/background) and [these specific suggestions](https://developer.android.com/about/versions/oreo/background-location-limits#tuning-behavior) might give a hint. Another hint is that some third-party SDK (such as an ad SDK) might contain the offending code, that would still count towards your app. – Joachim Sauer Jan 13 '21 at 21:07
  • Is there a way to log background location access? It could be that an ad network is doing it. – casolorz Jan 13 '21 at 21:31

1 Answers1

0

I would like to answer my own question in case someone else is searching for this. I can't say that I know for certain this is correct but it has worked for me so far.

First, on this answer https://stackoverflow.com/a/65894488/704836 I was told to use AppOpsManager to log background location requests. After doing that I found a few places where that takes places. I will discuss those below:

  1. Ad networks. I have ad network initialization on my Application.onCreate() and a lot of those accessed location. So when triggering a BroadcastReceiver, they would check location.
  2. WifiManager.getConnectionInfo() - this will trigger a location request. Same deal as above, I had one of those on Application.onCreate().

After removing those calls the Play store stopped complaining.

casolorz
  • 8,486
  • 19
  • 93
  • 200