Scanner: launch barcode scanner programmatically

Hi !

I'm trying to find a way to launch the barcode scanner from javascript.

Description of my problem:

  • I've a scanner button on my app. Clicking on it works fine.
  • in the app I also display some modals and want to also be able to launch the scanner from a modal, i've tried a few things:
    • add another Scanner button in the modal: it does not work fine: the scanner popup shows up, but no image is present - my supposition is that we can not have more than one scanner component in a single app (I also think that the scanner component is always "opened" even when the scanner button is not clicked: my mobile phone shows a system notification "this chrome site is using your camera" and the battery is drained very quickly).
    • tried to trigger the main scanner button from a script, without success. I did not found any API to do that.


1 Like

Hey @thomasltd!

Thanks for flagging this! It looks like this is indeed a bug, I've linked this thread to a related bug report and will keep this thread up to date as a fix is addressed! :slight_smile:

1 Like


My case is similar to this in that sometimes the camera shows up without the camera screen. Sometimes the screen appears but images are not captured: they are captured only once but after clicking the button again, it seems capturing an image doesn’t work.

Hey @Peera — I just wanted to check back in here, it sounds like our engineers were able to ship a fix for this bug. Would you mind testing this on your end to confirm?

let me check


Looks like the scanner's feature "Automatically close after scan" doesn't work as I finished scanning but my device's camera is still turning on.

@Chris-Thompson This does not seem to be working - once I run the scanner, the camera does not turn off....

how would you launch the scanner with javascript? I don't want a chunky button

1 Like