Reputation: 727
We have an Angular 6 / Firebase 5.4.2 / AngularFire PWA that is heavily using Firebase for auth, and FCM for notifications that we are attempting to bundle into an application suitable for listing in app stores.
The PWA is functioning well, and is receiving FCM notifications via the firebase-messaging-SW.js service worker.
We've attempted using both Cordova, and Capacitor to bundle this PWA into an APK and IPA. We've struggled to get notifications working, however. Debugging the issues have shown us that although the service workers register, as we request permissions, we get the errors:
ERROR FirebaseError: Messaging: This browser doesn't support the API's required to use the firebase SDK. (messaging/unsupported-browser).
referenceError:Notification is not defined. firebase messaging request permission
Any guidance on this would be much appreciated: if you know of code samples that show packaging a PWA while using FCM notifications that we can work from, that would be ideal, or if you know of approaches that have proven successful for other teams, then a point towards those toolsets would also be of use!
Upvotes: 3
Views: 528
Reputation: 11
We've also been looking into methods for packaging PWAs. With Capacitor our experience is similar: service workers (and some other features) do not work and we are starting to look into native plugins/polyfills to replace all features that rely on service workers but this seems quite complicated.
However, just today I came across some news that might help you publish your PWA to Google Play: Apparently, PWAs can now be distributed through the Google Play Store. This is achieved through something called Trusted Web Activities. I have not tried it yet but you can read all about it here:
https://medium.com/@firt/google-play-store-now-open-for-progressive-web-apps-ec6f3c6ff3cc
Looks like things are still evolving in the PWA world!
Upvotes: 1