In Android OS 11, apps targeting SDK 30+. We get a permission dialog with three buttons when we request location -foreground permission for the first time.
As per documents it is given that OS is granting permission for this time only.
https://developer.android.com/about/versions/11/privacy/permissions#one-time
When I am clicking on "Only this time". As per the user's perspective, the permission should ask again. When I am coming back. But In actual Operating systems granting the permission. Why this is happening. Is this system behavior? Do I need to do any changes app-side?
Thanks in anticipation.
In Android OS 11- If we are granting permission “Only this time”. It means the OS is granting permission for next some time. When you are immediately opening the app or your app is in the background and opening the app again you will find permission granted.
If you are coming after some time you will see the permissions not granted. Permission popup reappears.
some more findings on android OS 11:-
till Android OS 10, the shouldShowRequestPermissionRationale function returned false for the first time, but in OS 11 shouldShowRequestPermissionRationale function returns true for the first time and when the user is in a confused state as explained in the document.
Till android OS 10, android OS permission popup gets displayed if shouldShowRequestPermissionRationale is true and when we are requesting permission for the first time. after that, if shouldShowRequestPermissionRationale is false the permission popup will not display.
But in OS 11 we are able to see a popup no matter the shouldShowRequestPermissionRationale return true or false.
Hope this will help someone. please correct if anything wrong.