Location permission prompt not showing in MIUI 12.1.4 Android 11

1.2k views Asked by At

I'm having a problem in location permission prompt in MIUI 12.1.4 Android 11. It is not showing if there's PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION. Also, I console log the result and it gave me this ... android.permission.ACCESS_BACKGROUND_LOCATION": "denied", "android.permission.ACCESS_FINE_LOCATION": "never_ask_again"}

Here's my code ...

 const granted = systemVersion > 9 ? await PermissionsAndroid.requestMultiple([
        PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
        PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION,
      ]) : await PermissionsAndroid.requestMultiple([ PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION ])

When I remove the PermissionsAndroid.PERMISSIONS.ACCESS_BACKGROUND_LOCATION the location permission shows but doesn't have "Allow all the time" option. How to resolve this issue? Thank you!

1

There are 1 answers

2
Sreehari K On

Even if you add ACCESS_BACKGROUND_LOCATION to the list of the permissions to request, the system will ignore it. If the application needs to use location in the background. To do that, you have to prepare your own dialog with an explicit message explaining the use of background location. When the user agrees, take him to the application’s settings page where he can choose the level of permission he wants to grant.

Read This Article For More Details