BlueFletch / motorola-datawedge-cordova-plugin

This is a Cordova/Phonegap plugin to interact with Motorola ruggedized Android devices' Barcode Scanners and Magnetic Stripe Readers (eg, ET1, TC55, MC40). The plugin works by interacting with the "DataWedge" application configured to output scan and magstripe read events.
35 stars 38 forks source link

Killing the app and restarting makes scanner stop working #6

Closed asyncanup closed 9 years ago

asyncanup commented 9 years ago

Hi,

I am testing this scanner on Motorola TC55, Android versin 4.1.2

Running datawedge.start(), datawedge.registerForBarcode and datawedge.startScanner() work just fine when the app is run the first time from Eclipse (with USB debugging)

But when I kill the app on the phone (swipe it off from Recent apps), and launch it again, now the scanner stops calling its callback registered with registerForBarcode

I am using IBM Worklight, and using this plugin with default settings.

Please help..

blakebyrnes commented 9 years ago

Hi Anup, Could you verify that the registerForBarcode is getting registered again when you re-start the app? Maybe just put in some console.log statements right before the function. If you're actually killing the app, I can't think of any reason the app wouldn't be registering again. It also looks like worklight might not be calling onDeviceReady every time (http://stackoverflow.com/questions/21015646/ibm-worklight-6-0-cordova-ondeviceready-is-not-firing). Try moving your registration into the WorkLight started callback if it's not there already.

asyncanup commented 9 years ago

I was able to get this to work properly with calling .stopScanner(), .stop(), .start() in sequence on every app launch :) Thanks for the help! You were absolutely ready about putting it inside deviceready