Native Motorola/Zebra Barcode-Scanner with a Neptune Application

This guide aims to enable the use of Hardware specific scanners on Motorola/Zebra Android devices.

Prerequisites

The Datawedge application must be installed on the device.

Procedure

Enable the Datawedge plugin

Add the following to the config.xml file in the mobile build custom config.xml:

<plugin name="motorola-datawedge-cordova-plugin" source="npm"/>
<platform name="android">
  <preference name="AndroidLaunchMode" value="singleTop"/>
</platform>

Add the event listener to your app

The below snippet can be added to you init script:

document.addEventListener("deviceready", function() {

    if (window.datawedge) {

        datawedge.start(); //uses default

        datawedge.registerForBarcode(function(data) {

            var labelType = data.type,
                barcode = data.barcode;

            //sap.m.MessageToast.show("Barcode scanned.  Label type is: " + labelType + ", " + barcode);
            // Do your stuff with the scanned barcode here
        });
    }
});

Configure the Datawedge App

All that is left is to adjust and configure your Datawedge application:

  • Set up a Datawedge profile

  • Associate your application to the profile

  • Enable intent output

  • Set Intent action to com.bluefletch.motorola.datawedge.ACTION

  • Set Intent delivery to Broadcast intent

  • Intent category must be left empty

Result

You have achieved to utilize Motorola/Zebra barcode scanners seamlessly within a Neptune Application.