Page 1 of 1

Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 10:22 am
by David6064062

Hi

Is it possible to start the Barcode Scanner as the app loads.

I have tried including:

Invoke Service Datasource: mobilebarcode1

At startScreen "Load" and "Before Load" but the startScreen just loads.

Thanks

David


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 11:02 am
by Kateryna Grynko

Hi David,

You can try Page Show event.
Make sure you call service on the start screen.
Run code on browser to see if there are errors in JS code (F12).
Please, note this can work on device only.


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 1:05 pm
by David6064062

Hi Katya

When using:

startScreen Page show Invoke Service Datasource: mobilebarcode1

We get an error when testing in browser:

TypeError Cannot read property 'barcodeScanner' of undefined


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 1:50 pm
by Emmz

All phone gap(cordova) plugins run on Device only. Not in the browser.
So things like childbrowser, contacts, barcode scanner etc.

I always test for phonegap b4 calling the function. Avoids errors when browser testing...


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 2:04 pm
by David6064062

Hi Neil, I learnt that the hard way..

However in this case Katya asked me to run the code on the browser to see if there were any errors...

which resulted in

TypeError Cannot read property 'barcodeScanner' of undefined

I had first tried running in the phone but the barcode scanner doesn't open using any of these:

Load
Before Load
Page Show


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 2:29 pm
by Maryna Brodina

Hello! You need to install app on device to get it working. It won't work in browser.


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 2:51 pm
by David6064062

Hi Marina

As previously stated

I have tried running in the phone but the barcode scanner doesn't open using any of these:

Load
Before Load
Page Show

It will work if I call it from a button... but I want the scanner to open as soon as the app loads.


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 3:04 pm
by Maryna Brodina

Could you please try one more event - Device ready?


Starting the Barcode Scanner as the app loads.

Posted: Mon Jul 22, 2013 3:15 pm
by David6064062

That works a treat, fantastic, thank you.


Starting the Barcode Scanner as the app loads.

Posted: Tue Jul 23, 2013 1:36 pm
by Emmz

Also you can use JS to call Scanner service.

I Use
codesetTimeout(function(){YOURSERVICENAME.execute({});},1500);//Start auto scanner service/code

This works on load,show,button, code, etc..