Flutterlocation: Remove "android.permission.ACCESS_BACKGROUND_LOCATION" when not used in background -> Play Store Submission issues

Created on 31 Dec 2020  路  14Comments  路  Source: Lyokone/flutterlocation

Is your feature request related to a problem? Please describe.
I was pretty frustrated to see an update to my app refused by Google because now ACCESS_BACKGROUND_LOCATION appeared in the permissions of my app bundle, without my knowledge of enabling this. After looking into it, upgrading everything (dependencies, flutter sdk, android target, etc.) for my new app update (and the ACCESS_BACKGROUND_LOCATION permission used in the AndroidManifest.xml-file in the location-3.2.1 folder of my flutter plug-in folder was the culprit. I do not use background location services...

Describe the solution you'd like
Don't know if possible: auto-remove the ACCESS_BACKGROUND_LOCATION permission from the location-3.2.1 AndroidManifest.xml when the location package is not used for background location services.

Describe workarounds you've considered
My workaround is to manually remove the ACCESS_BACKGROUND_LOCATION-permission from the AndroidManifest.xml file in the location-3.2.1 folder of my flutter plug-in folder.

Most helpful comment

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"/>

All 14 comments

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"/>

@adamshamsudeen 's solution worked for me :-D

I have the same issue. Unfortunately, the solution above from @adamshamsudeen didn't work for me either, when I build the app on my CI server. Getting following error:
The prefix "tools" for attribute "tools:node" associated with an element type "uses-permission" is not bound.

Does anyone have any other work-arounds?

Seems like this has been added with version 3.2.0

Any comments from the maintainers if this will stay or you plan to somehow make this flexible? I guess the only other workaround for me would be to downgrade again to 3.1.0.

@sderungs99 you have to add xmlns:tools="http://schemas.android.com/tools" in the manifest tag. Check the previous comment.

ah, i missed that, thanks. And I confirm that it is also working for me now :-)

Thanks for the solution, @adamshamsudeen. Much better then to remove the permissions in the flutter plug-in folder.

@meirssv let's keep this issue open as the solution I provided is a hack.

@adamshamsudeen ok, will reopen this issue.

Hi, i'm sorry, I'll check that asap to have a proper fix.
Thanks for the quickfix tho !

I have created a PR to sort this out: https://github.com/Lyokone/flutterlocation/pull/475

@meirssv May I ask why Google refused your update, what was their reasoning? I myself is hoping to have this in a future update of my app that actually needs to use this service in the background.

@RamithRD I am not using background tracking in my app. But if you use this, you have to comply with the pretty strict demands of Google to get it through to the Play Store. For example: you also need to upload an instructional video with your app that explains the use of the background tracking mode in your app to the end user. Hard to do for an app that doesn't even use this background tracking... nothing to show in an instruction video...

@meirssv Thanks for the input! It indeed has become very difficult to ship a feature like this.

For anyone who needs some official documentation from Google regarding this matter, please go through this doc :

https://support.google.com/googleplay/android-developer/answer/9799150?hl=en

Was this page helpful?
0 / 5 - 0 ratings