Closed natario1 closed 4 years ago
This problem doesn't seem to be in scope of the library. PermissionListener will usually hold some kind of reference to view or at least context, so it should be destroyed if your activity is destroyed. And library doesn't know how and when this listener was created so it's impossible for it to be recreated automatically. It's up to your application to remember the fact that permissions were requested and request them again.
@deinlandel explained it perfectly!
It's up to your application to remember the fact that permissions were requested and request them again.
In the normal flow of permissions (without any lib), it's not up to the application - it actually comes for free. Dialog will be re-shown automatically and the permission results listener will be called in the new activity/fragment. So this is a drawback of the library. Anyway, thanks for your answer!
How does Dexter deal with activity recreation?
By this I mean, I ask for permissions, permission dialog is shown, then I close the app and go to another. Android might kill the app after saving its state. When going back the whole stack is recreated and dialog should still be shown. But I don't see how you would retain the
PermissionListener
object.