Detect [Enter] Key Pressed (NOT Taifun)

Hi everyone. I'm building a point of sale app from the ground up using AI2. I have a Urovo DT40 barcode scanning device and was wondering if there was an extension that monitors HARDWARE keypresses. Taifun Textbox only seems to work with the software based keyboards. The reason I need to monitor a hardware keypress is to know when something has been scanned, since the last character of a scan is a carriage return. I can then take the scanned barcode and add the corresponding item to a transaction.

If there is an alternative to Taifun Textbox please let me know. TIA!

Dear @RYoder97,
IMHO the problem is more related to how Android handles physical keyboards, rahter than to AI2.
By googling a bit with tags like "hardware keyboard Android" I've found many hints and suggestions, that refer to the Android input settings, others hints refer to apps that can monitor the HW keyboards, on PlayStore.
I agree that this answer is not the solution, but just a hint. To implement something specific, it would be necessary to know how the HW keys of the DT40 device enter the operating system (i.e. a physical interrupt / USB / other / ? ).
Maybe a JS that interfaces at low level the OS can do the job.


  1. Use multiline textbox
  2. Run a clock timer to check last character (e.g. every 100ms)
  3. If last character = \n, then do your thing....

Example, for a different requirement:

1 Like

Show your blocks for recieving a barcode scan, there should be an after scan event you can use ?

Native barcodeScanner (misnomer, only scans qr codes)

Dear @RYoder97,
in addition to what TIM says, you could take a look to

They have API's featuring an interface with Android. Unfortunately this specific API is intended for Android Studio and they require license fees, anyway it could be an hypotesis: to launch an app that is capable to scan the barcode, and that makes available tha scanned data with an API.

Thanks for your reply, but I'm not using the camera to scan things. I'm using an actual hardware barcode scanner. Plus I need to be able to scan 1D codes like UPC and Code128, not QR codes.

Thanks, but I wouldn't know where to begin with that since I don't really know Java. I was hoping someone knew of an already established extension for AI2.

I will ask again....

But I believe that this device should be supplied with its own barcode reader app. And, within the features of this app, there could be possibly available an option to save the read barcode on a log file ? If yes, it's quite easy for your app to read the saved file, retrieve the barcode and to do the relevant job.
I mean: whenever you want to read a barcode you launch as an external activity the app of the manufacturer, the app saves the read barcode on a file, your app re-gains control and read the file with the barcode.
Do you already have at your hands the DT40 ? If yes, are there any reference to a proprietary software and its characteristics ?

Update: solved by adjusting scanner settings. Added line feed suffix to every scan (\n) and listened for onTextChanged with Taifun to check if the last input was \n, then trimmed the string and processed only the numerical data.

Easy !!!!
Great !!!

so please mark @TIMAI2 suggestion as the solution.. (post 3)

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.