2

I am using the barcodereader sample application provided in the cascades samples to embed a QRCode scanner into my application.

As it stands the sample is great, but I want the scanner to open as soon as the user navigates to my screen and I want to get rid of the opening slider images that are in the sample.

Firstly, I have tried removing the images and their animations and adding the action:

onCreationCompleted: {
    camera.open()
}

to the Page. This opens the camera perfectly as expected, but for some reason, the bacrode just doesn't scan.

So, I wound back a step, and this time I just put the code in exactly as is and just changed the code to read:

onCreationCompleted: {
    startupAnimation.play()
}

As expected, the screen open, plays the annimation, but still it fails to read barcodes, however, if I invoke the animation again (by tapping the screen), the animation plays again and the scanner reads the barcode without any issues at all.

All I can think of is that this is a timing issue and that I need some sort of delay after the screen has been created before the camera can be started as a barcode reader?

Anyone able to help?

Thanks,

Douglas

Douglas
  • 31
  • 1
  • Which version of the OS are you running on your Dev Alpha? – donturner Dec 10 '12 at 18:33
  • May be you should try calling your method in onCameraOpened slot of Camera Control. It takes some time to initialize required hardware. So as soon as the hardware is ready you can begin. – Nishant Shah Dec 11 '12 at 05:00

1 Answers1

0

To get scanning right away at application launch, you need to make sure the camera is actually set up and initialized.

Basically, in onCreationComplete, open the camera. In onCameraOpened, start the viewfinder. In onViewfinderStarted, set the barcode detector camera to be the camera.

Paul Bernhardt
  • 491
  • 2
  • 6