Android Question How to determine data entered or scanned

Ronald Berardinis

Member
Licensed User
I need to determine if a barcode is scanned or data entered.
This is for handheld like Zebra MC3300 running Android 7.0.
In windows, I tested when someone started to type and then calculated the elapse time.
If longer that 1/2 second then the user entered the text.

Is there a better way?
 

emexes

Expert
Licensed User
If your way works, stick with it. On a related note: if your aim is to prevent users from manually typing barcodes, then bear in mind that a paste operation of copied text could be interpreted as a scan.

Looking at the device manual (I think):

https://www.zebra.com/content/dam/zebra_new_ia/en-us/manuals/mobile-computers/mc33-ig-en.pdf

there are two other methods that might work, assuming that the DataWedge scanner interface software/"driver" is being used.

1/ according to page 96, the barcode scanner has three output (send) methods:
- keystroke output
- intent output
- IP (network) output
and so perhaps you could use the intent or IP method. Presumably this would hide the barcodes from appearing on screen - bonus!

2/ according to page 121, the keyboard output method has options including:
- Prefix to data - Add characters to the beginning of the data when sent.
- Suffix to data - Add characters to the end of the data when sent.
and so you could use some non-barcodey hard-to-type character(s) to tag barcodes from the scanner

2.1/ another keyboard output option is:
- Send as hex - Set to send the data in hexadecimal format.
which might be useful if you don't want the user to see (human-)readable barcodes.

It should be possible to configure these items from your app, using intents.
 
Upvote 0

Ronald Berardinis

Member
Licensed User
emexes
thank you.
I will need to investigate.
The idea to send a character with the barcode scan is interesting.
Hiding the barcode is not a issue.
Just need to select certain prompts to be scanned only while other prompts can be entered or scanned.

thank you again.
Ron
 
Upvote 0

emexes

Expert
Licensed User
ASCII 96 = backwards apostrophe, is a good one - discreet (small, unnoticed), benign, and even if someone did spot it on the screen, they'd likely misread it as a normal apostrophe.

If your app is for general use (eg, sale on Playstore) then remember that you can configure the scanner settings programatically using intents, rather than people having to muck around inside the DataWedge software.
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
2 words, Broadcast Receiver.
There's a good chance that it transmit/broadcasts the scanned data in bytes if the built-in default software has the setting, try looking for 'Intent' or 'BroadcastReceiver' in the original SDK from the manufacturer, that's if you can get it.
 
Upvote 0
Top