Skip to content

Cordova Bridge for the OutSystems Officially Supported Barcode Plugin.

License

Notifications You must be signed in to change notification settings

OutSystems/cordova-outsystems-barcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cordova-outsystems-barcode

This plugin is SUPPORTED by OutSystems. Customers entitled to Support Services may obtain assistance through Support.

A barcode scanner for your mobile application. Supports many popular encoding types of 1D and 2D barcodes, presented in the following table.

1D Barcodes

Code iOS Android's ML Kit Android's ZXing
Codabar ⚠️
(Available from 15.0)
Code 39
Code 93
Code 128
Databar (GS1) ⚠️
(Available from 15.0)
EAN-8
EAN-13
ITF
ITF-14
ISBN-10
ISBN-13
ISBN-13 Dual Barcode
RSSExpanded ⚠️
(Available from 15.0)
UPC-A
UPC-E

2D Barcodes

Code iOS Android's ML Kit Android's ZXing
Aztec Code
Data Matrix
MaxiCode
Micro PDF 417 ⚠️
(Available from 15.0)
Micro QR ⚠️
(Available from 15.0)
PDF 417
QR Code

Installation

cordova plugin add <path-to-repo-local-clone>

It's also possible to install via the repo's URL directly.

cordova plugin add https://github.com/OutSystems/cordova-outsystems-barcode

Supported Platforms

  • iOS
  • Android

Methods

Scan Barcode

cordova.plugins.OSBarcode.scanBarcode(options, successCallback, errorCallback);

An action that triggers the barcode reader. If successful, it returns the text associated with the scanned barcode as a String. In case of an error, it returns the associated error code and message (TODO: link to the table).

The action is composed of the following parameters:

  • options: A structure containing some configurations to apply to the barcode reader. It's composed of the following properties:
    • scanInstructions: A text containing the scanning instructions.
    • cameraDirection: An integer that indicates if the back (1) or front (2) camera will be used when triggering a new scan action.
    • scanOrientation: An integer that indicates which orientation will the scanner assume: Portrait (1), Landscape (2) or Adaptive (3). "Adaptive" uses the device's current orientation.
    • scanButton: A boolean that will display a scan button on the barcode reader. With the button, scanning will only be triggered when pressing the button instead of automatically when framing the barcode. A second click on the button disables scannning.
    • scanText: A text to be displayed on the scan button. It will only be shown if scanButton is set to true.
    • androidScanningLibrary: A text equivalent to the OSBarcodeConstants.AndroidScanningLibrary structure. It indicates which library will be used to perform the scan: MLKit or ZXing. As the name indicates, it's only applicable to "Android".
  • successCallback: A structure indicating that the action was successful. It returns a ScanResult: a text containing the value associated with the scanned barcode.
  • errorCallback: A structure indicating that the action was not successful. It returns an "error" structure, composed of:
    • code: A text containing the error code.
    • message: A text containing the error message.

Scan

cordova.plugins.OSBarcodeScanner.scan(options, successCallback, errorCallback);

Being the older way to trigger the barcode reader, this was kept to keep retro compatibility. This action calls the Scan Barcode action, with the possible outputs being the same.

The action is composed of the following parameters:

  • options: A structure containing some configurations to apply to the barcode reader. It's composed of the following properties:
    • scanInstructions: A text containing the scanning instructions.
    • cameraDirection: An integer that indicates if the back (1) or front (2) camera will be used when triggering a new scan action.
    • scanOrientation: An integer that indicates which orientation will the scanner assume: Portrait (1), Landscape (2) or Adaptive (3). "Adaptive" uses the device's current orientation.
    • scanButton: A boolean that will display a scan button on the barcode reader. With the button, scanning will only be triggered when pressing the button instead of automatically when framing the barcode. A second click on the button disables scannning.
    • scanText: A text to be displayed on the scan button. It will only be shown if scanButton is set to true.
  • successCallback: A structure indicating that the action was successful. It returns a ScanResult: a text containing the value associated with the scanned barcode.
  • errorCallback: A structure indicating that the action was not successful. It returns an "error" structure, composed of:
    • code: A text containing the error code.
    • message: A text containing the error message.

Errors

Code Message iOS Android
OS-PLUG-BARC-0004 Error while trying to scan code.
OS-PLUG-BARC-0006 Couldn't scan because the process was cancelled.
OS-PLUG-BARC-0007 Couldn't scan because camera access wasn’t provided. Check your camera permissions and try again.
OS-PLUG-BARC-0008 Scanning parameters are invalid.
OS-PLUG-BARC-0009 There was an error scanning the barcode with ZXing.
OS-PLUG-BARC-0010 There was an error scanning the barcode with ML Kit.

About

Cordova Bridge for the OutSystems Officially Supported Barcode Plugin.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published