Below is an index of all the methods available.
prepare(options?: ScanOptions | undefined) => Promise<void>
hideBackground() => Promise<void>
showBackground() => Promise<void>
startScan(options?: ScanOptions | undefined) => Promise<ScanResult>
Returns: Promise<ScanResult>
startScanning(options?: ScanOptions | undefined, callback?: ((result: ScanResult, err?: any) => void) | undefined) => Promise<CallbackID>
Returns: Promise<string>
pauseScanning() => Promise<void>
resumeScanning() => Promise<void>
stopScan(options?: StopScanOptions | undefined) => Promise<void>
checkPermission(options?: CheckPermissionOptions | undefined) => Promise<CheckPermissionResult>
Returns: Promise<CheckPermissionResult>
openAppSettings() => Promise<void>
enableTorch() => Promise<void>
disableTorch() => Promise<void>
toggleTorch() => Promise<void>
getTorchState() => Promise<TorchStateResult>
Returns: Promise<TorchStateResult>
Prop |
Type |
Description |
Since |
targetedFormats |
SupportedFormat[] |
This parameter can be used to make the scanner only recognize specific types of barcodes. If targetedFormats is not specified or left empty, all types of barcodes will be targeted. |
1.2.0 |
cameraDirection |
CameraDirection |
This parameter can be used to set the camera direction. |
2.1.0 |
Prop |
Type |
Description |
Since |
hasContent |
boolean |
This indicates whether or not the scan resulted in readable content. When stopping the scan with resolveScan set to true , for example, this parameter is set to false , because no actual content was scanned. |
1.0.0 |
content |
string |
This holds the content of the barcode if available. |
1.0.0 |
format |
string |
This returns format of scan result. |
2.1.0 |
Prop |
Type |
Description |
Default |
Since |
resolveScan |
boolean |
If this is set to true , the startScan method will resolve. Additionally hasContent will be false . For more information see: capacitor-community#17 |
true |
2.1.0 |
Prop |
Type |
Description |
Since |
granted |
boolean |
When set to true , the ermission is granted. |
|
denied |
boolean |
When set to true , the permission is denied and cannot be prompted for. The openAppSettings method should be used to let the user grant the permission. |
1.0.0 |
asked |
boolean |
When this is set to true , the user was just prompted the permission. Ergo: a dialog, asking the user to grant the permission, was shown. |
1.0.0 |
neverAsked |
boolean |
When this is set to true , the user has never been prompted the permission. |
1.0.0 |
restricted |
boolean |
iOS only When this is set to true , the permission cannot be requested for some reason. |
1.0.0 |
unknown |
boolean |
iOS only When this is set to true , the permission status cannot be retrieved. |
1.0.0 |
Prop |
Type |
Description |
isEnabled |
boolean |
Whether or not the torch is currently enabled. |
string
Members |
Value |
Description |
UPC_A |
'UPC_A' |
Android only, UPC_A is part of EAN_13 according to Apple docs |
UPC_E |
'UPC_E' |
|
UPC_EAN_EXTENSION |
'UPC_EAN_EXTENSION' |
Android only |
EAN_8 |
'EAN_8' |
|
EAN_13 |
'EAN_13' |
|
CODE_39 |
'CODE_39' |
|
CODE_39_MOD_43 |
'CODE_39_MOD_43' |
iOS only |
CODE_93 |
'CODE_93' |
|
CODE_128 |
'CODE_128' |
|
CODABAR |
'CODABAR' |
Android only |
ITF |
'ITF' |
|
ITF_14 |
'ITF_14' |
iOS only |
AZTEC |
'AZTEC' |
|
DATA_MATRIX |
'DATA_MATRIX' |
|
MAXICODE |
'MAXICODE' |
Android only |
PDF_417 |
'PDF_417' |
|
QR_CODE |
'QR_CODE' |
|
RSS_14 |
'RSS_14' |
Android only |
RSS_EXPANDED |
'RSS_EXPANDED' |
Android only |
Members |
Value |
FRONT |
'front' |
BACK |
'back' |