-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
Permission error not reset in start/stop method #1247
Comments
In On Android a permission request triggers a lifecycle change when the permission popup opens. When the permission is denied, the popup closes, which triggers This is the reason why I updated the guidance in 1ab7f5a See also the example that includes lifecycle handling: https://github.com/juliansteenbakker/mobile_scanner/blob/master/example/lib/barcode_scanner_controller.dart#L62-L66 |
So specifically in your case
is not sufficient. Either you check the permission state from |
Thank you so much for your help. This idea seems to be worth checking. I was checking permission but at a later stage which i now understand is the issue. The version we are using for your product which doesnt have the hasCameraPermission and therefore overlooked the guidance. Nevertheless i will use the error check inside. |
I had one question : (This might sound silly) but after you got to settings from I have verified that at later stage we emit So how does this work ? |
In that case you should stop the scanner before restarting it. The However, while double checking that, I see that we do not set the We also do not reset the error to Would you mind opening a PR to fix that? Otherwise I'll look into this myself. |
Yeah, I have been trying to stop and start exactly like you said. Thanks ! This might fix it. I would love to work on this. I will try to put up a PR by tomorrow after work, If you would like. Otherwise, thanks for offering. |
I wrote a quick fix, feel free to test it. I'll do that tomorrow as well. Once it is tested, I'll include this in the next beta. |
Thanks for the fix, looks good code wise. I will try to test this today. |
Edit: Sorry I see that #1037 and #773 have been raised about this. I've read through the threads and seems like it's unresolved. Thanks for your help on those threads. I've tried the errorBuilder and error handling but it doesn't get called when in this state. Hey guys, slightly unrelated to this issue but it's similar. I'm encountering a 'development only' issue whereby if the camera is active and I hot-restart then the camera stays on and the MobileScanner widget does not load up correctly (it just stays on the placeholder builder). I was wondering if there may be a similar fix for the issue as this fix here. Could we somehow reset the camera when calling start()? I've tried your branch @navaronbracke but it doesn't seem to fix this issue. The only workaround for my 'development only issue' is to call controller.stop() before doing the hot restart. But it would be nice if there was a check when calling 'start()' to see if it's still active and then reset it. Or somehow to call controller.stop() when a hot-restart occurs (but seems impossible because hot-restart just kills thread or similar). Sorry if this is a completely different issue - let me know if I should raise a separate issue about this. Thanks for any thoughts/advice on this. Debugging on Real Device: iPhone 14, iOS 18.1.1 |
@erecord Your issue is indeed related to hot restart, and you are correct that those issues you mentioned already talk about that. |
Hi ! I am developing a usecase in a Flutter APP of qr scanner via your great package. After being denied twice (permanently denied), i use openSettings() function to open settings.
Incase i configure the camera permission, i need that my app when the lifecycle state -> resumed to start the Camera instead of displaying the ScannerErrorWidget.
I use Cubit to maintain Permission state across App to enable dialog boxes and rebuild app as and when the state changes.
This is some of the code i have written for it:
I maintain two states understand the phase of the flow we are at a particular instance
Cubit main functions :
Bloc Listner Code
I extensively searched across your documentation and examples but couldnt find any examples to hint in this direction.
If you could let me know, any ideas or or direction.
One of the major issues, i am facing is this even after configuring Camera Permission from settings, the Controller Error Widget goes on an inifinite loop of diaplying the error even when i have verified via
permission_handler
package that the permission status isgranted
The text was updated successfully, but these errors were encountered: