Step 1: Configuration Firebase and Service Worker
    • 1 Minute to read
    • Dark
      Light

    Step 1: Configuration Firebase and Service Worker

    • Dark
      Light

    Article summary

    Web Push at Mapp is based on Firebase.

    The Service Worker is necessary to display messages when the browser or tab are not in focus.

    1. Download the JavaScript file firebase-messaging-sw.js.

    2. Create the Webapp-Project in Firebase and copy the configuration.

    3. In the JavaScript file "firebase-messaging-sw.js" 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>>"
      };
      
      /* ... */

      Parameter

      Description

      apiKey




      Please include as specified in your firebase console in project settings > general > my app > configuration.

      authDomain

      projectId

      storageBucket

      messagingSenderId

      appId

      measurementId

      Watch the following video for more details:

    4. Include the script file "firebase-messaging-sw.js" on your server.


    Was this article helpful?