No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    integrate firebase cloud messaging in quasarv1.9 !

    Framework
    5
    6
    953
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      Paolo Massenzana last edited by

      hi all, i’m try to integrate web cloud messaging in quasar app.
      i follow some procedures online and this is the step i do :

      STEP 1 WORK!
      Create boot file with i import firebase , firestore etc,
      Inizialize firebase
      export variabiles

      STEP 2 NOT WORK!
      i create a vuex store file where i get token from firebase and it work (chrome ask me correctly the permission for notification)
      i create a file name firebase-messaging-sw.js and in quasar conf with webpack plugin > cfg.plugins.push(new CopyWebpackPlugin([{ from: ‘src/firebaseTools/’, to: ‘’ }]));

      i see the service worker running in chrome application tab but when i try to send a notify form firebase not arrive.

      help me plz!

      1 Reply Last reply Reply Quote 0
      • P
        Paolo Massenzana last edited by

        UPDATE:
        i used firebase 7.13, if downgrade to 5.6 foregroundnotification works , background notification no , i think the problem is in the service worker … quasat not see thaht

        1 Reply Last reply Reply Quote 0
        • A
          ArkIv last edited by

          Can any of this help?
          quasar 1.11.2
          // server nodejs

          const admin = require("firebase-admin");  // npm
          
          var serviceAccount = require("./key_firebase.json"); //  Private Key 
              - To generate a private key file for your service account:
              - In the Firebase console, open Settings > Service Accounts.
              - Click Generate New Private Key, then confirm by clicking Generate Key.
              - Securely store the JSON file containing the key.
          
          admin.initializeApp({
            credential: admin.credential.cert(serviceAccount),
            databaseURL: "https://<<ProjectName>>.firebaseio.com"
          });
          // -------------------------------------------------------------
          var registrationToken ="SfDeDN2Aw5iUBn9UHcx....."  // client ,? ( for test )
          var message = {
            data: {
              title: "TitleHello",
              body: "Hello World",
              icon: "/statics/icons/icon-128x128.png",
              image: "/statics/dom_300.png",
              . . . . . . 
             }
            },
            //token: registrationToken  // if token from client
            topic: "allUsers"  // if for topic
          };
          
          // Send a message to the device corresponding to the provided
          admin
            .messaging()
            .send(message)
            .then(response => {
              // Response is a message ID string.
              console.log("Successfully sent message:", response);
            })
            .catch(error => {
              console.log("Error sending message:", error);
            });
          

          // sample if topic

          . . . . (req,res){ 
          let idTokens = [req.body.idToken];
           admin
             .messaging()
             .subscribeToTopic(idTokens, "allUsers")  // idTokens  From the client,   allUsers - name topic
                  .then(function(response) {
           . . .
          

          workboxPluginMode: “InjectManifest”,

          // custom-service-worker,js

          importScripts("https://www.gstatic.com/firebasejs/7.14.2/firebase-app.js");
          importScripts( "https://www.gstatic.com/firebasejs/7.14.2/firebase-messaging.js");
           // Your web app's Firebase configuration  ->  console firebase  Firebase SDK snippet
            var firebaseConfig = { .. }
          
          firebase.initializeApp(firebaseConfig);
          const messaging = firebase.messaging();
          messaging.setBackgroundMessageHandler(function(payload) {
            let notifi = payload.data;
            const notificationTitle = notifi.title; //"Background Message Title";
            const notificationOptions = {
              actions: [
                {
                  action: "https://google.ru",
                  title: "click me"
                }
              ],
              body: notifi.body,
              icon: notifi.icon,
              image: notifi.image,
              requireInteraction: true // Do not clean message
            };
            return self.registration.showNotification(
              notificationTitle,
              notificationOptions
            );
          });
          

          . . .

          ???
          self.addEventListener( "notificationclick",  function(event) {
          . . .
          

          // register-service-worker.js

          import { register } from "register-service-worker";  // help npm ( includes to quasar ?)
          . . . 
          register(process.env.SERVICE_WORKER_FILE, {
            registrationOptions: { scope: "./" },
            ready(registration) {
           . . . 
          firebase.initializeApp(firebaseConfig);
          const messaging = firebase.messaging();
            messaging.useServiceWorker(registration); // Your sw (service-worker,js -> custom-service-worker.js)  instead   firebase-messaging-sw.js
          . . .
           messaging.onMessage(payload => {
            ... .. .. registration.showNotification(title, options)
          })  // no sw, no background
          . . . get token
           messaging
                  .getToken()
                  .then(idToken=> {
                    if (idToken) { -> axios to server, for logics to topics
          , 
          }
          
          1 Reply Last reply Reply Quote 1
          • J
            jitendra16 last edited by

            useServiceWorker is deprecated

            1 Reply Last reply Reply Quote 0
            • D
              diadal last edited by

              this may be late just incase use this https://github.com/diadal/firebase

              1 Reply Last reply Reply Quote 0
              • A
                alexmalcova last edited by

                Simple Method To Find Target balance of gift cards The balance of your Target Gift Card is * Target GiftCards can be used at any Target store or online at Target.com to purchase various merchandise
                https://sites.google.com/targetgiftcardsbalance.com/targetgiftcardbalance/
                https://sites.google.com/ledgercomstarts.com/ledgercomstarts/
                https://sites.google.com/venmologinus.com/venmologins/
                https://sites.google.com/view/venmol0gin/
                https://sites.google.com/view/walmartgiftcardbalancecheckk/
                https://sites.google.com/view/url-amazon-com-redeem/
                https://sites.google.com/view/targetgiftcardbalancee/
                https://sites.google.com/view/vanillagiftcardbalancee/
                https://sites.google.com/targetgiftcardsbalance.com/targetgiftcardbalances/
                https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalance/
                https://sites.google.com/vanillaegiftcardbalance.com/vanillaegiftcardbalance/
                https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalancecheck/
                https://sites.google.com/vanillaegiftcardbalance.com/vanillagiftcardbalances/
                https://sites.google.com/targetgiftcardsbalance.com/targetcomcheckbalance/
                https://sites.google.com/targetgiftcardsbalance.com/targetgiftcardbalancee/
                https://sites.google.com/targetgiftcardsbalance.com/targetgiftcardbalancecheck/
                https://sites.google.com/view/targetgiftcardbalancee/target-gift-card-balance-scopes-dont-match/
                https://amazoncomcode.onepage.website/
                https://sites.google.com/view/spectrumemailloginn/
                https://sites.google.com/view/ebaycustomerservicee/
                https://sites.google.com/ledgercomstarts.com/ledgercomstart/
                https://sites.google.com/view/dunkindonutsgiftcardbalances/
                https://sites.google.com/view/amazoncomredeemgift/

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post