9 Replies Latest reply on Apr 25, 2016 7:14 PM by Charitha Mallawaarachchi

    Conflict when Multiple APK's using the EMDK

    Brock Davis

      I have developed multiple applications that utilize the EMDK for various features.   Running the applications standalone works fine.  If I start one application, then launch a second EMDK enabled application, the first application fails when using the EMDK features.


      Typical error response from EMDK is


      Extended Status message is : One or more names of parameters not found in extraData.


      Status String is:

      <?xml version="1.0" encoding="UTF-8"?><wap-provisioningdoc><characteristic type="status"><parm name="code" value="1"/><parm name="description" value="Failure"/><characteristic type="extended_status"><parm name="code" value="12"/><parm name="description" value=" Exception occurred while performing requested operation. Exception : Caught exception : null"/></characteristic></characteristic></wap-provisioningdoc>


      It is almost as if the EMDK Service is loading one Asset Profile at a time, or getting confused as to which profile to use.


      Is the EMDK single use?


      Is there someway to flush out the EMDK Service to allow the application in the foreground to have it's profile loaded?



        • Re: Conflict when Multiple APK's using the EMDK
          Billie Hecox

          Hello Brock, How are you handling the EMDK objects in the lifecycle methods of your Activties? 

            • Re: Conflict when Multiple APK's using the EMDK
              Brock Davis



              Typically within the onCreate of the Main Activity I create an object to hold the EMDK objects.  The on the OnDestroy I clean up.  There is nothing within the OnResume/OnStop.


              Reviewing a clients application, same setup, create EMDK objects within the OnCreate, clean up in the OnDestroy.

              • Re: Conflict when Multiple APK's using the EMDK
                Brock Davis



                More information:  I built and tested multiple EMDK sample applications, no problems.  Switching back/forth between applications, no problems.  But all the examples appear to supply the XML data within the processProfile method, like:

                    profileManager.processProfile(_profileName,  ProfileManager.PROFILE_FLAG.SET,  profileArgs);


                The difference between the sample applications and my application:


                1. The Sample Application builds the  XML and sends to EMDK.  My application is depending on EMDK pulling profile from EMDKConfig.xml


                2.  Within my Application is a launcher (not sure if it matters).


                I will reboot the device, my application/launcher starts.  EMDK profiles are set.

                I start one of the Sample applications, it works.

                I go back to my application and attempt something that invokes EMDK, those features fail.

              • Re: Conflict when Multiple APK's using the EMDK

                Hi Brock,


                Could you please change the code to get profile manager object when you need it and do the job, and release it. This will allow the apps to use their own config files. Same this should implement in both apps.





                Get EMDK Manager Object in onCreate


                Get Profile Manager object when needed, push the profile, release profile manager.


                Release EMDK Manager in onDestory.



                Otherwise accessing EMDK APIs from different threads/ apps simultaneously is not allowed.




                  • Re: Conflict when Multiple APK's using the EMDK
                    Brock Davis



                    Thanks for the pointers.   Our code follows the sample applications where Profile Manager object is retrieved in the onOpened callback within the EMDKListener.  I have attempted to update the code to grab the Profile Manager object in the worker thread, but this does not seem to help.


                    I did notice that the 3rd party application that has been causing me fits does not work in any callbacks, all calls are done with the UI Thread.  I'm not sure if that is the culprit.


                    I do notice that once the 3rd party application loads, then any Zebra Sample applications fail.

                    • Re: Conflict when Multiple APK's using the EMDK
                      Brock Davis

                      Charitha and Bill,


                      After much research and testing, here are our steps to recreate the original error:


                      1.  Build and install 3 Sample EMDK applications (clock, wifi, app mgr).


                      2.  Run each application and invoke the appropriate functions that use the EMDK profile manager.


                      3.  Bring up the running task list, and swipe one away.  The swipe will cause the Activitiy onDestroy method to be invoked, thus causing the Emdk Manager release to be invoked.   (when running adb shell ps, you will notice the process is gone for the swiped application).


                      You might have to swipe 2 applications away, but leave the 3rd running.


                      4.  Bring up one of the remaining applications via task switcher and invoke the method.  It will fail with the original error of "Caught exception : null".


                      At this point, EMDK is non-functional as long as ONE APK has access to the EMDK Manager. 


                      The only way to get EMDK service working again is to Reboot Device or close ALL applications via Swipe, thus releasing all acquired instances of EMDK Manager.


                      This is using EMDK


                      It is almost as if the underlying EMDK service is releasing ALL instances to the manager/profiles when one application invokes the EMDK Manager release method.


                      Feel free to contact me offline to discuss this further.