Push notification not working in app, when app is running in background

Question: Push notification not working in the app, when the app is running in the background?

Answer:

We are using Firebase for push notification. In this, the class which extends FirebaseMessagingService have overridden method onMessageReceive(). This method is triggered irrespective of the state of the app.

For example: When the app is in Foreground, Background or in the Killed state.

We also receive data payload of the notification in this method using this data we display the notification. So using this mechanism the notifications can be displayed even when the app is in the killed state. We have already implemented this mechanism.

For your future reference, you can refer our UI source for the similar implementation.