Xojo Android get text from a barcode image

Hi all

I’m learning/developing an Android Application for a customer.
The objetive is take a photo of a barcode, read the EAN code, check with a database for status and if it’s all allwright, the user set quantity and write the item in the inventory table.

Currently, my app can get the photo, put it on a ImageViewer component and talk with a REST server in the network for check inventory and write inventory.
I know that Xojo for Android is in beta, the cuestion is:

How to solve the part from an Barcode Image to get the text that contains?
I know that android offer an api for an internal function.
Maybe another api or applications that can do the job.
Perhaps in the future this function will be included in Xojo too.

Thanks in advance

I also needed to decode barcode images in an Android app.

To handle that, I developed a Xojo Web 2.0-based Web service that accepts an image (which is Base64-enoded), decodes it, and uses the Einhugur Barcode Plugin for Xojo to identify and decode any barcodes that it finds in the image, and it returns an array of the symbols it found.

Specifically, I’m using the plugin’s BarcodeDecoder Class ( BarcodePlugin ). One of the nice things about that class is that it can identify and decode multiple symbols in the image. So if you’re scanning packages, for example, that have barcodes about what’s inside, shipping labels, etc, you can get all of that info in a single scan.

I would love to eventually have the decode functionality built into the Android framework. But for now, the Web service approach is working well.

Anyway, this approach might be something to consider.



Android Intents exists since Android 1, in other tools you can write a couple lines of code to call a installed barcode scaner app that returns the scaned string.

Loked for this but Xojo dont have intents, and looks like the current DECLAREs are too limited to implement somethig like this

Then a DECADE ago, android introduced the barcode scaning as part of the OS.

This days Android has the Machine learning Kit with native Barcode scanning, Face detection, Text recognition, Image labeling, Object detection and tracking, etc, etc. but looks hard to implement on xojo.

Xojo need to give access to this:

I recall there were some works on this as explained by Travis.
Maybe since Xojo Android is still in Beta the details are still very vague, but i’m sure Travis , Paul or Martin can show how this can be done currently.

as ivan wrote, by android design it is possible to use other apps which can return anything.
i used Barcode Scanner from ZXing Team (Google Play Store) there with B4A.
its called StartIntentWithResult in android api.
(btw dependency to other app’s is not a good choice for a business app.)

there are a few open source barcode recognition projects you could use at backend for a web service.

from picture to code 39 barcode i wrote myself into one week just for fun.

scan a barcode by Bluetooth input device is maybe also an option.
you can have the phone in bag or you can use the scanner also at pc.

I like @Tim_Dietrich’s approach. If you want to use Xojo, get the job done, move on to the next challenge.


We don’t have a way to do this currently, but keep an eye out for 2023r4 pre-releases.