mobile: drop ACCESS_BACKGROUND_LOCATION from the manifest - #450
Merged
Merged
Conversation
The permission was declared but never requested at runtime, so no user was ever prompted for it and nothing depended on it. get_location reads the network provider's last known position from inside the foreground service, which is declared with foregroundServiceType="location"; Android treats that as foreground access while the node runs off-screen, and it needs only ACCESS_COARSE_LOCATION. Play Console flagged the declared-but-unused permission and asked for a background-location declaration, which an optional sensor toggle would not pass. Removing it makes the form moot.
Contributor
There was a problem hiding this comment.
Code Review
This pull request removes the ACCESS_BACKGROUND_LOCATION permission from the Android manifest file and adds an explanatory comment clarifying that location services are handled via a foreground service. I have no feedback to provide as there are no review comments and the changes are straightforward.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Removes
android.permission.ACCESS_BACKGROUND_LOCATIONfrom the Android manifest.ACCESS_COARSE_LOCATION,FOREGROUND_SERVICE_LOCATIONand the service'sforegroundServiceType="location"stay.Why
Play Console flagged the permission on the first AAB upload and asked for a background-location declaration ("Let us know why your app accesses location in the background").
The app does not need it:
get_locationtool inMainActivity.kt, which readsgetLastKnownLocation(NETWORK_PROVIDER)and rounds it to ~1 km.ACCESS_COARSE_LOCATIONat runtime;ACCESS_BACKGROUND_LOCATIONwas never requested, so no user was prompted for "Allow all the time" and nothing depended on it.SamNodeForegroundService, started from the activity withforegroundServiceType="location"when coarse location is granted. Android counts location reads made while such a service is running as foreground access, which is exactly the "agent queries the phone in your pocket" case.Play's policy says apps that access location via a foreground service do not need
ACCESS_BACKGROUND_LOCATION, and the declaration form is triggered by the manifest entry alone. Background-location approval also requires the feature to be core to the app plus a demo video, which an optional sensor toggle would not satisfy.Zero behavior change. The next AAB built from this drops the "undeclared Location permissions" block in the console;
ACCESS_COARSE_LOCATIONonly needs to be reflected in the Data safety section.