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

No action after clicking on `DENY` or `ALLOW` if a device has been rotated (with a displayed permission dialog) #216

Closed grzesiek2010 closed 5 years ago

grzesiek2010 commented 5 years ago

Hi, I'm an Android developer and I work on ODK Collect. We have started using this library recently and we have discovered one issue I would like to describe.

Actual behavior

The problem is that if we rotate a device after displaying a permission dialog (like https://fscl01.fonpit.de/userfiles/7156896/image/double_perm_1.png) there is no action after clicking on DENY or ALLOW. The reason is pretty obvious: we pass an activity (like here https://github.com/Karumi/Dexter/blob/master/sample/src/main/java/com/karumi/dexter/sample/SamplePermissionListener.java#L30) and then we use it to perform further actions but after device rotation, it's a reference to an already killed activity.

Steps to reproduce

  1. Download and install the sample app https://github.com/Karumi/Dexter/tree/master/sample
  2. Click on the AUDIO button
  3. Rotate your device.
  4. Click on the DENY button.

Expected behavior

UNKNOWN text should be changed to DENIED like below: screenshot_1537907342

Version of the library

5.0.0

Is there any way to handle such a case? Here is our issue: https://github.com/opendatakit/collect/issues/2574

Serchinastico commented 5 years ago

Hi @grzesiek2010

You are absolutely right, at some point we had the possibility to re-subscribe to an ongoing permission request but we ended up removing it from the API because we never got it completely right and it was causing a lot of bugs/noise. Having said that, we won't implement it, but we are open to forks and/or PRs to reenable that functionality once again.

grzesiek2010 commented 5 years ago

@Serchinastico thanks for the clarification.