Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter background location access

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?

like image 602
Magnus Avatar asked Oct 01 '20 06:10

Magnus


1 Answers

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

like image 95
Richard.D Avatar answered Sep 29 '22 12:09

Richard.D