Vue send push notification with Firebase

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 55

  • @ablegreimerguzmanperez7250
    @ablegreimerguzmanperez7250 10 месяцев назад

    Salvaste mi vida, mi carrera universitaria, todo viejo... MUCHAS GRACIAS!!!

    • @benixal
      @benixal  10 месяцев назад +1

      Thank you so much for your kind words! I'm glad the video was helpful to you.

  • @hungha9991
    @hungha9991 Год назад

    Hi, thank for your share - thank you very much, i did it, but i have one question, if i standing at localhost web then send noti, i cant get noti instead firebase-admin already push, buts if i go to other url then i get noti, Did i do something wrong ? Many thank you

    • @benixal
      @benixal  Год назад

      Hi thanks for your comment , your welcome!
      that's because the Firebase default service worker does not show background notifications when the page is focused.
      (Instead, it sends a payload directly to your app)
      and you need to handle the display within your application:
      onMessage(messaging, (payload) => {
      console.log('Message received. ', payload);
      // Display the message using your app's elements.
      // For example, pop a div or use other UI elements.
      });
      However if you want to show push notifications even when the user is on the focused screen,
      Try using this simple javascript service worker instead of what I did in video:
      gist.github.com/benixal/80440dcec49f71c4423f428e27e7ad6f#file-firebase-messaging-sw-js
      (don't forget to clear the browser cache or update the service worker through devtools for the changes to take effect)

  • @kennyjeancarloarevaloreyes6976
    @kennyjeancarloarevaloreyes6976 5 месяцев назад +2

    The notifications in the foreground and according to the plan only reach me through the console, everything is fine, but the notification window is not shown and when I close the page the sale does not appear, what is the reason?

  • @gapboi6044
    @gapboi6044 11 месяцев назад

    Thank you so much! I've watched many videos and could not understand how to do this with firebase's docs

    • @benixal
      @benixal  11 месяцев назад

      Thank you for your kind words! I'm glad you found the video helpful.

  • @tyresewatchthis8025
    @tyresewatchthis8025 7 месяцев назад

    Bro you have no idea how much you helped me. Thanks a lot, I subscribed, please make more Vue.js + Firebase videos

    • @benixal
      @benixal  7 месяцев назад

      Thank you so much! I'm glad the video helped you. More Vue.js + Firebase content is on the way, so stay tuned! 🚀

  • @hieuNguyen-om8sg
    @hieuNguyen-om8sg Год назад +1

    thank you so much for the guide, i got it to work the same as you at 9:15 but my project uses laravel as back-end so is there a code or place you know that i can read up on how to set up on that side ? im using axios to connect between the two, the firebase setting does not have code for php it would seems

    • @benixal
      @benixal  Год назад +1

      Thanks for your comment, I'm glad it was helpful!
      I think there is no official Firebase Admin SDK for PHP.
      Instead, you need to use REST:
      firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send
      You can use cURL in PHP to interact with it
      Check out this Gist:
      gist.github.com/benixal/59c5be11d1f67502698decf0c80e2cf2

  • @chill-hot-stream
    @chill-hot-stream 11 месяцев назад

    nice tutorial it helped me today with nuxt3 integration

    • @benixal
      @benixal  11 месяцев назад

      Thanks for your comment, Glad it helped 😀 👍

  • @bryancan
    @bryancan Год назад +1

    This is great, thanks. Now what if I want to use Capacitor to turn this Vue.js app into an ios/android mobile app?
    Will it just work, or is there an entirely different process?

    • @benixal
      @benixal  Год назад

      Thank you!
      I'm not familiar with Capacitor , I'm not sure

    • @04Condor
      @04Condor Год назад

      worked for you with a capacitor?

    • @antohagobet4451
      @antohagobet4451 Год назад

      same question "worked for you with a capacitor?" i'm doing app with vue.js (capacitor) do you find any solution to send push notification via firebase?

    • @ameename4425
      @ameename4425 11 месяцев назад

      @@benixal you are currently running in browser. What if we build an android .apk file and install apk in my mobile. Will the notification still be sent?

  • @kaliloteixeira2089
    @kaliloteixeira2089 Год назад +1

    Does it works in PWA's? Using VUE 2.

  • @theuglybarnacledad
    @theuglybarnacledad 3 месяца назад

    Thank you so much! you help me and your instruction very, very clear i subbed ofc

  • @Mewain
    @Mewain 11 месяцев назад +1

    You are the boss ! thank you

    • @benixal
      @benixal  11 месяцев назад

      Thank you so much! I'm glad the video was helpful for you.

  • @PkStarstormAlfa
    @PkStarstormAlfa Год назад

    background notifications aren't showing up, I get the console log when I focus the page, but no notification popup

    • @benixal
      @benixal  Год назад +1

      Firebase service worker does not show background notifications when the page is focused. Try using this simple javascript service worker: gist.github.com/benixal/80440dcec49f71c4423f428e27e7ad6f#file-firebase-messaging-sw-js

  • @Mewain
    @Mewain 11 месяцев назад

    The notification doesn't seems to be received on ios. (standalone/fullscreen mode)
    Do you know why ?

    • @benixal
      @benixal  11 месяцев назад

      Thanks for letting me know. I haven't tested it on iOS yet.

    • @Mewain
      @Mewain 11 месяцев назад

      This is working everywhere, except on ios :(@@benixal

  • @muhammadalbab2678
    @muhammadalbab2678 Год назад +1

    do you know why this method only works on chrome? i tested on safari and firefox they both don't work

    • @benixal
      @benixal  Год назад

      For Firefox:
      "I tested this method on Firefox and did not encounter any issues. Could you please provide more information on the error you are seeing in the console?"
      For Safari:
      "The push API may not work on older versions of Safari. To send push notifications on Safari, you may need to use the Apple Push Notification Service (APNs). However, according to Apple, Safari 16 and newer versions will support the push API. I have not tested this yet."
      firebase.google.com/docs/web/environments-js-sdk#browsers
      caniuse.com/push-api

    • @muhammadalbab2678
      @muhammadalbab2678 Год назад

      @@benixal thanks for the reply, my bad. on firefox its probably because i tested it on localhost still, i read somewhere it says has to be on https. thanks

  • @moali6657
    @moali6657 Год назад

    hi
    is it safe to put the file in public where the file has the FCM keys?

    • @benixal
      @benixal  11 месяцев назад +1

      Hi! Yes, it's safe to put the file with the public VAPID key in public. Just remember to keep the private key secure and never share it publicly.

    • @moali6657
      @moali6657 11 месяцев назад

      @@benixal thanks

    • @blalmal10a
      @blalmal10a 11 месяцев назад

      @@benixal Sir, is it safe to include the firebase config in service worker?

    • @benixal
      @benixal  11 месяцев назад

      Yes, it's safe
      The Firebase config, including apiKey, identifies your project; it's not a security risk if known.
      stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public
      firebase.google.com/docs/cloud-messaging/js/receive?hl=en&authuser=0#web-namespaced-api

  • @MrBoXon
    @MrBoXon Год назад +1

    Thank you, finally managed to get this to work! Is there any way to toggle a "Heads up" notification on Android devices? I can see it in my notification center, but currently it doesnt generate a popup notification or show on lock screen. Any idea? :)

    • @Mewain
      @Mewain 11 месяцев назад

      i guess you need to run it on standalone mode (pwa installed on the device)

  • @leviomagbemi
    @leviomagbemi 4 месяца назад

    Thank you so much!

  • @yazidakbar5373
    @yazidakbar5373 Год назад

    THANK YOUUUU LOVE YOU BROOOO 💥💥💥💥💥💥💥

    • @benixal
      @benixal  Год назад

      Thanks! 🙌 Glad the video was useful to you.

  • @LoVe-iu9rd
    @LoVe-iu9rd Год назад

    Is target tocken is for only one user or all users ?

    • @benixal
      @benixal  Год назад +1

      Each token is only for one user , but if you want to send message to all users , you can send it to topics :
      firebase.google.com/docs/cloud-messaging/js/topic-messaging

    • @LoVe-iu9rd
      @LoVe-iu9rd Год назад

      @@benixal thank you

  • @MAXTangolaos
    @MAXTangolaos Месяц назад

    thanks bro

  • @أحمدرمضان-ف6م5ص
    @أحمدرمضان-ف6م5ص Год назад

    Thank you from here to sky

    • @benixal
      @benixal  Год назад +1

      Thank you for your comment, I'm glad you found the video helpful.

  • @영상-j2c
    @영상-j2c День назад

    Bro is Steve Wozniak's Father

  • @ЯРепетитормобильноеприложение

    Thanks so much!

  • @MarcosGrandesso
    @MarcosGrandesso Год назад

    awesome thanks

    • @benixal
      @benixal  Год назад +1

      Thanks! 😊👍

  • @focus9454
    @focus9454 Год назад

    you are a god friend

    • @benixal
      @benixal  Год назад

      Thank you! I'm glad the video was helpful to you.

  • @tiagofarias-ti
    @tiagofarias-ti 11 месяцев назад

    Perfect

    • @benixal
      @benixal  11 месяцев назад

      You're welcome! 🙌