Published on December 14, 2016 by Chrome
Want create site? Find Free WordPress Themes and plugins.

Read the Firebase Cloud Messaging documentation: goo.gl/h3wBld

One of the coolest features to land in Chrome recently is the ability to send a user a push notification. These notifications may trigger in response to a user action or could just be used as a mechanism to notify the user when you launch some new content. Traditionally setting up push notifications has required a fair bit of JavaScript and Service Worker know-how. Thanks to polymerfire’s firebase-messaging element we can greatly simplify the process. Check out today’s episode as we cover the basics of setting up firebase-messaging and dispatching our first notification using CURL.

Sample Code
github.com/polymer/polycasts

Firebase Messaging on beta.webcomponents.org:
beta.webcomponents.org/element/firebase/polymerfire/firebase-messaging

Polycasts playlist: goo.gl/r5fsMq
Polymer Slack: bit.ly/polymerslack
Polymer G+: goo.gl/YC5Bsh

Subscribe to the Chrome Developers channel: goo.gl/OUF4e2

Did you find apk for android? You can find new Free Android Games and apps.

Leave a Reply

49 Comments on "Firebase Messaging — Polycasts #59"

Notify of
avatar

eeerrrttty
Guest
eeerrrttty
4 months 30 days ago

PLEASE @Rob Dodson, MAKE AN TUTORIAL SIMPLE FOR FIREBASE STORAGE WITH POLYMER!!!! This is a hell level difficult, we noobs always have trouble with this kind :(, if possible, things like, uploading and retrieving image of storage to view in html….THIS WOULD MOVE FORWARD THE POLYMER PROJECT!

SYS-T@M
Guest
SYS-T@M
26 days 7 hours ago

yesss pleaseee

Chukkrit Visitsaktavorn
Guest
Chukkrit Visitsaktavorn
4 months 26 days ago

agree

Ben Sisakht
Guest
Ben Sisakht
5 months 14 days ago

Hey Rob! Great Video as always! I'm kinda a newbie, just wondering if this would work on Safari (seems to work on desktop) and generally on iOS devices ?

Keertikeya Gupta
Guest
Keertikeya Gupta
6 months 19 days ago

I wonder if I could use FCM to show in-app notifications rather than push notifications. Is there a way to achieve it?

Max Bachhuber
Guest
Max Bachhuber
5 months 12 days ago

You could use the handleMessage function. It is triggered when you receive a message.

Dean Martin
Guest
Dean Martin
6 months 28 days ago

Does this work when the browser is not open at all? Like native push?

Max Bachhuber
Guest
Max Bachhuber
5 months 12 days ago

Yes it does. This is what the service worker is for

Tevin Thuku
Guest
Tevin Thuku
9 months 1 day ago

Thanks Rob For this tutorials. They are amazing 🙂

phani1 kumar
Guest
phani1 kumar
9 months 5 days ago

Thank you Rob for all the great tutorials. How do we let the users unsubscribe from the messaging? ` this.$.userToken.destroy();` inside the else block of `toggleSubscription` doesn't work! I couldn't find any documentation of `firebase-messaging` that tells us how unsubscribe can be performed. Though the above statement deletes record from database, when the user refreshes page, it automatically subscribes without even asking the user whether they want to subscribe or not!Edit: Even after removing the service-worker registered, somehow the browser refresh brings back the subscription token kind of magically! I seriously need a way to unsubscribe.

phani1 kumar
Guest
phani1 kumar
8 months 4 days ago

Nope! my issue that I raised in github is left unanswered. github.com/firebase/polymerfire/issues/182

Slak Tary
Guest
Slak Tary
8 months 4 days ago

did you manage to find a solution ?

Denis TRUFFAUT
Guest
Denis TRUFFAUT
10 months 13 days ago

@rob_dodson I'm not able to get the token after clicking yes on the notification approval, in my code or with yours. I use the polymerfire v0.10.3

Suyash Bansal
Guest
Suyash Bansal
10 months 27 days ago
I was trying the messaging feature described above. I am having 2 problems, one is that there is no token value saved in the firebase when I allow notifications in the browser & second is that I am not able to do curl. I am running Win10 and it gives this error:curl: (6) Could not resolve host: dgMc9xNHmHccurl: (6) Could not resolve host: notificationcurl: (3) [globbing] unmatched brace in column 1curl: (6) Could not resolve host: Hello World,curl: (6) Could not resolve host: bodycurl: (3) [globbing] unmatched close brace/bracket in column 23JSON_PARSING_ERROR: Unexpected character (') at position 0.What can I… Read more »
GuateDev IO
Guest
GuateDev IO
10 months 8 days ago

It seems the issue is caused by the single quote. For windows try not to use single quotes, and escape any double quotes within the string. This example work for me: >>>>>> curl –header "Authorization: key=AAAA2aC_hss:APA91bHcFtbc0-1AqA5jSwHiTITx2YD4M00M63YzH91TxxSGtr1r8ph9MxQ61rm5gAk_eo10of1_jLw3pMpCB6qs0aZEguNqlU5yaZ-iuCdiD602M_rCc5VXkWAUmmifDdF7rvpO0Wt_U2tEPhkcMkj6ssdORgYRgw" –header "Content-Type: application/json" -d "{"to": "eD2TN30-pLI:APA91bGaUSNcPmWGDMRy-be5Y6bjRwgUT51dCCdrBfj-63_BtVWdsx61Vce7DR_bb6c2ZImV0kEft35n3pNZ3xCr0x50cLv-2T_aR-VxNprxZ62KBh9EY0lDnNyr4TwfOTHUcf0z_gbn", "notification": {"title": "Hello World", "body": "This is a notification"}}" fcm.googleapis.com/fcm/send

Brad Walters
Guest
Brad Walters
10 months 28 days ago

:-):-)

Kevin Weekes
Guest
Kevin Weekes
10 months 29 days ago

#AskPolymer Will there be significant changes to building production-ready Firebase/Polymer apps when Polymer 2.0 is released?

1 2 3
wpDiscuz