App only in foreground: How to avoid "Background location access not declared"
Asked Answered
F

2

0

my app needs to get access to the location only when it is in foreground. The goal is to record the gps position at moment the user clicks on a button.

The app was working fine for years but the apk is now refused by the play store due to "Background location access not declared" My intent is not to use location in background. So I guess something is wrong but I cannot find the issue.

In the Manifest, I have set ACCESS_FINE_LOCATION but not ACCESS_BACKGROUND_LOCATION I have also tried <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove" />, but it does not help.

I am using the LocationManager class In my activity:

  • in On Create, I get the location service by calling getSystemService(Context.LOCATION_SERVICE)
  • in onResume(), I call requestLocationUpdates(...)
  • in onPause(), I call removeUpdates(...)

What am I missing?

Flip answered 31/1, 2021 at 7:35 Comment(1)
Please reopen the question. The referenced post (Android 10 (Q) ACCESS_BACKGROUND_LOCATION permission ) is the opposite: it requires background location. In my case, I want only foreground location but the play store claims that I use the location in backgroundFlip
F
1

After 1 week of working hard to find out what the problem was, sending messages to Google support (no answers), releasing different versions of my code in closed testing branches, filling again the policy form, etc... the problem disappeared by itself (no code change) this week-end.

Flip answered 8/2, 2021 at 6:45 Comment(0)
M
1

One of my Application is based on background location and it got approved by google by simply doing these steps :

  • Step 1> Add popup explaining why we are taking user location in background
  • Step 2> IMPORTANT popup should appears before notification permission.
  • Step 3> create video to explain your use case why it is important to take location in background
  • step 4> The popup is most important make sure video have that detail popup display.
  • step 5> share video link on play console
  • step 6> add written explanation of your usecase on play console
  • step 7> add latest apk on playstore for review.
Magnetic answered 12/3, 2021 at 6:28 Comment(2)
did your popup showed once? I used to ask for permission on my map screen it checks it every time for granted. if already granted should I give the popup even if already accepted?Bloodhound
@Bloodhound : Your popup explaining your location usecase should appears every time BEFORE permission is asked.Magnetic

© 2022 - 2024 — McMap. All rights reserved.