Appery QR and Barcode Scanner

The plugin provides a qr and barcode scanner utilizing the Google ML Kit Vision library on iOS and Android. The MLKit library is incredibly performant and fast.


Barcode Support

1d formatsAndroidiOS
Codabar
Code 39
Code 93
Code 128
EAN-8.
EAN-13
ITF
MSI
RSS Expanded
RSS-14
UPC-A
UPC-E
2d formatsAndroidiOS
Aztec
Codablock
Data Matrix
MaxiCode
PDF417
QR Code

ℹ️ Note that this API does not recognize barcodes in these forms:

  • 1D Barcodes with only one character
  • Barcodes in ITF format with fewer than six characters
  • Barcodes encoded with FNC2, FNC3 or FNC4
  • QR codes generated in the ECI mode

Usage

To use the plugin simply call window.cordova.plugins.mlkit.barcodeScanner.scan(options, sucessCallback, failureCallback). See the sample below.

window.cordova.plugins.mlkit.barcodeScanner.scan({}, (error, result) => {
  if (error) {
    // Error handling
  } else if (result) alert(JSON.stringify(result));
});

Plugin Options

The default types option is shown below.

{
  types: {
    Code128: true,
    Code39: true,
    Code93: true,
    CodaBar: true,
    DataMatrix: true,
    EAN13: true,
    EAN8: true,
    ITF: true,
    QRCode: true,
    UPCA: true,
    UPCE: true,
    PDF417: true,
    Aztec: true
  }
}

Alternatively, the list of allowed formats can be provided as a string value.

{formats : "QR_CODE,PDF_417,CODE_128,CODE_39,CODE_93,CODABAR,DATA_MATRIX,EAN_8,EAN_13,ITF,UPC_A,UPC_E,AZTEC"}

Output/Return value

result: {
  cancelled: boolean;
  text: string;
  format: string | undefined;
  type: string | undefined;
}