Skip to content

pierresh/cordova-plugin-ia-mlkit-scanner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLKit Barcode Scanner

Latest Stable Version Total Downloads

Scan barcodes using Google MLKit.

This plugin is improved version of cordova-plugin-ia-mlkit-scanner plugin.

New features are:

  • replace red lines with a white rectangle
  • animation to simulate scanning
  • fullscreen (also includes status bar)
  • move torch button below the white rectangle
  • can display a prompt text in bottom of the screen

Drawback:

  • only use back camera
  • remove the input box

Screenshot

Local installation

cordova plugin add https://github.com/pierresh/cordova-plugin-ia-mlkit-scanner

Usage

Barcode Scanner

To call up the barcode scanner, refer to this example code for Typescript:

function onSuccess(barcode) {
  console.log("Success:" + barcode);
}

function onError(message) {
  console.log("Error:" + message);
}

(<any>window).window["MLKitBarcodeScanner"].scanBarcode({ prompt: "Scan a barcode"}, onSuccess, onError);

Check Play Service Availability (ANDROID)

As this plugin is based on Google's MLKit, Play services is required for it to function correctly on Android devices. You can check if the host device has support, by calling checkSupport:

function onSuccess(isSupported) {
  console.log("Has Support: " + isSupported);
}

function onError(message) {
  console.log("Error: " + message);
}

(<any>window).window["MLKitBarcodeScanner"].checkSupport(onSuccess, onError);

About

Google MLKit barcode scanning plugin for Cordova

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 72.1%
  • Objective-C 27.1%
  • JavaScript 0.8%