3 Replies Latest reply on Sep 25, 2014 6:50 AM by Raphael Dantas

    [TC55] Creating profile with EMDK Manager and importing it to DataWedge

    Raphael Dantas



      I have an issue with a profile created with the EMDK Manager in Eclipse.


      I have filled the infos for the Intent like this :




      And deactivated the Keystroke part :




      The XML is well generated in the assets folder.


      And then in my Activity I use this code below to import my profile :


      package com.test.kiwapp.motorola;
      import android.app.Activity;
      import android.content.Context;
      import android.content.Intent;
      import android.os.Bundle;
      import android.util.Log;
      import android.view.View;
      import android.view.View.OnClickListener;
      import android.widget.EditText;
      import android.widget.ImageView;
      import android.widget.TextView;
      import android.widget.Toast;
      import com.symbol.emdk.EMDKManager;
      import com.symbol.emdk.EMDKManager.EMDKListener;
      import com.symbol.emdk.EMDKResults;
      import com.symbol.emdk.ProfileConfig;
      import com.symbol.emdk.ProfileManager;
      public class MainActivity extends Activity {
        // Tag used for logging errors
        private static final String TAG = MainActivity.class.getSimpleName();
        // Let's define some intent strings
        // This intent string contains the source of the data as a string
        private static final String SOURCE_TAG = "com.motorolasolutions.emdk.datawedge.source";
        // This intent string contains the barcode symbology as a string
        private static final String LABEL_TYPE_TAG = "com.motorolasolutions.emdk.datawedge.label_type";
        // This intent string contains the captured data as a string
        // (in the case of MSR this data string contains a concatenation of the
        // track data)
        private static final String DATA_STRING_TAG = "com.motorolasolutions.emdk.datawedge.data_string";
        // Let's define the API intent strings for the soft scan trigger
        private static final String ACTION_SOFTSCANTRIGGER = "com.motorolasolutions.emdk.datawedge.api.ACTION_SOFTSCANTRIGGER";
        private static final String EXTRA_PARAM = "com.motorolasolutions.emdk.datawedge.api.EXTRA_PARAMETER";
        private static final String DWAPI_START_SCANNING = "START_SCANNING";
        private static final String DWAPI_STOP_SCANNING = "STOP_SCANNING";
        private static final String DWAPI_TOGGLE_SCANNING = "TOGGLE_SCANNING";
        private static String ourIntentAction = "com.test.kiwapp.motorola.RECVR";
        private ProfileManager profileManager;
        private static final String MOTOROLA_SCAN_PROFILE_NAME = "KiwappTest";
        public void onCreate(Bundle savedInstanceState) {
        ourIntentAction = getString(R.string.intentAction);
        // Since we will be using the image as a soft scan trigger toggle button
        // let's handle the image on onClick event
        ImageView img = (ImageView) findViewById(R.id.logo);
        img.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
        // the image has been tapped so shoot off the intent to
        // DataWedge
        // to toggle the soft scan trigger
        // Create a new intent
        Intent i = new Intent();
        // set the intent action using soft scan trigger action string
        // declared earlier
        // add a string parameter to tell DW that we want to toggle the
        // soft scan trigger
        // now broadcast the intent
        // provide some feedback to the user that we did something
        Toast.makeText(v.getContext(), "Soft scan trigger toggled.",
        // We need to handle any incoming intents, so let override the onNewIntent
        // method
        public void onNewIntent(Intent i) {
        // This function is responsible for getting the data from the intent
        // formatting it and adding it to the end of the edit box
        private void handleDecodeData(Intent intent) {
        // check the intent action is for us
        if (intent.getAction().contentEquals(ourIntentAction)) {
        // get the data from the intent
        String data = intent.getStringExtra(DATA_STRING_TAG);
        String labelType = "";
        // check if there is anything in the data
        if (data != null && data.length() > 0) {
        // we have some data, so let's get it's symbology
        labelType = intent.getStringExtra(LABEL_TYPE_TAG);
        // check if the string is empty
        if (labelType != null && labelType.length() > 0) {
        // format of the label type string is LABEL-TYPE-SYMBOLOGY
        // so let's skip the LABEL-TYPE- portion to get just the
        // symbology
        labelType = labelType.substring(11);
        } else {
        // the string was empty so let's set it to "Unknown"
        labelType = "Unknown";
        Log.i(TAG, "==> " + data);
        Toast.makeText(getApplicationContext(), data, Toast.LENGTH_SHORT)
        private void initMotorola() {
        final Context ctx = this.getApplicationContext();
        // The EMDKManager object will be created and returned in the callback.
        EMDKResults results = EMDKManager.getEMDKManager(ctx,
        new EMDKListener() {
        public void onOpened(EMDKManager emdkManager) {
        // Create the Profile Config object
        ProfileConfig profileConfigObj = new ProfileConfig();
        // Get the ProfileManager object to process the profiles
        profileManager = (ProfileManager) emdkManager
        if (profileManager != null) {
        EMDKResults results = profileManager
        if (results.statusCode == EMDKResults.STATUS_CODE.SUCCESS) {
        "App successfully installed...",
        } else {
        "Profile initilization failed",
        public void onClosed() {
        // TODO Auto-generated method stub
        // Check the return status of getEMDKManager
        if (results.statusCode == EMDKResults.STATUS_CODE.SUCCESS) {
        // EMDKManager object creation success
        Log.i(TAG, "getEMDKManager => OK");
        } else {
        // EMDKManager object creation failed
        Log.e(TAG, "getEMDKManager => KO");



      But when I check the profile imported in DataWedge, I still see the Keystroke part enabled  :




      And the infos of the Intent are not present and it's not enabled !






      So what's wrong with my code ? Is it a bug from DataWedge ?


      Thanks for your help.