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 doesn't notify when the app goes in background with permission dialog open and when returning doing tap in the app icon, the permission dialog is close. #271

Open aljosta opened 3 years ago

aljosta commented 3 years ago

Expected behaviour

Notify on any callback or listener of dexter when the permissions array and the grant result array are empty on method onRequestPermissionResult.

Actual behaviour

It is not notifying these case in any callback or listener of dexter.

Steps to reproduce

It's happen when the launchMode=standard for the main activity in the app manifest, when the permission dialog is open, then I send to background my app , then return to the app doing tap in the icon, then the permission dialog is already close but dexter never notify this case. When I implement de requestPermission and onRequetPermissionResult directly in my app, this case is notified.

Version of the library

5.0.0, also tested with 6.2.1

The following is the dexter implementation in my app.

Dexter.withActivity(activity)
                .withPermissions(arrayPermisos)
                .withListener(new MultiplePermissionsListener() {
                    @Override
                    public void onPermissionsChecked(MultiplePermissionsReport report) {
                    }
                    @Override
                    public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                        token.continuePermissionRequest();
                    }
                })
                .withErrorListener(new PermissionRequestErrorListener() {
                    @Override
                    public void onError(DexterError error) {
                        Log.e("Dexter", "There was an error: " + error.toString());
                    }
                })
                .onSameThread().check();
pedrovgs commented 3 years ago

Hi @aljosta I tried to reproduce the error you mention configuring the sample project to use the launch mode you mention and I couldn't. Could you please provide a reproducible sample? Thank you in advance!