getEMDKManager method not calling onOpened auto-generated stub

In my android project, my end goal of this is to get a instance of a scanner object on my TC8000 to control when the scanner is able to scan based on what EditText has focus. When I call the EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(),this);, the onOpened(EMDKManager emdkManager) stub is never getting called. Therefore, the global emdkManager object is never getting set. I have done some research and one of the articles that I found says that "the application must not block the Main thread to receive EMDKListener.onOpened callback." Is this set to block when you start a new Android Project? Why is the onOpened never getting called?

 

Sorry I am a .NET developer trying to learn Android Studio/IntelliJ IDEA.

Anonymous (not verified)
Hi, just to make sure

Hi, just to make sure everything is set up correctly and nothing has been missed from the application setup (e.g. some EMDK permission) have you tried running any of the samples on the TC8000?  The BarcodeSample1 sounds like it would be a good fit: Barcode APIs - Zebra Technologies Techdocs .  I think the advice about the application not blocking the main thread is more good practice but regardless, the sample app does not block it.

I understand there is probably a very good reason you are going down the Android Studio route but just in case you weren't aware we also have a Xamarin component targeted at .NET developers.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Paul Clark
Darryn,Thank you for the

Darryn,

Thank you for the response. I am currently trying to complete one of the tutorials that are on the website (basic scanning tutorial). I appreciate the feedback and it has indeed led me to my answer. I opened up the download that you suggested and tried to understand how everything ran on the TC8000. It appears that stopping the program in the middle of the onCreate can cause problems in the program. I'm guessing it has something to do with timing but when I was stepping through the program, the onOpened was not getting called but when I let it run, it did get called. I also placed the initializeScanner method in the onOpened instead of the onCreate in the MainActivity. It seems to be working now so I appreciate the suggestion of downloading and opening that project. Many thanks!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hey Paul,     in general, you

Hey Paul,

     in general, you should be careful to not do any long blocking calls in the Android LifeCycle methods such as onCreate, onPause, etc.   For the reason you found above, and that Android will throw and error ( Application Not Responding ) to the user of your application if your blocking calls exceed an ~5sec threshold.

Keeping Your App Responsive | Android Developers

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments