About barcode component and how do you put buttons over the camera view when searching and scanning barcodes?

Hi guys, one of the functionalities of the app I am testing is the ability to read QR codes placed everywhere in a room so the barcode component is not activated clicking on a button but from screen.initialize and the camera is always active until that screen is active.
Then, when the camera detects and read a valid QR the app starts the specific action.

Actually, to stop seach and scanning the user has to press the back virtual button 2 times that is not so obvious but I am not able to put a couple of buttons over the screen or to reserve an area to them using a layout component.

Did I miss something or is a limitation of the barcode component?

I also would like to print and visualize something over the camera view during barcode searching and scanning in a similar way as done in AR applications (just as an example).

You may wish to try this:

Thanks, I will try it

Unfortunately it does not work here, I tryed the example aia with the most updated release but it does nothing, I only see the other components but not the BCR scanner and it does not start.

You may need to drag in the barcodescanner component for it to work ?

What do you mean? Do you mean using ScanView and BarcodeScanner together?

No, just the presence of the barcodescanner component may help to make the extension work. I do not know, I have not had a chance to test....

No, in my test app I have both on the same screen (screen1). Also I am not able to load the test app, it says it is done with a newer version of App Inventor so I suppose it was done using Kodular or something similar and it is not possible to download it using companion. Well, my points are still the same:

  1. to be abe to put a couple of buttons somewhere on the screen during barcode scanning
  2. to be able to put text/icons/links or anything graphical on the screen during barcode scanning possibly over the camera view
    but seems to be impossible using the standard components included on AI2. I am trying to play a little bit using virtual screens but when barcode scanning starts the camera view takes all the screen.

Have tested, scan window opens


Mmmm... good to know.. on which Android release did your test? Mine is 11, on 8 I am quite sure it will work, in general I found problems on Android 11, something related to file permissions and something related to old or not updated extensions.

Tested on android 10 and 13 with companion

Trusting your test I uninstalled and reinstalled the scanview extension and "magically" it is working now... I see something similar to the screen capture you posted some minutes ago. Now I can test and experiment a little bit, thanks.

I am testing ScanView, it basically works apart if I try to set colors. It always rise the error "Unknow color" or "The arguments are the wrong number of arguments for SetMaskColor". I tryed to set the value as #ffffffff (I tryed with and without the dash) as a text string, as a hex number and as its decimal equivalent number but in any case it does not work. The help says that I have to pass 4 hex bytes in the ARGB order and the example shows #ffffffff May be it wants a list or constructing a 4 bytes color using makecolor ?

As indicated by the tool tip, these work for me


It was my first try but it returns "The arguments are the wrong number of arguments for SetMaskColor" and works for the others

Building the APK everything works, also SetMaskColor... at this point I think I may have problems with the companion, or the companion looses the connection but I did not see any message as usually happens.

Yesss.... for some reasons the companion disconnects from AI2 without write any message on the smartphone screen and also on the PC. The effect is that if I update the code I do not see the effect on the smartphone, well it is an annoying problem.

This should no longer be necessary (overlaying components) given the scanview provides you with plenty of screen real estate to work with for your buttons/text/icons/links

ScanView satisfies first point, it is OK, the second is a different need, I would need overlaying components, at least labels (providing a link also) and buttons. But to solve this problem I have more time.