1

I would just like to receive the notification data via the OnMessageReceived method and then display a custom notification with Unity's MobileNotification or UTNotification.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

1

Any information in the notification property of a message is automatically handled by the system when the app is not active. If you don't want the system to automatically display a notification, make sure that your message contains no notification property. Data only messages are not displayed by the system automatically.

For more on this, also see the Firebase documentation on message types.


While it is possible to add data properties to an FCM message that is sent through the Firebase console in the Custom data section of the Additional options, there is no way to send a data only message. Messages sent through the Firebase console will always have a notification property, which is what triggers the system to display them.

If you want to send data-only messages, the simplest way is through a CURL command as shown here: How can I send a Firebase Cloud Messaging notification without use the Firebase Console?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • In this case I'm using the playfab cloud script to send the notification, and when I receive the data, firebase already sends the notification. If I didn't want this behavior I would have to follow this idea from CURL or even pubSub from playfab, I believe I understand. – Joel Oliveira Nov 24 '21 at 17:00
  • I missed that you weren't necessarily asking about the Firebase console. I added an intro paragraph to my answer abuot message types. – Frank van Puffelen Nov 24 '21 at 17:22