androidandroid-permissionsandroid-location

"Allow all the time" location prompt not coming in Android SDK 29


I can't get the "Allow all the time" prompt for location in SDK 29. I already set these permissions in the manifest:

<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

and requesting the user to allow these permissions at run time. But it only returns the "When the app is open" and "Deny" choices.

Any thoughts about how to show it in SDK 29.


Solution

  • In order to access the location in background on device running Android 10 (API level 29) or higher, you also need to use below permission in the manifest file

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

    please refer the below link for more information

    https://developer.android.com/training/location/permissions?hl=fr