.startScan(params)
Launches the camera and starts scanning for barcodes and QR codes.
Parameters:
- params Table Contains parameters for the call.
title optional
String Title text.
Default is SCAN BARCODE
useFrontCamera optional
Boolean Set to true
to use the front camera if it’s available. If it’s not available, the rear camera will be used.
Default is false
.
beepEnabled optional
Boolean Set to true
to hear a beep sound when the barcode/qrcode is scanned.
Default is false
.
barcodeFormat optional
String scan barcode format.
Default is all
Available formats:
"one-d": includes 'UPC_A', 'UPC_E', 'EAN_8', 'EAN_13', 'CODE_39', 'CODE_93', 'CODE_128', 'ITF', 'RSS_14', 'RSS_EXPANDED'
"qrcode": includes 'QR_CODE'
"product": includes 'UPC_A', 'UPC_E', 'EAN_8', 'EAN_13', 'RSS_14'
"data-matrix": includes 'DATA_MATRIX'
"all": includes all previous formats + 'PDF417', 'Aztec'.
onScanComplete optional
Listener Listener which receives the scan complete event when the scanning has been completed.
Example
local qrreader = require("plugin.qrreader")
qrreader.startScan( {
onScanComplete = function(event)
print(event.state) -- "completed" or "cancelled"
print(tostring(event.isError)) -- "true" or "false"
print(event.result) -- scanned data
end,
title = "SCAN QR CODE",
useFrontCamera = false,
barcodeFormat = "qrcode",
beepEnabled = true,
} )