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?