Control Access to DataWedge Intent APIs

DataWedge 11.1


DataWedge provides an option for admins to control access to DataWedge intent APIs, allowing only approved apps to configure DataWedge. DataWedge intent APIs are categorized, allowing the administrator to grant DataWedge API access to specific apps based on category. By default, DataWedge accepts any intent API to avoid impact to existing applications.

Previously, any application on the device could configure DataWedge parameters and receive information such as configurations and status notifications via DataWedge APIs. This led to a potential security risk where a malicious application can configure DataWedge profiles used by other applications and leverage it for its own advantage, for example a malicious app could modify the destination URI of IP Output plugin to divert data delivery to a different address.

MX version 10.1.1 or above is required on the device.

Video demonstration about securing access to DataWedge intent APIs:

Control Access

Process to control access to DataWedge intent APIs:

  1. Whitelist approved app using AccessMgr CSP from MX.
  2. Specify the intent API category to restrict intent API access via DataWedgeMgr CSP from MX.
  3. Acquire the app token from AccessMgr using EMDK.
  4. Access the API by including the token in the DataWedge intent.

Details are provided in the sections that follow.

1. Whitelist Approved App

The first step to control access to DataWedge Intent APIs is for the admin to whitelist the app using AccessMgr CSP from MX. Whitelisting allows only the apps specified on a list to run, restricting use of apps not on the approved whitelist. Use StageNow or EMDK Profile Manager (Android or Xamarin) to deploy the configuration to whitelist the app. Set the following parameters:

  • Service Access Action: "Allow caller"
  • Service Identifier: com.symbol.datawedge.api
  • Specify Caller Package Name: <enter app package name, e.g.:>
  • Caller Signature: <select signature file that contains the app certificate>

2. Restrict DataWedge Intent APIs

By default, all DataWedge APIs are in uncontrolled mode - any application can access all DataWedge APIs. An admin can place a DataWedge API category into controlled/uncontrolled mode using DataWedgeMgr CSP via StageNow to restrict access to a particular API category. Refer to Control Access to Intent APIs in DataWedgeMgr CSP.
       For DataWedge 8.1, DataWedge 8.1.61 or higher is required.
       For DataWedge 8.2, DataWedge 8.2.62 or higher is required.

API Category Control Modes
Configuration APIs Uncontrolled
Notification APIs Uncontrolled
Query API Uncontrolled
Runtime APIs Uncontrolled

Uncontrolled – All apps have access to APIs; this the default setting.
Controlled – This restricts API access. Only the admin can whitelist apps to access the APIs using AccessMgr CSP.

DataWedge APIs are categorized into 4 types:

  • Configuration APIs - APIs related to actions taken on configurations
  • Notification APIs - APIs related to retrieving status for scanner, profile, or configuration
  • Query API - APIs that retrieve information or enumerate scanners
  • Runtime APIs - APIs that can change functionality at runtime

Administrators can designate which categories are protected using DataWedgeMgr CSP. By default, all the API categories are in unprotected mode.

Intent API category Intent APIs
Configuration APIs Get Config
Get Disabled App List
Clone Profile
Create Profile
Delete Profile
Rename Profile
Set Config
Set Ignore Disabled Profiles
Set Disabled App list
Restore Config
Import Config
Notification APIs Profile Switching (from Register/Unregister for Notification)
Scanner Status (from Register/Unregister for Notification)
Configuration Change (from Register/Unregister for Notification)
Query API Enumerate Scanners
Get Active Profile
Get DataWedge Status
Get Version Info
Get Scanner Status
Get Profiles List
Get Ignore Disabled Profiles
Runtime APIs Enable/Disable DataWedge
Enable/Disable Scanner Input Plug-in
Switch Scanner Params
Switch SimulScan Params
Soft Scan Trigger
Soft RFID Trigger
Switch to Profile
Set Default Profile
Reset Default Profile
Switch Scanner
Set Reporting Options

See DataWedge APIs.

3. Acquire a Token

Only whitelisted applications are allowed to call DataWedge service identifier to generate tokens. The applications must use EMDK ProfileManager APIs to acquire a token from AccessMgr CSP.

