Search code examples
androidandroid-permissionsandroid-location

App may need approval for background location


I have received an email from google that one of my apps needs to change the location permission from background to foreground....

I took a look at the app and it seems that is already on foreground... my permissions on my manifest are:

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

Also I request the permission on user demand... What is the problem, then?


Solution

  • If you follow the link you will find in which scenario you need foreground permissions.

    In the link it clearly says:

    If your app contains a feature that shares or receives location information only once, or for a defined amount of time, then that feature requires foreground location access. Some examples include the following:

    • Within a navigation app, a feature allows users to get turn-by-turn directions.
    • Within a messaging app, a feature allows users to share their current location with another user.

    On Android 10 (API level 29) and higher, you must declare this foreground service type.

    <service
        android:name="MyNavigationService"
        android:foregroundServiceType="location" ... >
        <!-- Any inner elements would go here. -->
    </service>