title: Using built-in barcode scanner in an Android app
body: <p>I'm building an app that among other features should be able to scan different barcodes and process the information obtained. The device, this app will be running on(Honeywell CT50) has a built-in scanner. I am aware of ZXing but for this app, it is necessary to be able to use the built-in scanner because it is much faster and easier to handle.</p>
  
  <p>My question is how to properly integrate such a built-in scanner in my app. When the scanner reads a barcode, the corresponding numbers will always be sent to whatever the device is currently doing. This means that for example if I create a textfield and set the focus to it, as soon as I scan something, the numbers will be copy-pasted right into this textfield, meaning that I do not need to somehow programmatically access the scanner. However, this also means that my app will not know when something has been scanned successfully. I want to prevent, having an OK button next to this textfield so I need to tell the app when it should start processing the data entered. I can not do this via a TextChangedListener because basically, the device pastes number by number of the barcode into the textfield instead of pasting the whole thing at once so the event would execute right after the first digit.</p>
  
  <p>I know that it is possible (at least on this device) to define a prefix and a suffix for the built-in scanner so I could for example tell it to always push the ENTER key each time a barcode is read and filter this by using a TextChangedListener. The problem with this is that there are other pre-installed apps on this device too which will not work properly if changes like this are made so unfortunately, this is not an option.</p>
  
  <p>All in all I'm not even sure if I'm approaching this in the right way. It seems like it would be required that I somehow catch certain events fired by the built-in scanner in the program code of my app but I do not know how.</p>