-
Notifications
You must be signed in to change notification settings - Fork 774
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
Android: Scanning area limited to center of camera preview (portrait mode) #17
Comments
@tobiasviehweger Any ideas? |
Hi @WillHay. Answering here your question on post #18 related to this post. I have the same behaviour as you describe on my android devices. Anyway, the behaviour with android does not appear to be a problem for me. As the plugin allows to overlay the video with custom HTML, it is quite easy to encourage the user to center the QRcode (as most scanners do with a box or centered cross). (note : the QRcode does not need to be VERY centered on my Android tests, the tolerance zone seems fine to me, maybe you have a different behaviour). |
@NicRoy thanks for the info. (As for the iOS "zoom" behavior, that's an OS level behavior. If you use the built-in I'll leave this issue open, as it would be great to get the Android platform working similarly to the iOS one (aggressively scanning the full screen). |
@WillHay I just had a few minutes to look into this - though my time is unfortunately quite limited atm. I'd really like to test more. My suspicion is that the following parts are responsible for this, the BarcodeView sets the cropping: The cropping comes from here: Especially this, where a 10% margin is added on each side, afterwards the height and width are adjusted to each other (height should not be larger than width), basically resulting in the issue (at least my guess) - this would also explain why it works in landscape (width always > height), but not in portrait. To validate this, it'd probably be best to create a new class which inherits from BarcodeView, but overrides I'm also not too sure if this might be a bug in the library itself, it seems strange that this results to a very different experience for portrait/landscape, with no obvious explanation - might be a idea to raise an issue for them... |
+1 This should allow user define the limited area should be scanned and previewed by absolutely cordinates, such as https://manateeworks.com/barcode-scanner-sdk |
Is it possible to set the region where scanner preview stays? I don't like it to get the entire screen, leaving no space for me to put other content on device's screen. |
@r-bechara not currently, but PR's are welcome! (Probably best to open a new issue, since that's a bit different than the topic of this issue.) |
@tobiasviehweger thanks.
|
The scanner only detects the QR Code if it's in the middle of the camera preview. For example, if you position the camera so that the QRCode is in the upper right corner of the BarcodeView preview, the QR Code will not be detected. Once you move the camera so the QR Code is in the middle, it detects it instantly. Need to change the scanning area to take up as much of the camera preview as possible so the QR Code can be scanned from anywhere, not just the middle.
Edit:
I just discovered that it scans the entire video preview when the camera is in landscape mode. This issue only occurs when the camera is in portrait mode.
The text was updated successfully, but these errors were encountered: