Capacitor geoposition "Ask every time" permission status


I’m adding @capacitor/geolocation to my app and I’m having troubles with the “Ask every time” permission scenario on Android.

If the user has nor accepted or denied the permission, when executing Geolocation.checkPermissionStatus() I retreive { "location": "prompt-with-rationale" }, that is correct.
If the user then selects “Ask every time”, the checkPermissionStatus() returns { "location": "denied" }.

As the guidelines for android and iOS are to prompt the user with proper explanation on why we ask the location permission, I would like to detect this case to avoid to bother the user that declines the location permissions and ask the permissions again only if he set “Ask every time”.

Is there any solution to this?


In which Android version and device/emulator are you testing?

In my tests, first checkPermissionStatus() returns prompt, if I request the permission and deny it, then second call to checkPermissionStatus() I get the prompt-with-rationale, and if I request it again and deny it again, on third checkPermissionStatus() call I get denied.
I don’t get an “Ask every time” option in the prompt, I see this 3 options (on Android 13):

  • While using the app
  • Only this time
  • Don’t allow

Yes, sorry for the wrong label, the “Ask every time” would be in the settings of Android itself, in the prompt comes as “Only this time”.
I’m using Android 13 emulator.

In that case, in my new tests, first checkPermissionStatus() returns prompt , if I request the permission and select “Only this time”, then second call to checkPermissionStatus() I get the granted , and if I request it again it doesn’t prompt and continue returning granted.
For it to prompting again, I need to kill the app and relaunch, then checkPermissionStatus() returns prompt again.

Hi @julio-ionic ,

initially appeared that you were correct, but after the trying different scenarios looks like the issue is still there.

To replicate the workflow must start from a permission denied.
After that, I changed the permissions in android settings to Ask every time, then rebooted the emulator.
Now the checkPermissionStatus() returns denied every time.

Hello, did you find any solutions? I have the same problem, i want to show the prompt every time if user choose ask every time but geolocation plugins return denied, not shows the prompt

No, I found none, with our app the strategy has been to ask always the permissions if not granted.
Nevertheless, if you’re simulating android, by my tests we found out that the permissions gets updated with a bit of delay, thus if you change permissions, to have consistent results, try to reboot the emulator.

Hello , In my case if i select ask every time it shows prompt in the console.log even if i select the dont allow after requesting the permission its the same result. How can i differentiate if it shows prompt evreytime . Is there a way find the what the user selected ?