Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 670 forks source link

Dexter does not call onPermissionsChecked after user denies permission #166

Closed greatjack1 closed 7 years ago

greatjack1 commented 7 years ago

Expected behaviour: Each and every time dexter runs, it should check for permissions, and ask for them and then call the onPermissionsChecked method. Every single time Dexter is used it should repeat this.

Actual behaviour: Dexter only calls it the first time I ask for permissions, how ever if the user denies the permission on the first time and then restarts the app, dexter will not call the onPermissionsChecked method

maraj91 commented 7 years ago

Please add this line "token.continuePermissionRequest();" in the onPermissionRationaleShouldBeShown method for appearing the permission dialog again after deny.

Example like:- Dexter.withActivity(this) .withPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) .withListener(new PermissionListener() { @Override public void onPermissionGranted(PermissionGrantedResponse response) { Log.e("PERMITION ","ACCEPT"); }

                @Override
                public void onPermissionDenied(PermissionDeniedResponse response) {
                    Log.e("PERMITION ","DENAY");
                }

                @Override
                public void onPermissionRationaleShouldBeShown(PermissionRequest permission, PermissionToken token) {
                    token.continuePermissionRequest();
                    Log.e("PERMITION ","RATIONAL");
                }
            })
            .onSameThread()
            .check();
greatjack1 commented 7 years ago

Thanks, issue closed