I want to implement a feature where scanning a QR brings up a browser and scanning anything else (barcode, text, etc) brings up a label

I used some translators because I’m not a native speaker, so I apologise for any unnaturalness.

Hello. I want to make a QR code scanner with the basic BarCode scanner function of Kodular(Appinventor), so that when I scan a QR code, it runs in the browser (android.intent.action.VIEW), and when I scan something other than a URL, the result value is displayed as a label. But no matter how hard I try, it doesn’t work. I made it like this, but it’s hard to make because I’m a beginner. How can I do it?

If possible, I would appreciate it if you could create an example with that block (you can delete the block I created and create your own). I'm asking because I've been trying to create one and can't get it to work. Thank you.
(Thanks to your help, I got the information and built the block to this point.)
png

Hello @USER1,

Unfortunately, you are using another builder (Kodular). The functionality of builders are very different these days, so we advise you to ask in Kodular Community instead.

1 Like

Since Kodular was created using the AppInventor open source, I thought it would be the same, so I posted it on the Kodular community, but it just kept showing up as pending, so I asked the question here.
Sorry about that.

Is there any chance that what I want to do can be implemented with AppInventor since I don't need to use that block?

Kodular and App Inventor used to behave the same way, but that is a long time ago. They are now very different, with different behavior and blocks. Still, as stated, please ask in Kodular Community for Kodular questions.

1 Like

Yes, I must have been using a translator and not understanding it very well.

Apparently it's difficult to implement that feature in AppInventor, thanks for the answer.

Which feature ? All the blocks you show are available in AppInventor...

2 Likes

I'm referring to the ability to create a scanner app with AppInventor's native barcode scanner feature so that when a QR code is scanned, it launches in the browser (android.intent.action.VIEW) and when something other than a URL is scanned, the result is displayed as a label.

This can be done....

1 Like

I'd like to ask if this is possible and if so, how?

Try your blocks in AppInventor, see what happens....

although you might want to re-work this:

image

1 Like

I tested that block in AppInventor as is, using the MIT AI2 Companion.

When I did so, whether I scanned a QR code or a barcode, all of them were labelled as "not QR code".

png

The image below is an image of the AppInventor block.

You can use this logic with an Activity Starter, too.

1 Like

Wow, thank you. I tried it and it works with WebViewer. However, when I tried to run it with Activty_Starter as shown in the image below, it ignores the QR code and everything else works fine. I'm trying to implement the ability to open with a web browser using "android.intent.action.VIEW" and was wondering if there's a way to do that as well.
(Note that "액티비티스타터1" is an Activity_Starter.)

If you are using one component name in the green blocks that set up the Activity Starter, why is a different component name being used in the Start Activity block?

1 Like

I used a translator, so maybe I didn't understand it well.
If it's HTTP, I put it in because I wanted to run it with a web browser using the activity starter.

I've been trying to resolve the error by swapping blocks, but it's not working...

I don't have any bar codes to scan, so this is a guess.
activity_starter.aia (2.9 KB)
blocks

1 Like

I tried it and the QR code with http opens in a web browser and works very well. Thank you so much!
Sorry for the many questions, but finally, I was wondering if there was a way to tell if the scanned result was a URL or not, as opposed to whether it contained http or not, as I was getting an error if there was any text with http in it (e.g. this is http).

Sorry for asking so many questions and thank you so much!
I've been stumped for months on my own and you've solved it for me.

You could use this:

but it may be easier to simply do this:

image

If you read through the link above, you will see the warning that this is not perfect, there are other types of url....

1 Like

Possibly better:

image

which tests for just the first 8 characters of the url (where the http:// or https:// is found in a common url)

1 Like