Use firebase-messaging-sw.js file in quasar 1.5.8
-
@itslab3rt can i see your code? This is a pain in the ass to implement. I hope there is an quasar extension for FCM
-
-> messaging.useServiceWorker(registration); registration = any ServiceWorkerRegistration
https://quasar.dev/quasar-cli/developing-pwa/handling-service-worker
… ready(registration){
const messaging = firebase.messaging();
messaging.useServiceWorker(registration);
}Use custom-service-worker.js instead of firebase-messaging-sw.js
-
Copy to dist:
package.json
“scripts”: {
“build”: “npm version patch && quasar build -m pwa && cp -R distAdd/* dist/pwa”, -
@ArkIv Can you provide more clear idea with detailed info?
-
@jitendra16 ???
npm run build - start
npm version patch - increment version ( package.json “version”: “0.0.1”)
quasar build -m pwa - build pwa ( process.env.version - get version in project )
cp -R distAdd/* dist/pwa” - copy all files from directory distAdd to dist/pwa after build
UPD: That process.env.version would work
quasar.conf.js
. . build: {
. . . env: { version: JSON.stringify(require("./package.json").version) },
. . . -
I come from the future, the plugin “copy” changed its syntax.
const CopyWebpackPlugin = require('copy-webpack-plugin') // .. build: { extendWebpack (cfg) { // Copy the firebase service worker file cfg.plugins.push(new CopyWebpackPlugin({ patterns: [ { from: 'src/firebase/', to: '' } ] })) } }
-
quasar/app v2.0.0 released https://forum.quasar-framework.org/topic/6192/quasar-app-v2-0-0-released-major-improvements
- Support for a /public folder which replaces /src/statics. The new folder will allow you to supply static content at the root/app base level, rather than as statics/*.
-
@alhidalgodev You save my day, thanks !!!
-
@alhidalgodev Hi, I can’t make it working because my app in subfolder, the app always find for the firebase-messaging-sw.js in root.
How can I solve this?
Thanks in advance
-
@ngekoding Yes, read my last comment
-
Has anyone been able to get FCM working with a background message notification that will navigate the user to a specified url when the message is clicked?
I’ve tried different approaches from the answers above as well as other approaches and none of them seem to work.
I can display the notification but cannot get it to navigate to the app url if it’s already opened or open a new tab/window with the url.
If anyone has solved this problem can you share your solution?
Thanks
-
@jrhopkins83 Hi, I have the same problem. Did you solve? Thanks.