USB Barcode Scanning on Android
This article will describe USB-based barcode scanners and how they can be used with an Android device. It will provide some advantages to using a native Android API, like EPX-B from SDG Systems.
Edit 6/12/2020: EPX-B has been replaced with ID-Engine, our barcode and RFID middleware.
One change that is continuing to occur in the mobile computer market is that users are seeking application-appropriate hardware for their environment, and searching for the best value. In some cases, like Point-of-Sale (POS), a consumer tablet may make sense, especially if the device will be stationary. For a POS tablet, however, one needs full barcode scanning capability, which is not available in “stock” Android. SDG Systems has addressed this enterprise deficiency in Android with its Enterprise Platform eXtensions (EPX) for Android (now ID-Engine). As of June 2014, EPX includes support for barcode scanning (EPX-B) and RFID (EPX-R), providing a software developer’s kit (SDK) for writing native Android apps, and giving full access to the barcode scanner or RFID reader. This article will describe USB-based barcode scanners and how they can be used with an Android device. It will provide some advantages to using a native Android API.
A USB barcode scanner typically consists of a “head”, that is, a laser scanner or optical imager, a decode board, and a hardware trigger. The laser or imager “reads” the barcode data and gives it to the decoder. The decoder converts the lines, circles or squares into human-readable letters and numbers (e.g. ASCII characters), and the data is transmitted over the USB cable to the host computer. The trigger can be used to initiate the scanning process.
This type of barcode scanner generally has two modes. The first is HID mode, or human-interface device, like a USB keyboard. The host system sees the barcode scanner as a keyboard, and data is entered as if it is typed from an external keyboard. The other is a native mode, like USB Serial, and data conforming to a protocol is transmitted over the bus to communicate with the host. One such protocol is Symbol Native API, or SNAPI, used in scanners from Motorola and others.
HID mode is beneficial if you are scanning into a web or HTML5 application, or you need to scan data into a text field of an existing app. You simply focus the input on a text field, pull the trigger and the barcode data will be read into the text field. That simplicity is also a hindrance, at times, in that it forces you to have a text field. What if you’re reading product SKUs and you want a picture of the item or the item name to appear on the screen? That requires using the EPX-B API (application programming interface) from the SDK in your application.
For many applications, native mode is preferred. As delivered from Google, Android does not support a barcode scanning API. Using the EPX-B API gives the developer full control of the scanner. This control can be useful in a variety of circumstances. For example, you can initiate a scan from the application (instead of using the trigger), which can be helpful if the scanner is mounted, rather than in your hand. Another example is that you can disable barcode symbologies that you are not using, a great help if you’re scanning only PDF417 driver’s licenses and you don’t want to scan any other barcodes. Other options like continuous scanning, scanning from a pick-list, etc., provide features not available with HID mode. With the API, your application becomes much more flexible and user-friendly. The EPX-B API documentation shows the full functionality available.
We have recorded a simple demonstration on YouTube of the EPX-B API running on a Samsung Galaxy Tab Pro 10.1 using a Motorola DS6707 SNAPI-based scanner. It uses our Motorola / Symbol SNAPI driver for Android. Do you need other USB scanners supported or an Android application developed? Our plugin architecture allows us, or you, to add new scanners in a straightforward manner, and our team of engineers has extensive Android experience. Please let us know how we can help with your scanning or application needs.