Enable OCR support
OCR support in the barKoder SDK is currently intended primarily for VIN code recognition. Since the SDK is focused on barcode scanning, our OCR implementation has been optimized specifically for VIN use cases.
Enable VIN OCR #
1. Ensure you're using a license key that has OCR enabled.
2. Add in build.gradle (module:app) dependencies :
dependencies {
implementation "com.google.mlkit:text-recognition:16.0.1"
}
3. Enable OCR detection when scanning for VIN:
// Enable OCR functionality
Barkoder.SetCustomOption(bkdView.config.getDecoderConfig(), "enable_ocr_functionality", 1);
// Enable OCRText symbology
bkdView.config.getDecoderConfig().OCRText.enabled = true;
// Optional: enable other barcode types alongside OCR
bkdView.config.getDecoderConfig().Code39.enabled = true;
// enableVINRestrictions (only decode VIN-compliant barcodes / strings)
bkdView.config.getDecoderConfig().enableVINRestrictions = true;