2.1.5 • Published 7 years ago

cordova-internal-plugins-multiscanner-myboard v2.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Sephora cordova plugins - MultiScanner MyBoard

Presentation

Cross-platform BarcodeScanner for Cordova by Xebia, based on BarcodeScanner plugin for PhoneGap. Modified for MyBoard

Features

  • Scan a barcode with the camera or the Linea Pro device.

Compatibility

  • iOS only
  • this version is compatible with LineaPro 5 6 and 7 only
  • this version is visually modified for MyBoard only

Installation

Add as a cordova dependency, in config.xml (with Cordova 6.x or higher)

 <plugin name="cordova-internal-plugins-multiscanner-myboard" spec="http://gitlab.estore.caas/cordova-plugins/multiscanner-myboard#2.0.0" />

Using the plugin

The plugin creates the object cordova/plugin/BarcodeScanner with the method scan(success, fail).

iOS

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • ITF

success and fail are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.

A full example could be:

   cordova.plugins.barcodeScanner.scan(
      function (result) {
          alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
      }, 
      function (error) {
          alert("Scanning failed: " + error);
      }
   );

Encoding a Barcode

The plugin creates the object cordova.plugins.barcodeScanner with the method encode(type, data, success, fail). Supported encoding types:

  • TEXT_TYPE
  • EMAIL_TYPE
  • PHONE_TYPE
  • SMS_TYPE

A full example could be:

   cordova.plugins.barcodeScanner.encode(BarcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
  	        alert("encode success: " + success);
  	      }, function(fail) {
  	        alert("encoding failed: " + fail);
  	      }
  	    );

Credits

So many -- check out the original iOS and Android repos.