Qr : Read and Create Qr/Bar Code offline

Maybe becuause of android version.

This .aia is created in Kodular and is not compatible with AI2.

Ahh, please don't use that URL.

1 Like

Here are the blocks:
Generate Bar Code
image
Decode Bar Code
image

I made a test app:
QR.aia (15.0 KB)

Problem 1 - Created PNG file is empty.
Problem 2 - When I use ImagePicker to get a QR code from my phone, I get an error: com.google.zxing.NotFoundException.
Problem 3 - App crashes on startup after compiling, with companion works fine.

Probably given logo does not exist.

Have you asked for WRITE_EXTERNAL_STORAGE permission?
Also I suggest you to not use ImagePicker.Selection block because it creates unnecessary temp files.You should use Activity Starter along with FileTools or TaifunFile extension.
See here how:

You have not put a barcode scanner component.

This should work fine:
Qr.aia (33.2 KB)

Yeah. I don't have a logo. I thought that made the logo :). What is a qr code logo?

Yes permission granted. ImagePicker returns the path to the created temporary file. The temporary file exists, so it should decode qr correctly. I work with ActivitiStarter later.

I did not know that a scanner is needed. I thought it was an independent extension

Sometimes we want to decorate qr code with watermarks.That is it.

From where have you downloaded bar/qr code?

No, it needs some deps which are only available in Barcode Scanner component.

1 Like

What is the maximum length of the text that you can encode in QRCODE? With short text, the extension generate and decodes well. When the text is a long, QR code is generated correctly, while when decoding there is a COM.GOGLE.ZXING.NOTFOUNDEXCEPTION error. I will add that the scanner correctly decodes the QR code.

QrScan800.aia (54.5 KB)

Text:
0000FA550602FF00000000550603FF00000000550607FF00000000550608FF000000000096550603FF4400000055060422200000005506087F41000000003C550602FF09000000550603FF4C000000003C550602FF0D000000550607FF040000005506087F61000000003C550602FF1D0000005506087F69000000003C550603FF4D0000005506042222000000550607FF0C000000003C550602FF5D000000550607FF8C000000003C550607FF9C000000003C550603FF6D000000003C550603FFEF000000003C5506087F6F000000003C550607FFDC000000003C550602FFFD000000550603FFFF000000003C550607FFFF0000005506087F7F000000FA550603FFBB00000055060422020000005506087F3E000000003C550602FFF4000000550603FFB3000000003C550602FFF0000000550607FFFB0000005506087F1E000000003C550602FFE00000005506087F16000000003C550603FFB20000005506042200000000550607FFF3000000003C550602FFA0000000550607FF73000000003C550607FF63000000003C550603FF92000000003C550603FF10000000003C5506087F10000000003C550607FF23000000003C550602FF00000000550603FF00000000003C5506080000000000550607FF0000000000965506020000000000550603000000000055060400000000005506070000000000010064

QR:

Another thing is whether I can save the logo in the APP resources? I tried to give the path to the logo "http://localhost/logo.png" but it does not work.

It means either:

  • dimensions are larger than expected
  • orientation has been changed
  • some pixels have been lost

Usually extensions don't use that path.So // will work for assets.

The dimensions are the same as in the coding block, i.e. 800x800. What size does the decoder expect, because I can't see the information about it. I'll try on smaller sizes. Unless the more text the bigger the QR has to be?

Usually QR codes have a size of 150*150 or 200*200

Okay, experimenting with the size is successful.
The last problem with getting the logo from the asset path. I tried:

  • logo.png
  • /logo.png
  • //logo.png
  • ///logo.png
  • file: ///android_assets/logo.png

QrScan (1).aia (57.5 KB)

Yeah,found the issue.

ChangeLog Version 5

New blocks
image
Normally should not be used

Changes

  • Removed redundant barFormat param from DecodeBarCode method
  • Added barFormat param in BarCodeDecoded event

Bug Fixes

  • Fixed assets logo issue in GenerateBarCode method
    Thanks to @Patryk_F for reporting bug

Aix
Download Link: com.sunny.qr.aix (15.1 KB)

1 Like

Hi. Could you inform what level of error correction this extension uses? Maybe this value can also be added to the QR generation block?

Ok, According to the information found, I decoded the correction value. It is L.

The extension does not use hints while generating bar so it means L is the default value of error correction level.

Sure, I shall check.

I think this is necessary because it is impossible to decode QR with little text and logo. There is not enough recovery data to rebuild some of the code obscured by the logo.

a procedure that will automatically determine the size of the QR code depending on the data, so that the QR code always fills the entire image. This will work with "Numbers and Capital Letters" 0-9 and A-Z data. For other types, you need to change the CSV text.

It would be a good idea to automate this in the extension and only specify the size of one module in pixels.

Hi vknow360,
Thank you for the extension, it seems very nice.
I'm trying to add it to an app I'm doing but I'm not sure if it's possible.
Basically what I want to do is that the user has the possibility to be normal or VIP member. And to be VIP they have to enter a password in the app. Then, I want the app to generate a QR that, when scanned, tells if the user is member or VIP.
Do you think this is possible with this extension or with another extension you know?