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

onDetect does not trigger in android 13 #925

Closed
VictorWork0721 opened this issue Jan 10, 2024 · 6 comments
Closed

onDetect does not trigger in android 13 #925

VictorWork0721 opened this issue Jan 10, 2024 · 6 comments

Comments

@VictorWork0721
Copy link

No description provided.

@navaronbracke
Copy link
Collaborator

Are you still getting barcodes from the controller itself? The onDetect method is not the recommended way to listen to barcodes.

@VictorWork0721
Copy link
Author

VictorWork0721 commented Jan 15, 2024

Are you still getting barcodes from the controller itself? The onDetect method is not the recommended way to listen to barcodes.

What is the recommended way to listen to barcode?

@navaronbracke
Copy link
Collaborator

Listen directly to MobileScannerController.barcodes using Dart's Stream API:

https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/mobile_scanner_controller.dart#L88

final MobileScannerController = controller = MobileScannerController();

final Subscription<Object?> subscription = controller.listen((BarcodeCapture barcodes) {});

// ...
subscription.cancel();

@stephg
Copy link

stephg commented Jan 15, 2024

Listen directly to MobileScannerController.barcodes using Dart's Stream API:

https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/mobile_scanner_controller.dart#L88

final MobileScannerController = controller = MobileScannerController();

final Subscription<Object?> subscription = controller.listen((BarcodeCapture barcodes) {});

// ...
subscription.cancel();

Looks like there is a typo:

- final Subscription<Object?> subscription = controller.listen((BarcodeCapture barcodes) {});
+ final Subscription<Object?> subscription = controller.barcodes.listen((BarcodeCapture barcodes) {});

If this is the recommended way of listening to the results, onDetect should not be required. Correct?
https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/mobile_scanner.dart#L78

@navaronbracke
Copy link
Collaborator

Listen directly to MobileScannerController.barcodes using Dart's Stream API:
https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/mobile_scanner_controller.dart#L88

final MobileScannerController = controller = MobileScannerController();

final Subscription<Object?> subscription = controller.listen((BarcodeCapture barcodes) {});

// ...
subscription.cancel();

Looks like there is a typo:

- final Subscription<Object?> subscription = controller.listen((BarcodeCapture barcodes) {});
+ final Subscription<Object?> subscription = controller.barcodes.listen((BarcodeCapture barcodes) {});

If this is the recommended way of listening to the results, onDetect should not be required. Correct? https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/mobile_scanner.dart#L78

Woops, yeah that's a typo. Indeed, onDetect should not have been a required parameter. It is a bit of a leftover from an older API signature on our end. I do have a PR open that fixes most issues with our public API, but that is blocked on a bug upstream in the Dart SDK.
Something broke on the web side of things.

For now you could pass an empty function to onDetect.
If you're feeling a bit bold, you could also switch to my WIP branch from that PR, but web support won't be working until dart-lang/sdk#54534 is fixed.

See also: #916

@VictorWork0721 VictorWork0721 changed the title onDetect does not trigger in android 14 onDetect does not trigger in android 13 Jan 18, 2024
@VictorWork0721
Copy link
Author

VictorWork0721 commented Jan 19, 2024

Detection of QR-Codes not working on Samsung A23 5G #698
Done fixed. I just fixed with using 3.5.5 version and set the resolution based on the solution in this github issue. Thank you

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

No branches or pull requests

3 participants