Firebase notifications in android

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?

Upvotes: 1

Views: 118

Answers (1)

Óscar
Óscar

Reputation: 726

It does not seem to be produced by Firebase but by the lifecycle in Android. If activity was created and pass to background, when you go back the method onCreate won't be call, search about lifecycle on Android. Maybe you can put your code on onResume method.

Upvotes: 1

Related Questions