Changer
Changer

Reputation: 359

Firebase cloud messaging: disable the popup notification

I have an android app which has a separate activity for notifications. I integrated firebase cloud messaging to my app for sending notifications to users. When I send a notification from the console, by default a notification pops up from the app. I want disable that notification and save the message from notification to a database. Later when user opens the app it gets the notifications data from the database and show them to the user. That means I don't want to show popup notifications to user, I want to show them only if user opens the app. My question is: How can I disable the default notification which pops up when a message is received?

Upvotes: 0

Views: 2849

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317828

If you want to send a message without a notification, you should not use the Firebase console to send that message. Instead, you will need to write some code on your desktop or backend, usually with the Firebase Admin SDK, to send a message with a data payload. The app will silently receive that message, and you can decide what to do with it from the callback you receive. Start with the instructions in the documentation to set up the client app. Be sure you are sending messages with only a data payload. It must not contain a notification payload.

Upvotes: 1

Related Questions