Configure DataWedge from EB

Enterprise Browser 3.0

Overview

Apps running on Enterprise Browser 2.0 (and higher) can control DataWedge–Zebra's built-in scanning engine–using DataWedge intents. This makes it possible to adjust DataWedge settings from an EB app to adapt to changing data acquisition requirements without exiting the app.

This guide illustrates the feature using a real-world example. It explains how to configure an EB app to scan and process barcode data, enter the captured data as keystrokes into any EB input field, and reconfigure DataWedge to switch the input type&nsdash; all using DataWedge intents from within the EB app.

Requirements


Using DataWedge

DataWedge settings are stored in Profiles, each of which contains parameters for acquiring data (input), processing the acquired data, and sending it to an app (output). This example solution walks through the process of configuring EB to use DataWedge and to receive the data it acquires, to create two DataWedge Profiles on the device and to switch from one to the other from an EB app. One Profile is configured for Barcode input, the other for SimulScan input, and both are set to output as an Intent Broadcast.

I. Enable DataWedge in EB

1. Confirm (or configure) the following Config.xml file settings:

  • Set a value of "1" in <usedwforscanning> tag.
  • Set a value of "1" in <EnableReceiver> tag.
  • Set a value of "com.symbol.dw.action" in a <IntentAction> tag.
  • Set a value of "com.symbol.dwss.action" in another <IntentAction> tag.
  • Set a value of "com.symbol.datawedge.api.RESULT_ACTION" in another <IntentAction> tag.
  • Set a value of "android.intent.category.DEFAULT" in the <IntentCategory> tag.
  • Set a value of "file://%INSTALLDIR%/DataWedgeIntent.html" in <StartPage> tag.

The settings described above are shown in context of a Config.xml file below. Settings in the IntentReceiver section allow EB app to retrieve scanned data through a JavaScript callback.

    
    <Applications>
        <Application>
        ...
            <usedwforscanning  value=”1” />
        ...
            <IntentReceiver>
                ...
                <EnableReceiver  value="1"/>
                <IntentAction  value="com.symbol.dw.action"/>
                <IntentAction  value="com.symbol.dwss.action"/>
                <IntentAction  value="com.symbol.datawedge.api.RESULT_ACTION"/>
                   <IntentCategory  value="android.intent.category.DEFAULT"/>
                ...
            <General>
                <Name value="Menu"/>
                <StartPage value="file://%INSTALLDIR%/DataWedgeIntent.html" name="Menu"/> 
        ...

II. Configure DataWedge

2. In DataWedge on the device, select Profiles -> Profile0 (default) and:

  • Confirm that "Profile 0" is enabled.
  • Confirm that Barcode Input is enabled.

3. Scroll down to the Intent Output section and set the following:

  • Confirm that Intent Output is Enabled.
  • Tap Intent action and enter com.symbol.dw.action and Tap OK.
  • Tap Intent delivery and select (or confirm) “Broadcast Intent” and Tap OK.

Settings should appear as in the image below: Profile0 settings for using DataWedge from EB apps.

III. Deploy JavaScript

4. Create or modify a web page to include JavaScript logic like the example below, which sends a DataWedge intent using the EB Intent API to switch to the DataWedge “barcode” Profile:

    var params = {
        intentType: EB.Intent.BROADCAST,
        action: 'com.symbol.datawedge.api.ACTION',
        appName: 'com.symbol.datawedge',
        data: {"com.symbol.datawedge.api.SWITCH_TO_PROFILE":"barcode"}
    EB.Intent.send(params);

IMPORTANT: The name of the file containing the JavaScript must match the file the specified in the <StartPage> tag referenced in Step 1.

5. Copy the modified Config.xml and .HTML files to the EB install directory on the device:

  • /Android/data/com.symbol.enterprisebrowser

6. If not already present, also copy the ebapi-modules.js EB API module to the same location as the .HTML file.

Sample .HTML page easily switches between DataWedge Profiles.

Sample files

dw_profilebarcode.db - Barcode Profile for import to DataWedge (do not edit manually) dw_profilesimulscan.db - SimulScan Profile for import to DataWedge (do not edit manually) Config.xml - Sample EB configuration file can be edited or copied as needed
DataWedgeIntent.html - Sample EB start page

Download the sample files (.zip) Importing a DataWedge Profile

The EB app can now send DataWedge intents.

Related guides: