-
Notifications
You must be signed in to change notification settings - Fork 671
MultiplePermissionsListener REQUEST_ONGOING #105
Comments
Hi @PingForward I'm wondering, are you following the README section about screen rotations? When the requesting activity dies due to a rotation or any other reason, we have to rebind the permission listeners by calling Got to say though that you are not the first person having this issue so we will probably need to do a smarter checking when requesting the same permissions more than once. Hope that link helps, let us know if you still have problems with the library. |
Hi, I also have this issue with PermissionListener. My activity open and close normally, without any rotation or other reason to kill the activity unexpectly, several times later, this exception happens. Version is 3.0.0 |
@Serchinastico No rotation, regular open close. |
I can confirm. Also happens with |
The reason is when we create Dexter instance, the Context in DexterInstance become null. |
We've got the same bug. Please, review this pull request. |
Fixed in the PR #108. We are about to publish a new version :) Thanks everyone for your help! |
Hi guys! |
@ovitrif we can't reproduce it. Could you create a sample project public on github with the code needed to reproduce it? |
@pedrovgs I can give a few details. In the end I fixed the issue by adding an error listener, where I run the code to check the permissions manually using Android code. Having discussed this with my colleague, we wanted initially to check the permissions manually first, and only when they are not granted would we use Dexter. I wonder why you guys stop in case of The problem with your approach, I think, is that you do all the complex code to ensure the user is asked to grant permissions. Otherwise I find dexter unreliable, since I'll always have to wrap it with my own implementation for checking permissions. I'm not sure it is intended to be used like that, but I would find it very useful if it was always reliable and you could just do the normal check for permissions before, for example, trying to get the user location. |
Guys! same problem in version 5 also. How to fix once we get this |
I'm getting the same issue here with the version 5.0.0 |
I'm getting the same issue here with the version 6.0.0
Devices: Nokia |
Hi @chihung93 we can't reproduce it. Could you create a sample project public on github with the code needed to reproduce it? |
Good morning @pedrovgs You can download it and try to these step : |
Ok, I know what's going on. It's a wrongly configured listener what we have here and a missing documentation part from our side. I'm going to update the project readme with some information about this scenario and explain here what's going on. If you don't configure the token you receive spaceNavigationView.setSpaceOnClickListener(object : SpaceOnClickListener {
override fun onCentreButtonClick() {
Dexter.withActivity(this@MainActivity)
.withPermissions(
Manifest.permission.ACCESS_COARSE_LOCATION
,Manifest.permission.ACCESS_FINE_LOCATION)
.withListener(object: MultiplePermissionsListener {
override fun onPermissionsChecked(report: MultiplePermissionsReport?) {
report?.let {
if(report.areAllPermissionsGranted()){
toast("OK")
}
}
}
override fun onPermissionRationaleShouldBeShown(
permissions: MutableList<PermissionRequest>?,
token: PermissionToken?
) {
token?.continuePermissionRequest()
}
})
.withErrorListener {
toast(it.name)
}
.check()
}
override fun onItemClick(itemIndex: Int, itemName: String) {
toast("${itemIndex} ${itemName}")
}
override fun onItemReselected(itemIndex: Int, itemName: String) {
}
}) Look closer here: override fun onPermissionRationaleShouldBeShown(
permissions: MutableList<PermissionRequest>?,
token: PermissionToken?
) {
token?.continuePermissionRequest()
}
@chihung93, can you please check this out? |
This thing took my 4 hours, update it there asap for saving time of others.. |
OK great, work like a charm :))) |
Good work! |
if any previous activity is open and dialog is still showing at that time error will occcured |
Expected behaviour
Call onPermissionsChecked with already granted permissions
Actual behaviour
when I ask for permissions it call onError(DexterError error) with REQUEST_ONGOING error
Activity was closed and opened several times using startActivityForResult setResult(OK) or CANCEL before this happened.
Steps to reproduce
Version of the library
3.0.0
The text was updated successfully, but these errors were encountered: