How to read data from bar code scanner of ET1 in a programmatic way?

K Karthik Ajith 3 years 6 months ago
9 4 0

What I am looking for specifically is, ET1 populates the data from bar code scanner automatically into any editable text field. Due to the user flow complexities, I need a way to read data directly from the code and then populate my view elements.

Please Register or Login to post a reply

4 Replies

K Karthik Ajith

Thanks guys, got the whole thing working end to end
My last blocker was about the settings changes in the newly created "profile". The issue was that, intent was not mentioned in the Profile settings. Just updating the post and hoping someone else travelling the same route will get their job done easily.

f fdsfdsf fdsfefdx

glad to see this problem has been solved. a friend told me some barcode scanners will automatically return data back to you.
is it true? if so, that would be wonderful.

have a great day
Lily

Y Yanis Dalabiras

Datawedge can also be configured to send data to an Android intent.  If you are developing an app using the Android sdk, you could set up a profile in DataWedge to send barcode data directly to an intent that you expose for this purpose.  pasting in a section from the ET1 Imtegrator's guide. If you need more control than this, you could build your app using RhoElements.  That has full control over the scanner.

Intent Overview
The core components of an Android application (its activities, services, and broadcast receivers) are activated
by intents. An intent is a bundle of information (an Intent object) describing a desired action — including the
data to be acted upon, the category of component that should perform the action, and other pertinent
instructions. Android locates an appropriate component to respond to the intent, launches a new instance of
the component if one is needed, and passes it the Intent object.
Components advertise their capabilities, the kinds of intents they can respond to, through intent filters. Since
the system must learn which intents a component can handle before it launches the component, intent filters
are specified in the manifest as elements. A component may have any number of filters, each
one describing a different capability.
For example, if the manifest contains the following:

. . .

In the Intent output plug-in configuration, the Intent action would be:
android.intent.category.DEFAULT
and the Intent category would be:
android.intent.category.MAIN.
The Intent delivery option allows the method by which the intent is delivered to be specified. The delivery
mechanisms are Send via startActivity, Send via startService or Broadcast intent.
DataWedge Configuration 4 - 21
The decode related data added to the Intent’s bundle can be retrieved using the
Intent.getStringtExtra() and Intent.getSerializableExtra() calls, using the following String tags:
• String LABEL_TYPE_TAG = “com.motorolasolutions.emdk.datawedge.label_type”;
String contains the label type of the bar code.
• String DATA_STRING_TAG = “com.motorolasolutions.emdk.datawedge.data_string”;
String contains the output data as a String. In the case of concatenated bar codes, the decode data is
concatenated and sent out as a single string.
• String DECODE_DATA_TAG = “com.motorolasolutions.emdk.datawedge.decode_data”;
Decode data is returned as a list of byte arrays. In most cases there will be one byte array per decode.
For barcode symbologies that support concatenation e.g. Codabar, Code128, MicroPDF, etc., the
decoded data is stored in multiple byte arrays (one byte array per bar code). Clients can get data in each
byte array by passing an index.
The MSR related data added to the Intent's bundle can be retrieved using the Intent.getStringtExtra() and
Intent.getSerializableExtra() calls, using the following String tags:
• String MSR_DATA_TAG = “com.motorolasolutions.emdk.datawedge.msr_data”;
String contains the output data as a String. The data from the MSR tracks is concatenated and sent out
as a single string.
• String MSR_TRACK1_TAG = “com.motorolasolutions.emdk.datawedge.msr_track1”;
MSR track 1 data is returned as a byte array.
• String MSR_TRACK2_TAG = “com.motorolasolutions.emdk.datawedge.msr_track2”;
MSR track 2 data is returned as a byte array.
• String MSR_TRACK3_TAG = “com.motorolasolutions.emdk.datawedge.msr_track3”;
MSR track 3 data is returned as a byte array.
• String MSR_TRACK1_STATUS_TAG = “com.motorolasolutions.emdk.datawedge.msr_track1_status”;
MSR track 1 decode status as an Integer where 0 indicates a successful decode.
• String MSR_TRACK2_STATUS_TAG = “com.motorolasolutions.emdk.datawedge.msr_track2_status”;
MSR track 2 decode status as an Integer where 0 indicates a successful decode.
• String MSR_TRACK3_STATUS_TAG = “com.motorolasolutions.emdk.datawedge.msr_track3_status”;
MSR track 3 decode status as an Integer where 0 indicates a successful decode.
Most scanning applications might want the user to be able to decode data and for that decode data to be sent
to the *current* activity but not necessarily displayed. If this is the case, then the activity needs to be marked
as ‘singleTop’ in its AndroidManifest.xml file. If your activity is not defined as singleTop, then on every decode,
the system will create another copy of your Activity and send the decode data to this second copy.
Finally there will be a configuration option for each process plug-in so that the process plug-in can be
configured specifically for the intent output, which in this case is the basic data formatting process plug-in.

K Kutir Mobility

If you just want to scan barcodes into any field and do not need much control over the process, you may want to look into using Datawedge, which lets you press the trigger buttons on the back of the ET1 to scan and sends the result to your application.

Thanks,
Javier
Kutir Mobility

CONTACT
Can’t find what you’re looking for?