Closed loganSims closed 7 years ago
Checking grantResults may be the best way to handle this actually.
From the Android Reference pages:
Note: It is possible that the permissions request interaction with the user is interrupted. In this case you will receive empty permissions and results arrays which should be treated as a cancellation.
Seems when we rotate the screen and the second permissions request is called one of them is canceled (I assume the first) and onRequestPermissionsResult
gets called with the empty arrays causing the crash.
Looks like when the device is rotated
enableMyLocation();
is called again after the config change, which makes another permissions request whereint[] grantResults
is an empty array causing the crash.Adding a check for
grantResults.length > 0
fixes the issue, but I would like a better fix. Something to let the Activity know it's already asking for permissions after a config change.