Flutter background location access
Asked Answered
S

2

6

When I went to update my app on Google Play, I saw a warning about something called "Sensitive app permissions" that I haven't seen before. It seems to concern call, SMS, location and file access permissions.

Google Play Policy center / Permissions

The Permissions declaration form on Google Play says

Location permissions

Not started         Your app isn't compliant

My app uses the Flutter Location plugin and Flutter Map plugin. I request the INTERNET and ACCESS_FINE_LOCATION permissions in my manifest:

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

Further reading on Requesting access to location in the background gives more info about coming changes to Google Play policy:

Timeline for review and approval changes

Beginning September 30, 2020, we will start reviewing apps that request access to location in the background. If your app is impacted, you will be notified on the App content page (Policy > App content) in the Play Console to complete the permissions declaration form.

Beginning January 18, 2021, all new apps (first published after April 16, 2020) submitted to Google Play that access location in the background will need to be approved before they can go live.

Beginning March 29, 2021, all existing apps (first published before April 16, 2020) that access location in the background will need to be approved or they will be removed from Google Play.

So, should I worry about background location usage, even though I'm not requesting any permission for background location, or actively doing anything in my app to access it?

I'm seeing the location icon (a map needle) in the status bar on my old phone running Android 7, even when the app was in the background. I've also seen the occasional "high battery usage in the background" on Android 7. On Android 9 and 10 I have not seen this though.

I might have been sloppy to stop the location plugin when the app is "backgrounded" - however, I'm not requesting any permission for background location, so could the location plugin really collect location data in the background - and thereby violating the Google Play policy - without it?

Swingletree answered 1/10, 2020 at 6:33 Comment(1)
H
5

I added this to the app manifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
    package="com.example.localstore">
 <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="remove"/>

source

Homotaxis answered 17/1, 2021 at 13:32 Comment(1)
Did this work? I get this error Execution failed for task ':app:processReleaseMainManifest'. > com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 45; columnNumber: 104; The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.Depalma
E
0

I think the one that matters is you need to increase your compileSdkVersion and targetSdkVersion to 29

Ervin answered 22/10, 2020 at 16:31 Comment(3)
I get the same Warning in Google Play with my Flutter App, also with Flutter Location Plugin and not requesting or active using any background location. My compileSdkVersion and targetSdkVersion are at 29, so that doesn't seem to change anything...Shelving
The same situation.Moniliform
I got. a same issue. Even we removed location permission in latest version but still showing this error while updating app in play storeBrian

© 2022 - 2024 — McMap. All rights reserved.