Barcodes provide a convenient way to pass information from the real world to your app. We see the use of barcode and barcode scanners in our everyday lives i.e. while shopping, renting a car, attending major events, flying, and so on. They’re in our social media apps and on store windows.
Using Barcode Scanner in Power Apps we can get data or can open URLs from Barcode or QR code.
Let’s just start exploring this media by simply creating a Barcode Scanner App to get data and open URLs from Barcodes or QR codes.
In this app we have used two scanners:
- To get Scan information from the Barcode or QR code.
- Open the URL that is present in the Barcode or QR code.
1. Now select the “Barcode Scanner” media from the list of media as shown below screenshot:
2. After the Barcode Scanner gets added to the screen, use the formula on the “onScan” property of the Barcode Scanner to get the value of the Barcode or QR code while scanning the code. Then using the “Set” method of the Barcode Scanner scanned value; set in the “scanvalue” variable.
- Select “Label” and set “text” property of label as “Scan Result:”
- Select another “label” to display the result of Barcode Scanner. Then set “Text” property value as “scanvalue” variable that contains scan value as shown below:
- Now add another scanner on the screen to open a link that is present in the code. Now set “Text” property of BarcodeScanner2 as “Scan and Go”:
- Now set formula on “onScan” property as “Launch(BarcodeScanner2.Value)” to open URL that is set in the barcode or in QR code. After this save the app.
- Now open an app in mobile to scan barcode or QR code. Initially the app will ask for camera permission because one can scan barcode or QR code by using mobile camera. Next click on “Allow”.
- After clicking on “Scan” button mobile camera will scan barcode or QR code as shown below:
- Scan information is displayed on mobile.
- To open particular URL Click on “Scan and Go” Button. In the below example, we have used QR code related YouTude video. After scanning, the YouTube app will open in mobile and the video will start playing.
Conclusion: Using Barcode Scanner media in power apps we can easily scan Barcode or QR code.