tbruyelle / RxPermissions

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

onNext() is not called after "deny" clicked #337

Open fierce-bunny opened 3 years ago

fierce-bunny commented 3 years ago

Hi! I may be doing something wrong but rxPermissions.ensureEach() (or any other RxPermissions method) doesn't emit any event if I click "deny" or "deny & don't ask again" on a permission dialog. The permission dialog is not shown after that when I click the button again. Though it is shown after resubscribing. Thanks

view.onChangePhotoClick()
            .compose(rxPermissions.ensureEach(Manifest.permission.CAMERA))
            .observeOn(schedulersProvider.ui())
            .subscribe ({ permission ->
                if (permission.granted) {
                    view.onCameraPermissionGranted()
                }
            }, Timber::e)

Android 10

Lib Version

0.12

andreii-sp commented 3 years ago

I have the same issue. Were you able to solve this?

fierce-bunny commented 3 years ago

@andreii-sp Nope, just stopped using the lib in favour of another solution.

weiwangshuai commented 2 years ago

If you press the home button when applying for permission, you will not be able to apply for permission when re-entering the APP

weiwangshuai commented 2 years ago

If you press the home button when applying for permission, you will not be able to apply for permission when re-entering the APP. modify:void onRequestPermissionsResult(String[] permissions, int[] grantResults, boolean[] shouldShowRequestPermissionRationale) { if (permissions == null || permissions.length == 0) { for (String key : mSubjects.keySet()) { mSubjects.get(key).onNext(new Permission(key, false, shouldShowRequestPermissionRationale(key))); mSubjects.get(key).onComplete(); } mSubjects.clear(); return; } for (int i = 0, size = permissions.length; i < size; i++) { MyLogger.d("onRequestPermissionsResult " + permissions[i]); // Find the corresponding subject PublishSubject subject = mSubjects.get(permissions[i]); if (subject == null) { // No subject found Log.e(RxPermissions.TAG, "RxPermissions.onRequestPermissionsResult invoked but didn't find the corresponding permission request."); return; } mSubjects.remove(permissions[i]); boolean granted = grantResults[i] == PackageManager.PERMISSION_GRANTED; subject.onNext(new Permission(permissions[i], granted, shouldShowRequestPermissionRationale[i])); subject.onComplete(); } }