-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug when close and reopen #3
Comments
The problem is that when I reopen the app (onResume), Android calls onRequestPermissionsResult with empty arrays for permissions and grantResults. "When the user responds to your app's permission request, the system invokes your app's onRequestPermissionsResult() method, passing it the user response. Your app has to override that method to find out whether the permission was granted". https://developer.android.com/training/permissions/requesting.html My work around is not executing your code in this case (i.e. when the arrays are empty). If I do, permissionHelper runs onSuccess method.
|
Hi @pellyadolfo , thanks for this issue. Can you show the full code at your SplashActivity? |
Hi @NoNews, I mean, scenario: the app is showing the permission request dialog to the user and, in this moment, the user clicks the button in the middle (https://i.stack.imgur.com/RPdkA.png) to move the app to background. If the user moves the app back to foreground (by clicking the third button), the dialog does not show again (as would be expected) and the onResume executes method onRequestPermissionsResult passing an empty array. Current NoPermission code moves the flow to the onSuccess Runnable and allows the user to pass without having accepted the permission. Later I paste some code at home. |
@pellyadolfo Thank you, I'll debug this moment today |
@pellyadolfo I could to reproduce crash (but not security crash), will fix it on this weekend. (And release new version) I still need your code. I follow your scenario, method |
This is a kind of parent activity
and this is how I use it in a subclass:
on resuming the activity, android calls onRequestPermissionsResult with empty String[] and I find it runs onSuccess exactly here https://github.com/NoNews/NoPermission/blob/master/library/src/main/java/ru/alexbykov/nopermission/PermissionHelper.java#L353 Is like Android understands that the user has responded: "When the user responds to your app's permission request, the system invokes your app's onRequestPermissionsResult() method, passing it the user response. Your app has to override that method to find out whether the permission was granted". This is why a try to fix it by blocking this weird event with
I am on API level 24. |
@pellyadolfo
Actual result:
Devices:
|
@pellyadolfo Can you try reproduce it with sample application? |
Thanks for this class. The beauty of simplicity.
There seems to be a bug when showing the permission request to the user on the splash screen. If the user cleans his dialog and opens again the app, this secod time, the permissionHelper.check() method automatically executes 'success' and assumes to be granted, without showing the dialog again and without actually having the permission granted.
In this way, clearing the screen and reopening the app in the same point (i.e. moving the app to background and back to foreground) we can navigate the app skipping the dialogs until the final security crash.
The text was updated successfully, but these errors were encountered: