I'm using firebase notifications in my app in android. As I saw, when the app is in foreground I have to take the notification from the FirebaseMessagingService class and, when it is in background or totally closed, from the mainActivity. It works good most of the times but I've discovered that when I close the app, then open with a notification and then send another notification with the app in background, it doesn't work. The last one open the app but it doesn't pass for the onCreate() of the mainActivity. It just open the app in the activity it was before.
Do you have any clue of why this is happening?