Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

Trouble with Android 11 and a new option for permissions "Only this time/Ask every time" #333

Open
slobodanantonijevic opened this issue Sep 4, 2020 · 4 comments

Comments

@slobodanantonijevic
Copy link

The problem is that with new Android 11 there is a new option (apart from "always" and "only in app") for permissions (eg. Location) which is "Only this time" or "Ask every time" depending on which screen you get it. The thing is the app with this set has to ask permission every time the user starts a new session in the app.
However your library always returns permission as granted for this option chosen. While the permission should be reset every time the app is restarted.

  • Device: Pixel 4
  • OS version: Androi 11 Preview
@galuszkak
Copy link
Collaborator

Hi @slobodanantonijevic ,

Can you prepare a minimum working example of this issue? Generally speaking, if app was restarted when looking on permissions is should ask again for those, so I'm not fully sure what isn't working as expected.

@VuHongKy
Copy link

VuHongKy commented Oct 14, 2020

@galuszkak Yes, Android 11 (API = 30) has changed permissons a little, please update it, bro.

On my case, when confirm permission dialog show:

  • On android 8.0, I click outside of confirm dialog -> nothing happened.
  • On android 11, I click outside of confirm dialog -> it jump to subscribe { } function and both permission.granted = false and permission.shouldShowRequestPermissionRationale = false

On my code, it always open permission settings like this:

fun FragmentActivity.requestRxPermissions(vararg permissions: String, granted: () -> Unit): Disposable {
    return RxPermissions(this)
            .requestEachCombined(*permissions)
            .autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY))
            .subscribe { permission ->
                when {
                    permission.granted -> granted()
                    permission.shouldShowRequestPermissionRationale -> {
                        // At least one permission is denied
                    }
                    else -> openPermissionSettings()
                }
            }
}

@pk4393
Copy link

pk4393 commented Apr 30, 2021

@galuszkak Any update on this issue?

the library always returns permission as granted for the "Ask every time" option. But as per the behavior of Android 11, the permission should be reset every time the app is restarted.

@huutuan06
Copy link

huutuan06 commented Jun 30, 2022

@galuszkak Yes, Android 11 (API = 30) has changed permissons a little, please update it, bro.

On my case, when confirm permission dialog show:

  • On android 8.0, I click outside of confirm dialog -> nothing happened.
  • On android 11, I click outside of confirm dialog -> it jump to subscribe { } function and both permission.granted = false and permission.shouldShowRequestPermissionRationale = false

On my code, it always open permission settings like this:

fun FragmentActivity.requestRxPermissions(vararg permissions: String, granted: () -> Unit): Disposable {
    return RxPermissions(this)
            .requestEachCombined(*permissions)
            .autoDisposable(AndroidLifecycleScopeProvider.from(this, Lifecycle.Event.ON_DESTROY))
            .subscribe { permission ->
                when {
                    permission.granted -> granted()
                    permission.shouldShowRequestPermissionRationale -> {
                        // At least one permission is denied
                    }
                    else -> openPermissionSettings()
                }
            }
}

I have the same problem when user clicks outside the permission dialog. It's always jump to 'else -> openPermissionSettings()''.
My expectation is only dialog disappears when user clicks outside. Do you have any solution for it or still keep this flow?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants