Integrate barcode scanner feature in PWA application

Hello everyone,

I am trying to build QR code scanning feature in my PWA app … Has anybody tried it ?
Please help me how to achieve that …

I already searched but the npm modules which I got has support for the app …whereas I need support for browser based scan .

Help me if you have a way to achieve that.

Surjan

hi , if you need to scan barcode or QRcode just use this pluging

if you want to generate QRcode you need to use ngx-qrcode2 pluging

Thanks for responding … I have tried the solution … i did not get any error but when I try to run the application on the browser it gives the below error :
Native: tried calling BarcodeScanner.scan, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator

Would you suggest the solution for this … ?

Surjan

you can’t use cordova in browser you should build your app and run it in your device

Actually I want enable the barcode reader using the browser … we are not going to use app right now …

Do you have any alternate solution ?

Surjan

you need corodva to use this pluging , try corodva browser https://www.raymondcamden.com/2016/03/22/the-cordova-browser-platform/

just build an android app is so easy

Does it mean that I need to go with the andorid app to make the scanning work ?

yes build an apk and install your app in your device ,

in your cmd :

ionic cordova platform add android 
ionic cordova build --release android

you can find your APK file in platforms/android/build/outputs/apk

I am new to Ionic and I am trying to solve the same problem for a PWA app. I don’t understand why a PWA app should require a cordova plug-in since a PWA is supposed to use the camera on any device. I found a few posts which demonstrate how to access the camera on desktop and mobile, eventually this works on IOS only since 11.2. Assuming that camera access works on the latest devices, would a QR or bar code scanner require anything else than camera access?