Barcode Scanning

Hi Folks,
I have a Zebra TC22 device I am using to build a very basic App to scan barcodes.

This device has a built in barcode scanner (not using the device camera)

I am not getting the data received after I scan a barcode.
I have a code block below that should work I assume?

I have a temporary workaround to keep the focus on another textbox and just configure the scanner to work as a keyboard but I would prefer not to do this.

image

How do you initiate the scan?

I am just using the scan button on the device itself, i think thats the problem that the barcodescanner doesnt listen to incoming data like if i was writing a traditional app.

I asked CharGPT for you. See the answer below. ChatGPT was a little bit halluzinating, because there does not exist such extension TaifunBroadcastReceiver. But the rest might be doable

Taifun


Good question — the Zebra TC22 has a built-in barcode scanner, and when you press the physical scan button (the trigger), the device’s DataWedge service captures the barcode and can send the scanned data to your app.

However, MIT App Inventor (and AI2-based tools like Kodular, Niotron, etc.) doesn’t automatically receive “After Scan” events from Zebra’s scanner — you have to configure DataWedge to send the scan result into your app.

Here’s exactly how to do that:


:white_check_mark: Step 1: Open DataWedge

On your TC22:

  1. Go to Apps → DataWedge.
  2. You’ll see one or more profiles (e.g. “Profile0 (default)”).

:white_check_mark: Step 2: Create or Edit a Profile for Your App

  1. Tap the “+” to create a new profile (e.g. call it MyBarcodeApp).
  2. Tap Associated apps → New app/activity → choose your App Inventor app’s package name (you must first install your app at least once so it appears here).

:white_check_mark: Step 3: Configure the Intent Output

This is the key part.

  1. Inside your profile, tap Intent output → Enabled (toggle it ON).
  2. Under Intent action, type something like:
com.myapp.BARCODE
  1. Intent delivery: Choose Broadcast intent.
  2. Tap Intent category and set it to:
android.intent.category.DEFAULT

Now, DataWedge will broadcast an intent every time the scan button is pressed and a barcode is decoded.


:white_check_mark: Step 4: Receive the Intent in App Inventor

App Inventor can receive broadcast intents using an extension.
You’ll need one of the following:

Then configure it like this:

Example with TaifunBroadcastReceiver:

  1. Set Action to com.myapp.BARCODE
  2. When BroadcastReceived fires, get the barcode data from the intent extra:
intent.getStringExtra("com.symbol.datawedge.data_string")

In App Inventor blocks, that means something like:

when BroadcastReceiver1.BroadcastReceived do
    set Label1.Text to get valueForKey "com.symbol.datawedge.data_string"

:white_check_mark: Step 5: Test

Now, when you press the physical scan trigger, the barcode data should appear in your App Inventor app — no need for a “Scan” button inside the app.


:white_check_mark: Optional: DataWedge Intent Extras (for reference)

The key extras in the broadcast intent are:

  • "com.symbol.datawedge.data_string" → The decoded barcode text
  • "com.symbol.datawedge.label_type" → The barcode symbology (e.g. “EAN13”)
  • "com.symbol.datawedge.source" → “scanner”

There has been no mention of the UseExternalScanner checkbox so far ?

To receice the intent you could alternatively use

taken from the extensions directory App Inventor Extensions | Pura Vida Apps

Taifun

Thanks taifun, that looks like it should work.

I didnt want to waste time looking at extensions in case this should work out of the box.