An Android Library based on ZXing Library with support for Portrait Orientation
and some cool stuffs.
Provide the gradle dependency
compile 'me.sudar:zxing-orient:[email protected]'
Start the Scanner
new ZxingOrient(MainActivity.this).initiateScan();
Handle the Result
@Override
public void onActivityResult(int requestCode, int resultCode, Intent intent){
ZxingOrientResult scanResult =
ZxingOrient.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
// handle the result
...
}
...
}
Note : In API 23
and above, don't forget to request permission for Manifest.permission.CAMERA
before calling ZXing Orient.
Selection of Specific Barcode Types:
void initiateScan(Collection<String> desiredBarcodeFormats);
void initiateScan(Collection<String> desiredBarcodeFormats, int cameraId)
Some Formats include:
Barcode.PRODUCT_CODE_TYPES /** Collection of UPC_A, UPC_E, EAN_8, EAN_13, RSS_14 **/
Barcode.ONE_D_CODE_TYPES /** Collection of UPC_A, UPC_E, UPC_EAN_EXTENSION, EAN_8, EAN_13,
CODABAR, CODE_39, CODE_93, CODE_128, ITF, RSS_14, RSS_EXPANDED **/
Barcode.TWO_D_CODE_TYPES /** Collection of QR_CODE, DATA_MATRIX, PDF_417, AZTEC **/
Barcode.EAN_8
Barcode.RSS_14
Barcode.CODABAR ...
Barcode.QR_CODE
Barcode.DATA_MATRIX ...
For all other supported types, take a look at Barcode.java
Selection of Camera
void initiateScan(int cameraId);
void initiateScan(Collection<String> desiredBarcodeFormats, int cameraId);
UI Settings
ZxingOrient integrator = new ZxingOrient(MainActivity.this);
integrator.setIcon(R.drawable.custom_icon) // Sets the custom icon
.setToolbarColor("#AA3F51B5") // Sets Tool bar Color
.setInfoBoxColor("#AA3F51B5") // Sets Info box color
.setInfo("Scan a QR code Image.") // Sets info message in the info box
.initiateScan(Barcode.QR_CODE);
new ZxingOrient(Activity.this)
.showInfoBox(false) // Doesn't display the info box
.setBeep(false) // Doesn't play beep sound
.setVibration(true) // Enables the vibration
.initiateScan();
To generate QR codes add this line when necessary
new ZxingOrient(thisActivity).shareText("Some Random Text");
This library is available under the Apache License, Version 2.0.