Sorry for the delay in answering your question. Could you provide a full sample app that displays this issue? A full sample will help greatly in tracking down the issue.
Test application to download, compile and run - https://kodys-my.sharepoint.com/personal/petr_brant_kodys_cz/_layouts/15/guestaccess.aspx?guestaccesstoken=DHluxqZy%2fD4fuwfVaBKw77RqKehBDpthOWIg84VTW2M%3d&docid=0fcbfc7b150704851b1ebf871ae84cb7c&rev=1
After run, there is timer between click on button and scanner initialization complete (application create new instance of MainActivity). Average value is 1.2 second !!! Too long to wait on every activity start - without scanner initialization there is 0.05 second.
We can achieve better results with using Datawedge profile broadcast intents, but there is an issue when you go back from activity - we have opened ticket to tech support (#3512060 if you would like to help to resolve).
With scanner initialization:
Without scanner initialization:
you just hit the "examples too simple to be useful" roadblock.
All the sample Zebra provides are a single activity with the EMDK objects lifecycle linked to the Activity Lifecycle, good to show some basics but a bit lacking if you want to build a bigger app with the same structure.
First, Activating and Deactivating the Barcode API takes some time, simply because all the Scanner Framework and the HW needs to be activated and deactivated, if you need to transition between Activities expecting to be able to use the scanner heavily, this is not going to fly.
You need to detach the Barcode API Instance lifecycle from the activities lifecycle.
- Implement an EMDKWrapper (you can find something in this discussion https://developer.zebra.com/message/88185?et=watches.email.thread#88185 )
- link the EMDKWrapper to the application lifecycle, deactivating the scanner when the app goes in background and reactivating it when the app comes in foreground
- pass the scanner events (probably you need to pass just the data with some metadata) to the Activity in foreground using some message bus or the Xamarin MessagingCenter system.
Either way, you need to detach the two lifecycle... or use a single Activity :-)
Here's a similar discussion around these topics: https://developer.zebra.com/message/90639?et=watches.email.thread#90639
I'll take a look at your issues with DataWedge on the support portal.
thanks for your response. IntPtr thread is very good as information how to handle with this error.
Writing background scanner service (singletons are evil) is similar to write small "Datawedge" application :-), so we migrate whole application to use Datawedge.
If you have time, please look at the issue - ticket was escaleted and now has a number SPR#30284.