Closed renaudcerrato closed 8 years ago
Ok, forget about it: I was catching the onRequestPermissionResult()
in the Activity while the permission has been requested from a fragment. The framework is effectively ORing request codes coming from fragments with 0x100 for safety.
Running 6.0.1 on a Nexus 6, I noticed that my methods were not called right after granting permissions. After a few debug, I can clearly see that the request code given to
onRequestPermissionsResult()
has an offset of 256 compared to the task number inDelayedTasks
- resulting in a"No delayed task to execute.
It looks like
requestPermissions()
is adding 256 to the given request code (or ORing it with 0x100 since only first 8 bits can be used as request code).As a quick and dirty fix, I had to write the following to make it works: