-
Notifications
You must be signed in to change notification settings - Fork 23
SmartScannerActivity Intent extra reference
jlduragos edited this page Nov 6, 2023
·
1 revision
There are Smartscanner options that you can pass to SmartScannerActivity intent to change the behaviour, UI, result, etc. depending on how you want to use the features.
Here is an example on how you can pass the options:
val intent = Intent(this, SmartScannerActivity::class.java)
intent.putExtra(
SmartScannerActivity.SCANNER_OPTIONS,
ScannerOptions(
mode = Modes.BARCODE.value, //specify which scanner/feature you would like to use
language = Language.EN, //available languages are Language.EN(English) and Language.AR(Arabic)
scannerSize = ScannerSize.SMALL.value, //specify scanner size
config = Config( //options for configuring user interface. See modes below for mode-specific config options
background = "#89837c", //Change scanner background color
branding = false, //shows branding when set to true
font = "ROBOTO" //Supported fonts are NOTO_SANS_ARABIC, ROBOTO & SOURCE_SANS_PRO
imageResultType = ImageResultType.PATH //set the result image type to either ImageResultType.PATH or ImageResultType.BASE_64
isManualCapture = false, //shows shutter button when set to true
header = ""
subheader = ""
label = ""
orientation = "portrait" //set scanner orientation to portrait or landscape
)
)
)
startActivityForResult(intent, OP_SCANNER)Available modes can be found in org.idpass.smartscanner.lib.scanner.config.Modes
Available scannerSizes can be found in org.idpass.smartscanner.lib.scanner.config.ScannerSize
ScannerOptions(
mode = Modes.BARCODE.value,
...
barcodeOptions = arrayListOf ( //specify barcode formats that you would like to scan
AZTEC.label,
CODABAR.label,
...
)
)Available barcode formats can be found in org.idpass.smartscanner.lib.scanner.config.BarcodeFormat
ScannerOptions(
mode = Modes.MRZ.value,
...
mrzFormat = MrzFormat.MRTD_TD1.value,
config = Config(
showGuide = true, //if set to true show MRZ target guide UI
widthGuide = 0, //set guide view width. default is View.MATCH_PARENT
heightGuide = 70, //set guide view height. Default is 70
..
)
)ScannerOptions(
mode = Modes.OCR.value,
..
ocrOptions = OCROptions(
regex = "\\d{4} \\d{4} \\d{5}", //ocr will only return text that matches the regex. Default will return all texts scanned
type = "documentNumber", //sets the type of texts you're scanning
analyzeStart = 1000 //adds delay on scanning, this will give time for user to focus on the texts they want to scan
)
config = Config(
showOcrGuide = true, //if set to true show OCR target guide UI. Default if false
xGuide = 0, //accepts values from 0.0 - 1.0. Offsets the guide horizontally based on percentage
yGuide = 0, //accepts values from 0.0 - 1.0. Offsets the guide vertically based on percentage
widthGuide = 0, //set guide view width
heightGuide = 70, //set guide view height
..
)
)