- 1 Minute to read
- Print
- DarkLight
Step 1: Configuration Firebase and Service Worker
- 1 Minute to read
- Print
- DarkLight
Web Push at Mapp is based on Firebase.
The Service Worker is necessary to display messages when the browser or a tab are not in focus.
Download the JavaScript file firebase-messaging-sw.js.
Create the Webapp-Project in Firebase and copy the configuration.
In the JavaScript file make the following adjustments by pasting the configuration:
Example/* ... */ const firebaseConfig = { apiKey: "<<Firebase apiKey>>", authDomain: "<<Firebase authDomain>>", projectId: "<<Firebase projectId>>", storageBucket: "<<Firebase storageBucket>>", messagingSenderId: "<<Firebase messagingSenderId>>", appId: "<<Firebase appId>>", measurementId: "<<Firebase measurementId>>" // Optional }; /* ... */
Parameter
Description
apiKey
Please include as specified in your Firebase console in project settings > general > my app > configuration.
authDomain
projectId
storageBucket
messagingSenderId
appId
measurementId
(Optional) Include only if you use Google Analytics in your Firebase setup.
Watch the following video for more details:
Include the script file "firebase-messaging-sw.js" in your server.