googlesamples / googlesamples/mlkit
[Bug report] setBarcodeFormats being ignored
- Dominant language
- Kotlin
- Stars
- 4.3k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
It seems that the method `setBarcodeFormats()` is not working as intended, detecting unspecified formats.
**To Reproduce**
Put this settings on `BarcodeScannerOptions`:
1. Setup the scanner as this:
```
val barcodeScannerOptions = BarcodeScannerOptions.Builder()
.setExecutor(executor)
.setBarcodeFormats(
Barcode.FORMAT_EAN_8,
Barcode.FORMAT_EAN_13,
Barcode.FORMAT_UPC_E
).build()
```
2. Scan this Barcode example:

3. The output's `format` is `512` (which is `FORMAT_UPC_A`) and the result is: `123456789012`
**Expected behavior**
I expect to receive format `32` (which is `FORMAT_EAN_13`) and result being `0123456789012`. (with the starting `0`)
I tried to test this same barcode with **Scandit** and **Apple's AVFoundation Framework** and both outputs the `FORMAT_EAN_13` result with the starting `0`.
**SDK Info:**
- SDK Name & Version: com.google.mlkit:barcode-scanning:17.1.0
**Smartphone:**
- Emulator API 33
- OnePlus 7 API 30
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.