To generate a token, use EMDK Profile Manager to create a profile:

  1. Open EMDK Profile Manager (Android or Xamarin).
  2. Create a new profile using MX 10.1 or above and provide a name, such as RequestToken.
  3. In the “Available Features” list, select and add “Access Manager” as a feature.
  4. Access Manager is listed under “Selected Features”.
  5. In the Access Manager parameters section, set/enter the following:
    • Service Access Action: “Request Token”
    • Service Identfier: com.symbol.datawedge.api

Sample generated EMDKConfig.xml from EMDK Profile Manager:

    <?xml version="1.0" encoding="UTF-8"?><!--This is an auto generated document. Changes to this document may cause incorrect behavior.--><wap-provisioningdoc>
    <characteristic type="ProfileInfo">
        <parm name="created_wizard_version" value="7.3.2"/>
    <characteristic type="Profile">
        <parm name="ProfileName" value="RequestToken"/>
        <parm name="ModifiedDate" value="2020-03-23 20:01:24"/>
        <parm name="TargetSystemVersion" value="9.1"/>
        <characteristic type="AccessMgr" version="8.3">
        <parm name="emdk_name" value=""/>
        <parm name="ServiceAccessAction" value="7"/>
        <parm name="ServiceIdentifier" value="com.symbol.datawedge.api"/>

