Frequently Asked Questions

DataWedge 15.0

General Guidance and Recommendations

Q: Should I use DataWedge or EMDK for my app?

A: For apps that require barcode scanning, Zebra strongly recommends DataWedge, particularly since it is a simpler approach to app development. DataWedge provides a quick and easy way to add data capture capabilities to an existing app and comes preinstalled on all Zebra devices. DataWedge can be used by configuring the UI without any coding required. Alternatively, all functions can be controlled programmatically through Android intents. See the DataWedge vs. EMDK feature comparison chart and the Get Started guide for more information.

Q: Can I test my scanning app on an emulator?

A: Zebra recommends testing apps on the actual hardware. When this is not possible, adb shell commands can be used to simulate data captured by DataWedge that is sent to the device when scanning barcodes. Refer to this related blog post for more details.

Feature and Compatibility

Q: How can I determine which features are supported with the specific DataWedge version on my device?

A: Once a version is selected from the version selector dropdown in the DataWedge tile from the main TechDocs page, subsequent navigation to related DataWedge pages displays information specific to that version. DataWedge version selector
The selected version is also reflected in the URL. See Which Version is Installed to check for the DataWedge version running on the device.

Q: Some features are not working as expected. Why?

Check the feature matrix to ensure the proper component versions are in use.

Q: Does DataWedge support NFC?

A: No, NFC is supported with EMDK for Android with Secure NFC or Android’s NFC API.

Configuration and Setup

Q: How do I configure DataWedge to capture data in an app without any coding?

A: DataWedge can be configured through the UI to capture data, process data based on specific requirements, and output data into any associated app or activity with the use of profiles. When DataWedge is invoked to scan and acquire data, the profile which the app is associated to formats or appends the data as specified, and then passes the data to the associated foreground app. Follow the procedure to create a new profile. For more information, refer to the Profiles section and Get Started guide.

Q: How do I mass deploy my DataWedge settings and configurations?

A: Once DataWedge is set up and configured as desired on a device, settings can be saved to a file and distributed to other devices either manually or using a Mobile Device Management (MDM) system. There are two files that can be exported:

  1. Config – contains DataWedge settings, including all profiles and related configurations, and saves them to ‘datawedge.db’.
  2. Profile – contains individual profile settings, including how to capture, process, and output data acquired, and sames them to ‘dwprofile_[profileName].db’, where [profileName] is the name of the profile. See Mass Deployment for more information.

DataWedge API Use Cases

Q: How do I integrate scanning within my app?

A: There are two intent-based interfaces into the scanner:

  1. Using a generic Android intent to acquire scanned data - This eliminates the need to use DataWedge APIs to capture data. Refer to the tutorial which walks through how to receive scanned barcode data into an app.
  2. Using DataWedge APIs to control the scanner - Provides the ability to programmatically control, modify and query the DataWedge configuration settings and operations through Android intents. This allows new or existing Android apps to be easily modified to acquire data using Zebra devices without concern of the underlying hardware. Refer to Get Started guide and sample demo apps.

See our blog post on how to interface the scanner through DataWedge.

Q: How do I temporarily suspend scanning in my DataWedge app?

A: There are two methods to temporarily disable the barcode scanner in an app using the Scanner Input Plugin:

  1. Enable / Disable - can be called at any time
  2. Suspend / Resume - much quicker but can be called only when the scanner is in the SCANNING or WAITING state. The scanner state can be retrieved using Get Scanner Status or Register for Notification.

For more information and sample code, visit our blog on how to quickly suspend scanning in your app with DataWedge.

Q: Can DataWedge APIs control data capture in real-time?

A: Yes, DataWedge APIs provide dynamic control over data capture whether via scanner, magnetic stripe reader, RFID, serial/USB port, SimulScan, or voice.

Q: How do I use DataWedge Intent API calls for an application after a reboot?

