Skip to content
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

[flutter_local_notifications] Check permissionRequestInProgress in onRequestPermissionsResult #1686

Conversation

nvx
Copy link
Contributor

@nvx nvx commented Sep 1, 2022

Other flutter plugins permissions requests can end up triggering onRequestPermissionsResult, so only handle callbacks when we're expecting one to be outstanding.

This fixes a java.lang.IllegalStateException: Reply already submitted crash that can occur when other flutter plugins request access to permissions on Android.

Other flutter plugins permissions requests can end up triggering onRequestPermissionsResult, so only handle callbacks when we're expecting one to be outstanding.

This fixes a `java.lang.IllegalStateException: Reply already submitted` crash.
@MaikuB
Copy link
Owner

MaikuB commented Sep 1, 2022

Thanks for the PR. Do you by chance have details on how to reproduce the issue, preferably in the form of a repo hosting an app that can reproduce the issue? Asking as it looks related to #1688 but the exception is different. I've only been able to reproduce this if the permission requests aren't awaited but the error is different than what you reported. Furthermore, while the PR fixes the aforementioned issue, other plugins may still crash if the calls aren't awaited as awaiting avoid request codes from various plugins clashing

@MaikuB
Copy link
Owner

MaikuB commented Sep 3, 2022

Although I haven't heard of a response yet, will merge this in anyway as it definitely fixes an issue when multiple plugins handle permission requests

@MaikuB MaikuB merged commit c901b4f into MaikuB:master Sep 3, 2022
@nvx
Copy link
Contributor Author

nvx commented Sep 3, 2022

I haven't got a publicly available demo, but the other plugin I was using is device_calendar which looking at it's code has a similar check to only handle the callback when it's got an outstanding permission request.

Cheers for merging the fix though!

@nvx nvx deleted the bugfix/on_request_permissions_result_reply_already_submitted branch September 3, 2022 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants