Creating datawedge profiles in activities different than "Main"

Hello,
I need to create couple profiles in my app.

Runnig following code in activity different than "Main" always returns failure.

EMDKResults results = mProfileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.SET, (String[]) null);
if (results.statusCode == EMDKResults.STATUS_CODE.FAILURE) {

   Log.e("Main", "Failed to process profile " + results.getExtendedStatusMessage());
}

My question is how to create/update datawedge profile in activity other than "Main"?,

Best regards,

Adam

Anonymous (not verified)
Hi Adam,I suspect the answer

Hi Adam,

I suspect the answer to your question is that you need to re-acquire the EMDK instance in the different activity.

More widely, the profiles for configuring Datawedge have been deprecated - you may find the following post interesting as it goes through the new mechanism which will work without EMDK: , though this does require DataWedge version 6.4 or higher.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
Hi Darryn,1. Will this method

Hi Darryn,
1. Will this method work for TC8000 with Android KitKat?
2. My question needs clarification:

For simplicity I have two activities - Main and Secondary, both implementing EMDKListener interface.

EmdkConfig.xml is present and is valid (created with tool provided by Zebra).
Code I pasted above runs without problems on Main activity (requested profiles are always created, I've checked that in DataWedge app)
But when I execute code from above in Secondary activity (directly opened from Main activity) I get error saying "One or more names of parameters not found in extraData.". I don't understand this behaviour, because nothing has changed; basically code that creates profiles is cut/pasted from Main activity.

Best regards,
Adam Lamarz

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
For the record, DataWedge

For the record, DataWedge version installed on my reader is 3.3.16
and device is running android 4.4.3(KitKat) with 3.4.0 kernel.

Best regards,
Adam Lamarz

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Adam,1. The method

Hi Adam,

1. The method described at the post I attached to my previous answer requires DataWedge 6.4 as it uses SET_CONFIG.  I note that the latest Life Guard release of the TC8000 KK OS includes DataWedge 6.4, so as long as you upgraded your devices, this should work: https://www.zebra.com/content/dam/zebra_new_ia/en-us/software/operating-system/TC8000%20Operating%20System/Release-Notes…

but with your current version of DW, no, this would not work.

2. You would need to release the EMDK from activity 1 before initialising it in your second activity.  I have never tried this myself but Peter Arcuri has created a post previously describing how to use the EMDK across multiple activities: (he is talking about the barcode scanner but the principle of initializing / releasing the EMDK is the same).  I agree it is a strange error, "one or more names of parameters..." - as a first step, you may want to remove the EMDK from the first activity, just to isolate the issue.

Darryn.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
Hi,I can confirm that EMDK is

Hi,
I can confirm that EMDK is released from the 1st. activity by calling release method

@Override
protected void onDestroy() {

   super.onDestroy();
   if (emdkManager != null) {

   emdkManager.release();
   }

}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
Here's output from logcat11

Here's output from logcat

11-05 13:32:54.774 15034-15034/pl.xxx.scanner E/Main: main on destroy

11-05 13:32:54.784 15034-15034/pl.xxx.scanner D/com.symbol.emdk.EMDKServiceConnection: The connection to the EMDK Service was closed.!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
Darryn Campbell napisał(-a):(

Darryn Campbell napisał(-a):

(...) I agree it is a strange error, "one or more names of parameters..." - as a first step, you may want to remove the EMDK from the first activity, just to isolate the issue.

Darryn.

I removed any reference to EMDK from MainActivity, and in SecondaryActivity I get the same error.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
I am not aware of any issue

I am not aware of any issue where ProcessProfile can only be called from the MainActivity, do you have a support contract?  You might try going down that route to receive more immediate support for this issue.

Another option would be to export the desired profile(s) and then use an application to import the resultant .db file.  Please see this post for more information:

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adam Lamarz
Hi,I don't have support

Hi,
I don't have support contract, but I believe I've found the solution.
Releasing EMDK right after creating profile seems to solve the problem.
Here'e code:

@Override
public void onOpened(EMDKManager emdkManager) {

   ProfileManager mProfileManager = (ProfileManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
   if (mProfileManager != null) {

   try {

   EMDKResults results = mProfileManager.processProfile("DataCaptureStacking", ProfileManager.PROFILE_FLAG.SET, (String[]) null);
   if (results.statusCode == EMDKResults.STATUS_CODE.FAILURE) {

   Log.e("Stacking", "Failed to process profile. " + results.getExtendedStatusMessage());
   }

  } catch (Exception ex) {

  showToast(ex.getMessage());
   Crashlytics.logException(ex);
   }

  }

   emdkManager.release(); //this line solved the problem
}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments