メインコンテンツまでスキップ
バージョン: v6

@capacitor/barcode-scanner

Outsystems Barcodeライブラリを使用したCapacitorプラグイン

Install

npm install @capacitor/barcode-scanner
npx cap sync

Android

You will need to modify the allprojects > repositories section in your android/build.gradle file to include the Outsystems repository. Your android/build.gradle file should look similar to this after adding the repository.

allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://pkgs.dev.azure.com/OutSystemsRD/9e79bc5b-69b2-4476-9ca5-d67594972a52/_packaging/PublicArtifactRepository/maven/v1'
name 'Azure'
credentials {
username = "optional"
password = ""
}
content {
includeGroup "com.github.outsystems"
}
}
}
}

API

Interface defining the contract for a plugin capable of scanning barcodes. Requires implementation of the scanBarcode method, which initiates a barcode scan with given options.

scanBarcode(...)

scanBarcode(options: CapacitorBarcodeScannerOptions) => Promise<CapacitorBarcodeScannerScanResult>
ParamType
options
CapacitorBarcodeScannerOptions

Returns:

Promise<CapacitorBarcodeScannerScanResult>


Type Aliases

CapacitorBarcodeScannerScanResult

Defines the structure of the result returned from a barcode scan.

{ ScanResult: string }

CapacitorBarcodeScannerOptions

Defines the options for configuring a barcode scan.

{ hint: CapacitorBarcodeScannerTypeHint; scanInstructions?: string; scanButton?: boolean; scanText?: string; cameraDirection?: CapacitorBarcodeScannerCameraDirection; scanOrientation?: CapacitorBarcodeScannerScanOrientation; android?: { scanningLibrary?: CapacitorBarcodeScannerAndroidScanningLibrary; }; web?: { showCameraSelection?: boolean; scannerFPS?: number; }; }

CapacitorBarcodeScannerTypeHint

Extends supported formats from Html5Qrcode with a special 'ALL' option, indicating support for all barcode types. Type definition combining Html5QrcodeSupportedFormats and OSBarcodeTypeHintALLOption to represent the hint for the type of barcode to be scanned.

Html5QrcodeSupportedFormats | CapacitorBarcodeScannerTypeHintALLOption

Enums

Html5QrcodeSupportedFormats

MembersValue
QR_CODE0
AZTEC1
CODABAR2
CODE_393
CODE_934
CODE_1285
DATA_MATRIX6
MAXICODE7
ITF8
EAN_139
EAN_810
PDF_41711
RSS_1412
RSS_EXPANDED13
UPC_A14
UPC_E15
UPC_EAN_EXTENSION16

CapacitorBarcodeScannerTypeHintALLOption

MembersValue
ALL17

CapacitorBarcodeScannerCameraDirection

MembersValue
BACK1
FRONT2

CapacitorBarcodeScannerScanOrientation

MembersValue
PORTRAIT1
LANDSCAPE2
ADAPTIVE3

CapacitorBarcodeScannerAndroidScanningLibrary

MembersValue
ZXING'zxing'
MLKIT'mlkit'