I previously wrote about how the EMDK Data Capture Profiles were being deprecated, how this impacted DataWedge and provided an alternative using the DataWedge APIs.  This addressed a common customer requirement which is the ability to configure DataWedge programmatically.

 

Rather than wanting to create and configure the DataWedge (DW) profile individually on each device, let us assume we have a pre-configured profile that we want to distribute to each device in our deployment.  This is referred to in the documentation as “Mass Deployment” and if you read through the docs it explains how to export the current profile, manually import a profile and export / import the whole DW configuration.

 

Obviously, importing the profile via the user interface does not scale so DW has an ‘Auto Import’ feature.  Auto import works as follows:

  1. A previously exported profile or DW configuration is copied to a specific folder
  2. The copied profile or configuration is automatically read by DW and any settings / profiles in that configuration are immediately applied to DataWedge.

 

Typically, there are three ways customers could choose to use Auto Import:

  1. With an EMM: The EMM is instructed to copy the DataWedge config files to the appropriate location as part of device provisioning.
  2. With StageNow: Using the File Manager CSP the profile or configuration can be copied to the appropriate autoimport directory, typically /enterprise/device/settings/datawedge/autoimport.
  3. With an application: An application on the device can copy the profile or config files to the appropriate autoimport directory, typically /enterprise/device/settings/datawedge/autoimport

 

We have had a few questions on the developer portal recently about auto import using applications, there is some sample code available on techdocs but I wanted to put together some sample apps.

 

There are a few gotchas when coding an app to use DW auto import:

  • Zebra recommends you do not copy the .db file to the /autoimport folder in one go but instead first copy a .tmp file and then rename it.  This prevents DW from consuming the profile prematurely.
  • Zebra recommends applying explicit file permissions to all .db files so DW can read the required files

 

I have put together a sample application, available in both Android and Xamarin.  Whilst I hope you find it helpful, please bear in mind the samples are provided without any kind of guarantee or warranty.

 

001.png003.png

 

Both applications work in the same way:

  1. Launch the app. If running on Android Marshmallow or higher then grant permission to read / write external storage.
  2. Use adb to push any required DW profile or configuration .db file to the staging area. The UI will instruct you where the staging area is for your device (in the left screenshot, it is /storage/emulated/0/datawedge_import).
    1. You can find a test profile under the testProfiles directory
  3. Click the ‘Import’ button, this copies the profile(s) from the staging area to the /autoimport folder, setting the appropriate permissions and taking care of renaming to / from a .tmp file.
    1. The Android code for this is here
    2. The Xamarin code for this is here
  4. Observe that the profile has now been applied to DataWedge

 

002.png

The application has been tested on a TC51 running Android Nougat but should run on all other devices that support DataWedge autoimport.