Read Barcode
Learn:
Requirements
- Android smartphone - example does not run on the emulator
- Download to your smartphone the ZXing ("Zebra Crossing") program. ZXing is an open-source, multi-format 1D/2D barcode image processing library.
Do try out the ZXing program first to familiarise with its operations before running the example program below.
This program reads the barcode.
barcode.py
import android
droid = android.Android()
(id, result, error) = droid.scanBarcode()
print result['extras']['SCAN_RESULT'], error
Code Explained
The barcode text is returned in result['extras']['SCAN_RESULT']