I'm using Location flutter package to access the user's background location, first time any user opens the app it asks for permission, and when the user accepts it brings back this error in the console
Unhandled Exception: PlatformException(PERMISSION_DENIED_NEVER_ASK, Background location permission denied forever - please open app settings, null, null)
if the user closed the app and reopened it .. it works perfectly fine ( fetches location in both foreground and background) without even asking again for location permission.
Following the getting started guide in the package itself, here is how I added permission to my AndroidManifest.xml file :
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>