Barcode and QR code Scanning

Hi

I want to know detailed information on QR code scanning. How do QR codes work, what are the requirements for QR code scanning.

Separately, I want to know how GTINs work, and what the difference between a GTIN and a QR Code is.

Scanning barcodes in JourneyApps is really easy - docs here. On mobile, the JourneyApps container will automatically use the device’s camera to read a wide variety of different barcode formats, including QR codes, and give you access to the barcode content as text.

All you need in order to scan a barcode is a text variable (or a text field on a DB object), and a <scan-barcode /> component. It is best practice to specify the types attribute, like so <scan-barcode bind="product" types="QR_CODE,UPC_A,UPC_E" />, if you know which barcode types you are going to be dealing with as this will increase the performance of the barcode scanning algorithms.

Once you trigger the component the camera will act as a barcode scanner and if you focus the view finder on a supported barcode then it will read the contents and store it in the bound text variable or DB field. From there you can use the value as you would any other user input.

That said, you can also make use of the on-scan="someFunction" XML attribute to immediately call a JS function on a successful scan. The component will automatically pass the barcode content to the JS function listed. This can be useful for doing quick object lookups based on serial numbers that are printed as barcodes. For example
View XML

<scan-barcode bind="serial_number" types="UPC_A,UPC_E,EAN_8,EAN_13"  on-scan="findProduct />

View JS

function findProduct(barcodeContent) {
  if (barcodeContent) {
    var product = DB.product.first("serial_number = ?", barcodeContent);
    if (product) {
      dialog("Product found");
    } else {
      dialog("No product with with serial number: " + barcodeContent);
    }
  }
}

So, to answer the first question, QR code scanning in JourneyApps works exactly like scanning any other supported barcode format, you just use the <scan-barcode /> component and the content of the QR code will be accessible to you as text.

Then, a GTIN is a Global Trade Item Number and is usually printed on a product using a barcode. Typical barcode formats for GTINs are UPC, EAN, or ISBN, but I guess nothing would stop someone from encoding the GTIN in a QR code instead.

I hope this helps

I understood GTIN information .But,I want to know that how to scan the QRCode in mobile phone .Do I need any demo QRCode/GTIN for testing ?(How we have seen the barcode scanning in shops)
I have followed the details as mentioned.I have tried in the mobile phone it’s not capturing the QRCode .So I want to know any other details are still required to complete this work?

I understood the points mentioned here But I am concerned about scanning the QRCode.For scanning the qrcode in laptop do we need barcode scanner(machine) or any other ways available?

please find the code here
https://oxide.journeyapps.com/org/607f480bc6601400061a38d0/app/60d04013e092890006e2fac4#path=mobile%2Fqrcode.view.xml&type=editor

Hi Soumya

I tried your code and it worked for me. I was able to scan the first QR code I tried, in my case I just tried the “Test App” enrollment QR code and was able to dialog / console log the content.

For scanning QR codes on laptop you would need a USB / Bluetooth / Wifi (if that exists) barcode scanner that is connected to the desktop. Then, depending on if the device supports it (basically if it has a Serial Port Profile (SSP)), you could either integrate with it using a SerialPort connection - docs here, or hopefully the desktop treats the barcode scanner as a keyboard and then you can interface with it using any standard text-input, as you would any other keyboard.

Hi Tielman

Thanks for the detailed information.

I have got the API details and tried but ,I am not getting the product information as output.So,I want to know what are the factors will change.

I have mentioned the API details in the code
Plase find the code here JourneyApps Accounts

Thanks in advance.