After a device reboot, DataWedge may require a few seconds to initialize before it is ready to accept intent requests. Zebra recommends using Get DataWedge Status API to verify whether DataWedge is enabled before setting any configuration or altering scanner parameters to ensure successful operation.

Q: How can I dynamically change scanner configurations based on my business use case?

To dynamically change scanner configurations, use the Switch Scanner Params API, which allows temporary adjustments to scanner parameters without modifying the existing DataWedge profile. This API is particularly beneficial for applications that must swiftly adapt to changing conditions while meeting scanning requirements.

Steps to dynamically change scanner configurations:

  1. Register for Notifications - By registering for notifications, the application can receive real-time updates on the scanner status (e.g., IDLE, WAITING, SCANNING, DISABLED) during data capture operations. This includes updates on successful or failed scans, as well as when the scanner is enabled or disabled.

  2. Register for Scanner Status Notifications - The scanner must be in an IDLE state before invoking the Switch Scanner Params API. This can be verified by registering for notifications. It is also important to check the PROFILE_NAME extra to ensure the scanner status aligns with the intended profile. Below is a sample code snippet:

    case NOTIFICATION_TYPE_SCANNER_STATUS:
        Log.d(TAG, "SCANNER_STATUS: status: " + b.getString("STATUS") + ", profileName: " + b.getString("PROFILE_NAME"));
    
    
    if (b.getString("STATUS").equals("IDLE") && b.getString("PROFILE_NAME").equals("myprofile")) {
        //Scanner is enabled for the profile. Do something here.
    } 
    else {
        //Ignore the status event             
    }
    

    For more information, see the example code for registering notifications.

  3. Switch Scanner Parameters - Once the scanner status is confirmed as IDLE, use the Switch Scanner Params API to change the scanner parameters.

Q: How can I effectively use DataWedge Intent APIs in multithreaded applications?

When developing applications that interact with DataWedge Intent APIs, synchronization is crucial due to the asynchronous nature of intents. This guide highlights the potential issues arising from unsynchronized API calls, strategies to prevent them, and best practices for implementing synchronized intent handling.

Problem Description: Without proper synchronization, using DataWedge Intent APIs can lead to critical issues. When multiple threads or processes make API calls simultaneously, it can lead to:

  • Concurrent API calls resulting in unpredictable results due to the lack of guaranteed execution order.
  • Requests being processed out of order, causing inconsistent application states.
  • Inconsistent data states within the application, resulting to errors or unexpected behavior.

Solution - Best Practices for Synchronizing DataWedge Intent APIs: Given the asynchronous nature of intents, developers must ensure synchronization when calling DataWedge intent APIs.

  • For applications with multiple activities or fragments:
    • Register a broadcast receiver in the global context of the application to handle intents related to DataWedge status (e.g., API Result Notifications, Profile Switch, Scanner Status, DataWedge status).
    • Spawn a dedicated thread or coroutine in the global context to manage intent API calls.
    • Execute Intent API calls through this dedicated thread.
      Note: The application must handle intent results and application states to determine subsequent API calls.
  • In single-activity applications, intents can be dispatched via the main thread. Make sure to listen for results from the calling Intent API and update application states to decide which API to call next.

Troubleshooting

Q: Scanning works in DWDemo but not in my own app. Why?

A: By default, the DWDemo profile is built-in to send scanned data via intent to the DWDemo app. A profile would need to be configured for your app to receive the scanned data. Make sure the profile is configured with the appropriate input (e.g. Barcode input) and output (e.g. Intent or Keystroke output). See Managing Profiles on how to accomplish this.

Q: I can scan barcodes but they are not sent to my app. Why?

A: It is likely either a profile is not associated with your app or the profile input/output is not configured properly. DataWedge is using the default profile (Profile0) to perform the scan, which allows the scan beam to appear. However, if improperly configured, it does not know how to output the data captured. Either create a profile and associate it with your app with the appropriate configurations or configure the default profile (Profile0) with the proper input/output to capture the scanned data.


Related Guides: