Vue send push notification with Firebase

  Рет қаралды 14,069

benixal

benixal

Жыл бұрын

see how to send push notification to browser with Firebase cloud messaging or FCM in Vue js
Vue app source : github.com/benixal/vue-fireba...
admin.js : gist.github.com/benixal/259b4...
00:00:09 create Firebase project
00:00:33 create a web app in Firebase console
00:00:43 create new Vue app
00:02:24 getToken
00:03:12 get VAPID KEY
00:04:04 service worker
00:04:44 get message in forground
00:05:16 setup service worker
00:07:35 send test message
00:09:13 send notifications from server

Пікірлер: 51
@ablegreimerguzmanperez7250
@ablegreimerguzmanperez7250 5 ай бұрын
Salvaste mi vida, mi carrera universitaria, todo viejo... MUCHAS GRACIAS!!!
@benixal
@benixal 5 ай бұрын
Thank you so much for your kind words! I'm glad the video was helpful to you.
@gapboi6044
@gapboi6044 6 ай бұрын
Thank you so much! I've watched many videos and could not understand how to do this with firebase's docs
@benixal
@benixal 6 ай бұрын
Thank you for your kind words! I'm glad you found the video helpful.
@tyresewatchthis8025
@tyresewatchthis8025 2 ай бұрын
Bro you have no idea how much you helped me. Thanks a lot, I subscribed, please make more Vue.js + Firebase videos
@benixal
@benixal 2 ай бұрын
Thank you so much! I'm glad the video helped you. More Vue.js + Firebase content is on the way, so stay tuned! 🚀
@chill-hot-stream
@chill-hot-stream 5 ай бұрын
nice tutorial it helped me today with nuxt3 integration
@benixal
@benixal 5 ай бұрын
Thanks for your comment, Glad it helped 😀 👍
@kaliloteixeira2089
@kaliloteixeira2089 9 ай бұрын
Does it works in PWA's? Using VUE 2.
@kennyjeancarloarevaloreyes6976
@kennyjeancarloarevaloreyes6976 10 күн бұрын
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?
@Mewain
@Mewain 6 ай бұрын
You are the boss ! thank you
@benixal
@benixal 6 ай бұрын
Thank you so much! I'm glad the video was helpful for you.
@yazidakbar5373
@yazidakbar5373 Жыл бұрын
THANK YOUUUU LOVE YOU BROOOO 💥💥💥💥💥💥💥
@benixal
@benixal Жыл бұрын
Thanks! 🙌 Glad the video was useful to you.
@user-od2xf7ng7i
@user-od2xf7ng7i Жыл бұрын
Thanks so much!
@benixal
@benixal Жыл бұрын
You're welcome!
@hieuNguyen-om8sg
@hieuNguyen-om8sg 10 ай бұрын
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 10 ай бұрын
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
@MarcosGrandesso
@MarcosGrandesso 10 ай бұрын
awesome thanks
@benixal
@benixal 10 ай бұрын
Thanks! 😊👍
@user-lc5xi9zs7v
@user-lc5xi9zs7v Жыл бұрын
Thank you from here to sky
@benixal
@benixal Жыл бұрын
Thank you for your comment, I'm glad you found the video helpful.
@MrBoXon
@MrBoXon Жыл бұрын
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 6 ай бұрын
i guess you need to run it on standalone mode (pwa installed on the device)
@focus9454
@focus9454 Жыл бұрын
you are a god friend
@benixal
@benixal Жыл бұрын
Thank you! I'm glad the video was helpful to you.
@PkStarstormAlfa
@PkStarstormAlfa 7 ай бұрын
background notifications aren't showing up, I get the console log when I focus the page, but no notification popup
@benixal
@benixal 7 ай бұрын
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
@bryancan
@bryancan 11 ай бұрын
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 11 ай бұрын
Thank you! I'm not familiar with Capacitor , I'm not sure
@04Condor
@04Condor 7 ай бұрын
worked for you with a capacitor?
@antohagobet4451
@antohagobet4451 6 ай бұрын
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 6 ай бұрын
@@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?
@muhammadalbab2678
@muhammadalbab2678 Жыл бұрын
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
@LoVe-iu9rd
@LoVe-iu9rd Жыл бұрын
Is target tocken is for only one user or all users ?
@benixal
@benixal Жыл бұрын
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
@moali6657
@moali6657 6 ай бұрын
hi is it safe to put the file in public where the file has the FCM keys?
@benixal
@benixal 6 ай бұрын
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 6 ай бұрын
@@benixal thanks
@blalmal10a
@blalmal10a 6 ай бұрын
@@benixal Sir, is it safe to include the firebase config in service worker?
@benixal
@benixal 6 ай бұрын
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
@Mewain
@Mewain 6 ай бұрын
The notification doesn't seems to be received on ios. (standalone/fullscreen mode) Do you know why ?
@benixal
@benixal 6 ай бұрын
Thanks for letting me know. I haven't tested it on iOS yet.
@Mewain
@Mewain 6 ай бұрын
This is working everywhere, except on ios :(@@benixal
@tiagofarias-ti
@tiagofarias-ti 6 ай бұрын
Perfect
@benixal
@benixal 5 ай бұрын
You're welcome! 🙌
@hungha9991
@hungha9991 6 ай бұрын
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 6 ай бұрын
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)
Firebase Send Push Notification JavaScript + PHP
27:22
benixal
Рет қаралды 9 М.
2. Push Notifications with Service worker: Push API + Push Service
13:23
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 32 МЛН
Slow motion boy #shorts by Tsuriki Show
00:14
Tsuriki Show
Рет қаралды 7 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
100❤️
00:19
MY💝No War🤝
Рет қаралды 23 МЛН
Firebase Cloud Messaging API (v1) Tutorial
9:13
Native Notify
Рет қаралды 65 М.
Ionic 7+ firebase push notifications for android
38:33
Coding Technyks
Рет қаралды 11 М.
Top 5 Free Mapping Tools
14:05
Swyvl
Рет қаралды 23 М.
Sending Push Notifications with Laravel
26:54
benixal
Рет қаралды 9 М.
Push Notifications with Service worker
14:15
Akilesh Rao
Рет қаралды 28 М.
How to create a PWA with the Vue CLI
5:17
Michael Awad
Рет қаралды 13 М.
Engage users with Firebase Cloud Messaging
25:33
Firebase
Рет қаралды 20 М.
How To Send Push Notifications With JavaScript?
18:51
Piyush Garg
Рет қаралды 36 М.
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 32 МЛН