Fireship · @fireship
Push Notifications with Ionic4 and Firebase Cloud Messaging
Uploaded September 11, 2018 · Length 10:23
Summary
Set up Firebase Cloud Messaging for web push notifications in an Ionic 4 progressive web app, including subscribing users to topics and broadcasting notifications.
- ionic 4
- firebase cloud messaging
- web push notifications
- firebase cloud functions
- ionic angular
- firebase messaging
- firebase functions
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
push notifications are a great way to
- 0:08
keep your users engaged and you can send
- 0:10
them directly through your progressive
- 0:11
web app on almost all major browsers now
- 0:13
in today's video you'll learn how to set
- 0:15
up firebase cloud messaging for the web
- 0:17
from scratch and we'll do it in an ionic
- 0:19
floor progressive web app the reason I
- 0:21
chose this topic is because angularfire
- 0:23
2 has now become angularfire and it
- 0:26
lives under the at angular namespace
- 0:28
it's now a stable release with support
- 0:31
for messaging and callable functions
- 0:32
which you'll learn all about in this
- 0:34
video if you're new like and subscribe
- 0:36
and for this video I'm giving away a
- 0:37
one-of-a-kind ionic fire t-shirt all you
- 0:40
have to do is leave a comment below and
- 0:41
I'll pick a random winner by Friday so
- 0:43
today we're talking about web push
- 0:45
notifications which differ from
- 0:47
notifications on native installed apps
- 0:49
like iOS and Android web notifications
- 0:52
work in all major browsers and will feel
- 0:54
just like regular push notifications on
- 0:56
Android devices the big holdout is iOS
- 0:58
Safari so you won't be able to send web
- 1:00
notifications to iPhone users in my
- 1:03
upcoming full course I'll show you how
- 1:04
to set up native iOS notifications for
- 1:06
an installed iPhone app but the lesson
- 1:09
today strictly focuses on web
- 1:10
notifications let's start by taking a
- 1:12
look at what we're building and how it
- 1:14
actually works under the hood the first
- 1:16
thing that happens is the user grants
- 1:17
permission to this app to send
- 1:19
notifications when that happens firebase
- 1:21
will give us a token that we can send
- 1:23
messages to we could use that token to
- 1:25
send a notification to an individual
- 1:27
user or we can subscribe our users to a
- 1:29
specific topic and broadcast
- 1:31
notifications out to everybody at the
- 1:33
same time there are use cases for both
- 1:35
but sending topic-based notifications
- 1:37
tends to be a little more complicated so
- 1:39
that's what I'm going to show you how to
- 1:40
setup today we'll use Kulpa functions so
- 1:43
that we can trigger a cloud function
- 1:44
directly from our front-end by clicking
- 1:46
a button that will subscribe the user to
- 1:48
a topic or unsubscribe them from a topic
- 1:50
and lastly we'll set up a fire store
- 1:52
cloud function that will actually
- 1:53
broadcast out the messages every time a
- 1:55
new document is created in the database
- 1:57
to get started you'll need to have an
- 1:59
existing project and you'll run firebase


