![]() |
Barcode Xpress Mobile for Android
|
This SDK provides the Barcode Xpress native recognition library and Java source code examples that demonstrate how to access it.
The source code is divided into two layers.
The Java sources are located in src/main/java/com/accusoft/BarcodeXpress. The native recognition library is delivered as a shared library, located at BXAPI/BXAPI/src/main/jniLibs/armeabi/libAccusoft.BarcodeXpress.so.
BarcodeXpress Mobile supports recognition of the full set of the types supported by the full version of Barcode Xpress. These are listed in supported barcode types.
Deployment of Barcode Xpress Mobile is licensed on a per situation basis and requires a licensing agreement with Accusoft. The Barcode Xpress Mobile SDK requires a license key to be compiled into the source code of your application. Complete a licensing agreement with an Accusoft Sales Representative and receive the license key. Our licenses are designed to work for only one application. So, we require the package name or applicationId of your application to make an appropriate license.
For example, com.accusoft.BarcodeXpress.BXCameraSample is the applicationId and package name of our BXCameraSample demonstration application. This can be found in the "defaultConfig" section of BXCameraSample/BXCameraSample/build.gradle.
Note: This string is case sensitive.
When you have the package name, contact sales@accusoft.com to obtain a license or for more information.
SDK users with an existing application will be interested primarily with BXAPI. It provides methods that accept images in several formats and it makes calls into the native recognition library for barcode decoding. It also provides utility methods for obtaining the library version, specifying the required license key, and setting the types of barcodes that will be recognized. The native recognition library has the optional ability to detect and reject blurred images. Important methods are:
The BXLicense class holds information from the Accusoft license, primarily the license key. Until a valid license key is provided, the license key contained in the sources of BXCameraSample or BXFileSample may be used and will result in the final character of every decoded value being replaced with an asterisk (*). The constructor for BXAPI requires a BXLicense and image recognition by the native library will not be performed if the license is invalid. Sample BXLicense constructor:
BXLicense(String OEMKey, Application application, long solutionKey1, long solutionKey2, long solutionKey3, long solutionKey4)
Note: The OEMKey string is provided by Accusoft upon completion of a licensing agreement, and that the solutionKey1, solutionKey2, solutionKey3, and solutionKey4 parameters are currently un-used.
The BXTypeConstants class defines the constants from which you build the set of barcode types you want the library to decode. This value would then be used as a parameter to one of the recognition methods of BXAPI.
The BXResult class contains the result of recognition by the native library. It contains points that describe a rectangle locating the barcode inside the image. It also contains decoding status, confidence, decoded data, and the barcode type. The class has methods to return information about what was learned by decoding the image:
The BXCameraSample is right for you if you are looking for a simple Android application to scan barcodes with the camera and display decoded results. Android applications interact with the hardware using an event-driven interface called an Activity. The Activity model means that certain actions are done in callbacks. BXCameraSample provides callbacks that happen at key points in the application, such as when an image frame has been obtained from the camera or when decoding results are available. These callbacks allow for insertion of customized code to be run at key points during application execution.
Specifically, the following callbacks are provided by BXCameraSampleActivity.java:
When onBarcodeRecognition(Bundle msgBundle) is called, the msgBundle parameter may be used as follows:
In addition, the method setBarcodeTypes(long barcodeTypes) is provided to allow you to enable or disable the recognition of any of the supported barcode types.
The BXAPI.BXLicense class holds information from the Accusoft license. The constructor for BXAPI requires a BXLicense; image recognition by the native library will not be performed if the license key is invalid. It would be appropriate to set the license in BXCameraSample.onStartBarcodeXpress(). The BXCameraSample class will then handle setting the license in a manner that will allow the recognition library to proceed successfully.
The BXFileSample is right for you if you want to see the mechanism for integrating Barcode Xpress, without all the complexity of camera management. It shows the basic operations necessary to decode an image and use the results. The image file that it decodes is located in res/drawable-nodpi/barcode.bmp.
Things you will want to customize for your own build of either demo application are as follows:
res/drawable-hdpi/icon_demo.png res/drawable-mdpi/icon_demo.png res/drawable-ldpi/icon_demo.png
If you already have your own application and are integrating Barcode Xpress, you will want to include BXAPI as a dependency.
This BXCameraSample requires the following permission setting, found in AndroidManifest.xml:
android.permission.CAMERA
To write data to the SD card, you need to add the following below the existing uses-permission elements:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
To read data from the SD card, you need to add the following below the existing uses-permission elements:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Use the following instructions as a guideline to load, run and deploy the sample applications.
NOTE: These instructions should be used with Android Studio.