TC56 disables scanner if in sleepmode

I am experiencing an issue with the TC56, that it turns off the scanner if you turn off the screen. Im experiencing the same issue with the barcodeScanner sample app you can download on github. I have modified the samples OnPause, so it doesn't unregister the scanner. This should make the scanner work even when the screen is turned off or in the background.

 

 

1. Put the app into lockscreen / sleep mode.

2. start scanning with the hardware scan buttons.

 

after a few presses it stops scanning and its only the aim/seeker which is enabled.

The scanner beam should be visible too and working.

Casper Skoubo
This was experienced with the

This was experienced with the Xamarin emdk 2.3 and 2.5.

Device is running:

Android 6.0.1

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Casper Skoubo
I found this thread: Looking

I found this thread:

Looking at my reproduction steps i tried to implement a partial wake lock. This seems to work. - I just think its odd that the aim/seeker is somewhat enabled still.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Yes, you could prevent the

Yes, you could prevent the device from sleeping but obviously then you lose power efficiency.  You may also run into difficulties if another application tries to open the scanner whilst your existing app is in the background with an open connection to the scanner but there is nothing wrong with the approach you have taken as long as you accept those limitations.

Another approach is to deinit the scanner in the onPause() function and re-initialise (including resetting the desired configuration) in the onResume() function.  What is happening after you turn the screen off without a wake lock is at some point the scanner is entering a sleep state and losing its configuration so the original statement "I have modified the samples OnPause, so it doesn't unregister the scanner. This should make the scanner work even when the screen is turned off or in the background" is not entirely accurate.  Deinitialising in onPause() is the recommended technique as it avoids most common problems with the scanner sleeping or having multiple apps interact with the scanner and you will see the sample app use this technique: samples-emdkforxamarin-2_4/MainActivity.cs at BarcodeSample1 · Zebra/samples-emdkforxamarin-2_4 · GitHub  .  .

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Casper Skoubo
Yeah power efficiency will go

Yeah power efficiency will go down, but the requirement says the scanner shall be on at all time - So ill stick with the wake lock for now.

With the above requirement, deinitialising the scanner wouldn't work, and i am running my app in a closed environment, where i am the only user of the scanner.

Thanks for the reply, ill bother you guys again if any other issue occurs.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Pietro Francesc...
Hi Casper,if power

Hi Casper,

if power consumption is not an issue in your use case, the best option is to use a partial wake lock that keeps the device active even when the screen is off (or a full wake lock if you need to have even the screen always active).

Keeping the deInit/Init calls in the onPause, onResume is a guarantee that, if in the future you need to modify this power behaviour or add a second application using the scanner, it will works correctly.

~Pietro

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kranti Kambhampati
If it helps others, initially

If it helps others, initially  tried to use the wake lock method which was easier to do. But when the user presses the power button on the top the device goes to sleep mode and app loses connectivity with the scanner. So I ended updating the plugin to use pause and resume events. Here is updated Cordova plugin with my changes.

GitHub - krantik/Cordova-Plugin-BarcodeScanner-EMDK: EMDK Barcode Scanner Plugin for Cordova

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments