PWA - How to access Cordova plugins in PWA web applications ?


#1

Hi, I am using “cordova-plugin-qrscanner” in my ionic application. I am able to access all the features from this plugin when run my ionic app as either ios/android app(run on device or generate apk, ipa). But when I run this app as PWA(Progressive Web App), I cannot access any of the plug in features. Kindly guide me how can I access plug in features in PWA. Probably I am missing something linking plugin or something else. Any help with example would be a great help.


#2

Cordova plugins will not work on the web. There are some that do have web versions, like Geolocation, Camera, but most do not.

You will need to find alternate solutions to that functionality if your app needs that function.


#3

cordova itself works on browser.

If the plugin you want to use supports browser platform, you can use it on browser, like @ionic-native/google-maps and cordova-plugin-googlemaps.
https://mapsplugin.github.io/ionic-googlemaps-quickdemo-v4/


#4

You can’t access cordova plugins from the browser.

You just can’t!!!

The ionic/native stuff I think does confuse people into thinking this stuff can work. It’ll wrap some stuff but not others.

You’ll need an HTML5 version for what you need.


#5

It seems the cordova-plugin-qrscanner supports browser platform at least.

@BasappaBaligar
I guess you execute your app as ionic serve.
But you need to execute ionic cordova run browser instead.


#6

@BasappaBaligar

Hi, just tried that plugin. Works on native for mobile, couldn’t get it working via PWA - though in the notes it does say it wraps browser’s native qr reader.
Good luck