Import QR code functionality not working as expected

1. What is the problem? Be very detailed.

I am trying to test the "Import QR Code" functionality to see if we can save a QR code image file and share it around to configure phones. It isn't working. Steps:

  1. Open Collect to Main Menu
  2. Click three dots menu in top right
  3. Click "Configure via QR code"
  4. Click three dots menu in top right
  5. Click "Import QR code"
  6. Choose the image file

At this step, I have tried selecting three image files, and none work.

  1. I have saved the QR code from Central and used that file.
  2. I have used a desktop screenshot from Central (for a larger border around the QR code).
  3. I have also taken a screenshot of my phone's QR code settings ("QR CODE" tab in "Configure via QR code" activity) and used that file.

After choosing the file, all I get is a toast message "QR code not found in the selected image".

By contrast, when I use the "SCAN" tab, I can configure the app using the same QR code from ODK Central (the QR code 1 and 2 above) when pointed at my computer monitor.

2. What app or server are you using and on what device and operating system? Include version numbers.

ODK Collect v1.28.4 (I did not see anything relevant in the Change notes on github for more recent versions)
ODK Central client (v1.1.2) server (v1.1.1)
Phone: Google Pixel 4

3. What you have you tried to fix the problem?

Tried various screenshots / backgrounds to the QR code.

4. What steps can we take to reproduce the problem?

Try taking a screenshot of your phone's QR code and then import that same QR code screenshot.

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

If it works for you, is there a QR code file you have that I could share so that I can test on my ODK Collect?

This is a little confusing, but importing the QR code and scanning the QR code use different methods.

The "Scan" tab will work on any on-screen or printed QR code from Central or Collect.

The "Import QR Code" option only works with QR codes that have been exported Collect using the Share icon shown below.

Any feedback on how we can make this clearer?

Hi @yanokwa,

I edited the original post to make it clearer. What I am reporting is that I tried different ways to "Import QR code" and none of them worked.

I took your suggestion and tried the share icon, shared to email, got a Gmail attachment, and this did successfully import. But what is strange to me is that this QR code that I got from clicking the share icon looks exactly the same as the QR code that I see in the "QR CODE" tab.

What I reported earlier is that when I took a screenshot of the QR CODE tab page (that has the QR code fully in the screenshot), and then tried to import that screenshot, I got the error message that it didn't work. Aren't they the same QR code? Is there a reason one works and the other doesn't?

Then there are other QR codes that did not work for me reported in the original post.

They are the same what you can confirm scanning both codes (not importing). The import option however works only with qr codes generated by ODK Collect (using the share option).

Import QR code from image only works on a raw machine-generated image because it looks at every single pixel in the image to extract information rather than doing a fuzzy match like the camera scanning does. When you take a picture or a screenshot of a QR code, you're both adding new irrelevant information and removing important information.

There are two simple ways to generate QR code images that can be read by the import path:

  • From the Collect share option.
  • By saving the GIF from Central. Right click on the image, save as.

A png or gif QR code image you generate with a script will also work.

We can add some of this to the docs. I'm intrigued about how you ended up trying to import a screenshot/picture. Is it because you needed to send the config information from a device other than the one you had the QR code on? Because you need to manage several configs?

1 Like

This all started because the gif QR code from ODK Central was not importing for me (but with a caveat, see next paragraph). Other people on my team were reporting the same. I tried a few other variations after that and they were not working as well. However, I just tried again with the actual gif QR code image and Collect did successfully import settings, so I'm not sure what could have changed :man_shrugging:.

Thinking about it some more, I did have troubles downloading the gif file to my phone, so I think I took a screenshot of the QR code and imported the screenshot. That was what wasn't working.

When you take a picture or a screenshot of a QR code, you're both adding new irrelevant information and removing important information.

I did not think I was removing important information since the QR code was fully contained in the image files I was using. Can you explain how I was removing important information? I could see how taking a picture with low resolution and/or poor lighting may remove information. Is that what you mean? I did not do that, though.

I'm intrigued about how you ended up trying to import a screenshot/picture. Is it because you needed to send the config information from a device other than the one you had the QR code on? Because you need to manage several configs?

I never used a picture, only screenshots because I had difficulty (my phone's problem) downloading the QR code gif. It did not have to do with needing several configs.

I suppose as a naive user, I expected the "SCAN" tab to work the same as the import QR code functionality. But now you have explained that they use different methods.