Karumi / Dexter

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

onPermissionDenied called twice if decline access to permission #183

Open gromiloff opened 6 years ago

gromiloff commented 6 years ago

Expected behaviour

onPermissionDenied(PermissionDeniedResponse response) must called one time

Actual behaviour

onPermissionDenied(PermissionDeniedResponse response) called twice

Steps to reproduce

  1. Dexter.withActivity(this) .withPermission(Manifest.permission.ACCESS_FINE_LOCATION) .withListener(this) .withErrorListener(this) .check();

  2. on start first activity after install app - decline access

  3. restart application (full stop and start again). Next time decline again with set flag no ask again

Version of the library

4.0.0 / 4.1.1

Serchinastico commented 6 years ago

Hi @gromiloff

Where are you asking for permissions? If it's on the onResume method I'd say your problem is there, keep in mind that when the permission has been denied, we need to launch an invisible activity to ask the system for the real state of the permission status so it might re-trigger the onResume method of your activity.

If you send us more context on how are you using Dexter we can better help you find the issue here.

Thanks for reporting.