Get the scanned data using DataWedge inside Enterprise Browser as JavaScript callback

A Abhineet Agarwal 3 years 8 months ago
210 1 0

The Enterprise Browser application makes it possible to acquire the barcode data as JavaScript callback which is scanned through DataWedge inside Enterprise Browser application on Android platform.
This blog explains how to scan and process barcode data using DataWedge inside Enterprise Browser application as JavaScript callback.
 
Follow the below instructions as mentioned below:

Configuration at DataWedge end

Note: The below DataWedge configuration is applicable from version 6.0.1 and higher.

Configuration at Enterprise Browser end

 
Configuration at DataWedge(v 6.0.1 & higher) end:

Open DataWedge Application. The DataWedge Profiles panel will appear.
Go to DataWedge Settings - From the DataWedge Profiles screen, tap the menu which appears at top right and select Settings. The DataWedge Settings panel will appear.
From the DataWedge Settings panel, tap Disabled app list.

A list appears showing all installed apps and packages where DataWedge is disabled.
Ensure to remove/delete the Enterprise Browser app from the list so that DataWedge is enabled inside Enterprise Browser.

Go back to DataWedge Profiles screen and select the profiles i.e. Profile0 (default).
Profile0 (default) panel will appear. Apply the below settings in this profile:

Ensure Profile enabled field is checked.
Ensure Barcode input – Enabled field is checked.
Scroll down till Intent output field inside Profile0 (default) panel and apply the below settings:

Ensure Intent output – Enabled field is checked.
Set Intent action as com.symbol.dw.action
Set Intent delivery as Broadcast intent

 
Configuration at Enterprise Browser end:

Download and Install Enterprise Browser binary on Zebra Android Device supported by Enterprise Browser application. Enterprise Browser is available here.
Launch Enterprise Browser for extracting Enterprise Browser Config.xml which is used for setting the runtime configuration parameters of Enterprise Browser application.

After launch, extract Config.xml from "//Android/data/com.symbol.enterprisebrowser" present on the device. Here refers to "/sdcard" or "/sdcard1" etc., depending on the Zebra Android device used.

Open Config.xml and apply the below settings:

Set "usedwforscanning"  tag to 1 in Config.xml. This is used for enabling DataWedge inside Enterprise Browser application. For more details, refer to Enterprise Browser - DataWedge documentation.

   
      ....
     
      ....
   
 
 
 

Enable the IntentReceiver tags in Config.xml as shown below. For more details, refer to Enterprise Browser - Intent Receiver documentation.

Set "EnableReceiver" tag to 1 in Config.xml.
Set "IntentAction" value to "com.symbol.dw.action" in Config.xml.

   
      ....
     
       
       
       
     
      ....
   
 
 

Set "StartPage" tag to TestPage.html in Config.xml as shown below.

                         Note:

In the above example, I am storing TestPage.html inside Enterprise Browser installed directory present in the device.
TestPage.html has a logic where scanned data using DataWedge is getting captured through JavaScript callback inside Enterprise Browser application.
TestPage.html logic is covered below.

4. Copy updated Enterprise Browser Config.xml to the Enterprise Browser installed directory in the device after all the above mentioned settings are applied.
5. Create TestPage.html as shown below and place the same inside Enterprise Browser installed directory in the device.
Note:

ebapi-modules.js is used for accessing the Enterprise Browser JavaScript API's.

TestPage.html captures the scanned data as JavaScript callback using Enterprise Browser Intent API.

EB Test Page
 
 
        var outputData = "";
function myIntentListenerCallback(myIntentData){
if((myIntentData != null) && (myIntentData.action == "com.symbol.dw.action")){
var dataWedgeScannedData = myIntentData.data;
outputData = " Scanned Data: " +
" Intent Type:" + myIntentData.intentType + "" +
" Intent Action:" + myIntentData.action + "" +
" Decode Source:" + dataWedgeScannedData["com.symbol.datawedge.source"] + "" +
" Decode Label Type:" + dataWedgeScannedData["com.symbol.datawedge.label_type"] + "" + 
" Decode Data:" + dataWedgeScannedData["com.symbol.datawedge.decode_data"] + "" +
" Decode Data String:" + dataWedgeScannedData["com.symbol.datawedge.data_string"] + "";
var ouptutDiv = document.getElementById("myIntentDataDiv");
ouptutDiv.innerHTML = outputData;
}
}
function startIntentListener()
{
var startListeningDiv = document.getElementById("intentMessageDiv");
startListeningDiv.innerHTML = "Enterprise Browser is listening the DataWedge Intent. Scan any data using DataWedge.";
EB.Intent.startListening(myIntentListenerCallback);
}
function registerIntent(){
startIntentListener();
}
 

EB Test Page

Scanned Data:

Also attaching the Enterprise Browser Config.xml, TestPage.html and ebapi-modules.js for everyone reference.
 
This is how one can use to get the scanned data inside Enterprise Browser application scanned through DataWedge using Intent.

Please Register or Login to post a reply

1 Replies

S Scott Mulder

Unbelievably helpful! This is the first place I was able to make sense of this through all of Zebra's DW and EB documentation and API Ref.

CONTACT
Can’t find what you’re looking for?