-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Description
The comment here says onBackgroundMessage
can be used to customize background messages which is true by itself but the problem is that the default notification is still shown by the Firebase SDK. This seems to be an issue with the SDK itself since there is currently no way to prevent the default notification , however I think this issue should also be noted in the comment.
Here is the relevant code from the onPush method
// background handling: display and pass to onBackgroundMessage hook
let isNotificationShown = false;
if (!!internalPayload.notification) {
await showNotification(wrapInternalPayload(internalPayload));
isNotificationShown = true;
}
// MessagePayload is only passed to `onBackgroundMessage`. Skip passing MessagePayload for
// the legacy `setBackgroundMessageHandler` to preserve the SDK behaviors.
if (
isNotificationShown === true &&
this.isOnBackgroundMessageUsed === false
) {
return;
}
if (!!this.bgMessageHandler) {
const payload = externalizePayload(internalPayload);
if (typeof this.bgMessageHandler === 'function') {
this.bgMessageHandler(payload);
} else {
this.bgMessageHandler.next(payload);
}
}
The only case where showNotification
is not called is when internalPayload.notification
is falsy.
hashtag32 and sudosu
Metadata
Metadata
Assignees
Labels
No labels