QR / Barcode Scanner

Overview

Scan QR Codes and Barcodes directly into your app via the device camera. Used for in-store retail shopping, warehouse management, data center operations, etc.

Our Barcode Scanning Native Plugin is built using open source libraries which have been extended and customized for the GoNative platform. As a result there are no ongoing usage fees or limitations.

For Android, we utilize the Zebra Crossing library at https://github.com/zxing/zxing
For iOS, we utilize the hyperoslo library at https://github.com/hyperoslo/BarcodeScanner

Implementation Guide

Once the QR/Barcode Scanner Native Plugin has been added to your app, you may use the following GoNative JavaScript Bridge commands to access its functionality.

To scan a barcode call the JavaScript Bridge function gonative.barcode.scan() as shown further below.

The native scanner UI will launch within your app. Upon scan completion focus will return to the webview where an object in the following format will be returned.

{
  "success": true|false,
  "type": STRING,
  "code": STRING,
  "error": STRING
}

↔️GoNative JavaScript Bridge

// Callback method
gonative.barcode.scan({'callback': process_barcode});

function process_barcode(data) { 
  if (data.success) {
     alert('got barcode', data.code); 
  }
}

// Promise method
gonative.barcode.scan().then(function (data) {
  if (data.success) {
    alert('got barcode', data.code); 
  }
});

Learn more about using promises and the GoNative JavaScript Bridge.