1

I created an application and addeded the firebase service for the push notifications. If I send a notification from the server, the phone will recive the message and shows it in the notification-area, but my custom code in the Method "OnMessageReceived" won't be fired.

It will only be executed if the application is in the foreground...

Nehl-IT
  • 523
  • 3
  • 15
  • Notifications are delivered to your app's `onMessageReceived` when the app is in the foreground, and are handled by the system when the app is not in the foreground. This is by design. If you want messages to always be delivered to your application code, send data messages. For more on this, see [message types](https://firebase.google.com/docs/cloud-messaging/concept-options) in the FCM documentation, or one of the previous question on this topic. In fact: the first related question that Stack Overflow shows covers it. – Frank van Puffelen Nov 14 '17 at 14:45

0 Answers0