Setting up Firebase Cloud Messaging (FCM) in Ubuntu Server 20.04 and later deploy to Firebase Hosting from scratch.
This setup works in
1. Windows (Edge, Chrome, Firefox)
2. macOS (Chrome, Firefox)
3. Android (Chrome, Firefox)
This setup does NOT work in
1. macOS (Safari)
2. iOS(Safari, Chrome, Firefox)
It is a brand new AWS EC2 Ubuntu Server 20.04 so I’ll have to run these below.
sudo apt update
sudo apt upgrade -y
sudo apt install -y npm
sudo npm install -g firebase-tools
Now we clone the sample project earlier.
cd /tmp
git clone https://github.com/firebase/quickstart-js.git
cd quickstart-js/messaging
cp * ~/oofnivek-medium-fcm/
In the index.html, edit the “<YOUR_PUBLIC_VAPID_KEY_HERE>” with your web push certificate key pair. Below are the series of steps of how to get it.
Now test if the setup was successful.
Next I’ll be writing up on how to send Firebase Cloud Messaging (FCM) push notifications using Bash curl.