Simon Farshid
Simon Farshid

Reputation: 2686

Firebase Messaging "This site has been updated in the background." Instead of Actual Notification

I want to send background push notifications to web browsers using Firebase. The push notifications are received, but the notification is not understood by Chrome. Instead of showing the actual title and body, the message "This site has been updated in the background." appears. What am I doing wrong?

this site has been updated in the background

My service worker is an empty file.

Code in Cloud Function using the Admin API:

var res = await admin.messaging().send({
  "notification": {
    "title": "Background Message Title",
    "body": "Background message body"
  },
  "topic":"Test"
});

Upvotes: 1

Views: 1499

Answers (1)

Tomasz Szarek
Tomasz Szarek

Reputation: 11

Because your service worker is empty file you don't handle message event and browser is displaying default message.

Upvotes: 1

Related Questions