tbruyelle / RxPermissions

Android runtime permissions powered by RxJava2
Apache License 2.0
10.48k stars 1.31k forks source link

onNext not called again #294

Open IstrateAndrei opened 5 years ago

IstrateAndrei commented 5 years ago

I'm using the following snippet to handle some permissions:

fun onClick(){
              val dispo = RxPermissions(this)
                .requestEachCombined(Manifest.permission.READ_CONTACTS)
                .subscribe { permission: Permission ->
                    if (permission.granted)
                        //permission granted action
                    else if (!permission.shouldShowRequestPermissionRationale)
                       //show redirect to settings dialog
                }
            mDisposable.add(dispo)
}

When the user checks on Don't show again next time a custom dialog will appear that will redirect him to app settings so he can enable the permission manually. The problem is if the user goes back from settings (even without enabling anything) on the next click the onNext() inside the subscribe is never called again until i recreate the activity....

This is very strange because I use the same snippet in other places in the app and I don't have any problems with it. The only differences between were it works and where it does not are that where it works is/are Java Fragment and I have issues inside a Kotlin Activity.... But I don't get it why that should be an issue....