I was in need of a barcode scanner for one of the apps I was building and know there has been a bit of discussion around the implementation of a barcode scanner on Thunkable X… anyway I know this isn’t quite a barcode scanner, and has its flaws, but seems to work okay for me,
I have added screenshots and explanation below:
As you can see you call the camera, and take a picture of the barcode, use the “Photo” output of the camera as the “Media” input of the MediaDB (cloudinary).
You can then use this nifty little API https://ocr.space/ocrapi to create your own API key. When you scan the barcode you won’t be actually scanning the barcode but the numbers beneath the barcode as this is an OCR reader.
Once this is done you want to set your Web_API URL as https://api.ocr.space/parse/imageurl?apikey=YOURAPIKEY&url=mediaURL
You need to use your own API that you have set on https://ocr.space/ocrapi and your mediaURL output from the MediaDB
Then you will call back the result of that API and parse it like you would with any JSON format so that you only receive the number of the barcode. I have also added a Alert, so that it confirms with me whether the number matches the barcode, this is because if you scan more than just the number on the barcode the OCR will attempt to read the text,
Let me know how you go, I’d still like a real barcode component though