Use ProcessProfile API from EMDK to generate the token to be passed to the desired DataWedge API intent for secure access. Sample code to generate the token:

    import android.content.Context;
    import android.os.AsyncTask;
    import android.text.TextUtils;
    import android.util.Xml;

    import com.symbol.emdk.EMDKManager;
    import com.symbol.emdk.EMDKResults;
    import com.symbol.emdk.ProfileManager;

    import org.xmlpull.v1.XmlPullParser;
    import org.xmlpull.v1.XmlPullParserException;


    public class TokenOperations implements EMDKManager.EMDKListener {

        static Object syncObj = new Object();
        Context mContext;
        // Provides the error type for characteristic-error
        private String errorType = "";
        // Provides the parm name for parm-error
        private String parmName = "";
        // Provides error description
        private String errorDescription = "";
        // Provides error string with type/name + description
        private String errorString = "";
        private String mToken = "";
        //Assign the profile name used in EMDKConfig.xml
        private String profileName = "";
        //Declare a variable to store ProfileManager object
        private ProfileManager profileManager = null;
        //Declare a variable to store EMDKManager object
        private EMDKManager emdkManager = null;

        public TokenOperations(Context context)
            this.mContext = context;

        public String getErrorDescription()
            return errorDescription;

        public String generateToken()
            EMDKResults results = EMDKManager.getEMDKManager(mContext, this);

            //Check the return status of EMDKManager object creation.
            if(results.statusCode == EMDKResults.STATUS_CODE.SUCCESS) {
                //EMDKManager object creation success
            }else {
                //EMDKManager object creation failed

            try {
                synchronized (syncObj) {
            } catch (InterruptedException e) {

            if (emdkManager != null) {
                emdkManager = null;

            return mToken;


        public void onOpened(EMDKManager emdkManager) {

            this.emdkManager = emdkManager;
            //Get the ProfileManager object to process the profiles
            profileManager = (ProfileManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
            profileName = "RequestToken";
            new ProcessProfileTask().execute("");

        public void onClosed() {

            //This callback will be issued when the EMDK closes unexpectedly.
            if (emdkManager != null) {
                emdkManager = null;

        private void parseXML(XmlPullParser myParser) {
            int event;
            try {
                // Retrieve error details if parm-error/characteristic-error in the response XML
                event = myParser.getEventType();
                while (event != XmlPullParser.END_DOCUMENT) {
                    String name = myParser.getName();
                    switch (event) {
                        case XmlPullParser.START_TAG:
                            if (name.equals("parm-error")) {
                                parmName = myParser.getAttributeValue(null, "name");
                                errorDescription = myParser.getAttributeValue(null, "desc");
                                errorString = " (Name: " + parmName + ", Error Description: " + errorDescription + ")";
                            else if (name.equals("parm")) {
                                String parmName = myParser.getAttributeValue(null, "name");
                                    //Retrieved Token will be saved to a variable
                                    mToken = myParser.getAttributeValue(null, "value");


                        case XmlPullParser.END_TAG:

                    event =;

            } catch (Exception e) {

        private class ProcessProfileTask extends AsyncTask<String, Void, EMDKResults> {

            protected EMDKResults doInBackground(String... params) {

                parmName = "";
                errorDescription = "";
                errorType = "";
                mToken = "";

                EMDKResults resultsReset = profileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.RESET, params);
                EMDKResults results = profileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.SET, params);

                return results;

            protected void onPostExecute(EMDKResults results) {


                String resultString = "";

                //Check the return status of processProfile
                if(results.statusCode == EMDKResults.STATUS_CODE.CHECK_XML) {

                    // Get XML response as a String
                    String statusXMLResponse = results.getStatusString();

                    try {
                        // Create instance of XML Pull Parser to parse the response
                        XmlPullParser parser = Xml.newPullParser();
                        // Provide the string response to the String Reader that reads
                        // for the parser
                        parser.setInput(new StringReader(statusXMLResponse));
                        // Call method to parse the response

                        if (TextUtils.isEmpty(parmName) && TextUtils.isEmpty(errorType) && TextUtils.isEmpty(errorDescription) ) {

                            resultString = "Profile update success.";
                                resultString = "";
                        else {

                            resultString = "Profile update failed." + errorString;

                        synchronized (syncObj) {

                    } catch (XmlPullParserException e) {
                        resultString =  e.getMessage();

4. Accessing the APIs

Once the token is generated, it needs to be included in the intent API call along with the calling application’s package name being sent to DataWedge. When the intent is received by DataWedge, DataWedge verifies if the token is valid for the given application. If the token is valid, DataWedge processes the intent. If the token is not valid, one of the following error codes occur:

  • Sub error codes:
    • TOKEN_EXPIRED: The token is expired; applications are required to acquire a new token.
    • MX_NOT_INITIALIZED: MX is not initialized. This can usually occur right after a reboot.
    • FAILED_TO_VERIFY_APPLICATION: Unable to verify the calling application (i.e token is invalid or application is not whitelisted).

Source code samples are provided for multiple APIs:

Example 1: Get Config

    Intent i = new Intent();
    i.putExtra("APPLICATION_PACKAGE", getPackageName());
    i.putExtra("TOKEN", "291f7f7c-1479-4813-9639-2d4ab31e37b9");
    i.putExtra("com.symbol.datawedge.api.GET_CONFIG", "Profile0 (default)");

Example 2: Enable/Disable DataWedge

    Intent i = new Intent();
    i.putExtra("APPLICATION_PACKAGE", getPackageName());
    i.putExtra("TOKEN", "<token here>"););
    i.putExtra("com.symbol.datawedge.api.ENABLE_DATAWEDGE", true);

Example 3: Set Config

    Bundle bMain = new Bundle();
    bMain.putString("PROFILE_NAME", "Profile009");
    bMain.putString("PROFILE_ENABLED", "true");
    bMain.putString("CONFIG_MODE", "CREATE_IF_NOT_EXIST");

    Bundle bConfig = new Bundle();

    Bundle paramList = new Bundle();
    paramList.putString("decoder_code11", "true");

    bConfig.putBundle("PARAM_LIST", paramList);

    bMain.putBundle("PLUGIN_CONFIG", bConfig);

    Intent i = new Intent();
    i.putExtra("APPLICATION_PACKAGE", getPackageName());
    i.putExtra("TOKEN", "<token here>"););
    i.putExtra("com.symbol.datawedge.api.SET_CONFIG", bMain);

Usage Notes

  • When DataWedge APIs are set as "Controlled" and when the device restarts, sending an intent API to the "Controlled" group from a whitelisted application may return an error. Since MX framework did not complete initialization, allow some time to elapse after reboot before sending the intent to avoid this error.
  • The token expires in the following situations:
    • Device date or time is set prior to the timestamp on the token.
    • 24 Hours passed in the device clock after generating the token.
    • Automatic time updates caused the device time to go backward or move forward more than 24 hours.
  • If intent APIs are placed in protected mode, existing Zebra apps that use DataWedge may not work as expected. E.g. If Runtime APIs are placed in protected mode, the scan button of the Enterprise Keyboard does not work on Enterprise Keyboard versions 4.0 or lower.

Related Guides: