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 life 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 URL from Barcode or QR code.
Let’s just start exploring this media by simply creating a Barcode Scanner App to get data and open URL from Barcodes or QR code.
In this app we have used two scanners:
- To get Scan information from Barcode or QR code.
- Open URL that is present in Barcode or QR code.
- Now select the “Barcode Scanner” media from the list of media as shown in below screenshot:
- After Barcode Scanner gets added in screen, use the formula on “onScan” property of Barcode Scanner to get the value of Barcode or QR code while scanning code. Then using “Set” method of Barcode Scanner scanned value; set in “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.