Open bzaruk opened 6 years ago
I've just found out that using android:launchMode="singleTask"
is the cause of onMessageReceived
not being called when the app is in the background. It will open the app, but nothing more.
Remove android:launchMode="singleTask"
, and the callback will work. But it will cause android to create new instances of your app when using, for example, DynamicLinks.
Hey your proposed solution is not quite a solution; the app is recreated and a lot of time is spent to view it. I prefer a allropriate solution as recreating the app will also lose user context
I understand, have the same issue as you. Never said that it was a solution, just explaining why onMessageReceived
in your case is not being hit.
@EddyVerbruggen - maybe you have any wisdom saying about the issue?
I am writing about this after a long searching about this issue and without any success.
I'm trying to implement a navigation after notification tray tap functionality. In the current situation I encounter 2 major issues that i'm still not able to properly figure out:
issues tl;dr:
I'm using
android:launchMode="singleTask"
on my AndroidManifest.xml to prevent restarting the app on each notification tray click.For simplicity, lets say that i'm handling chat messages arrival using firebase.
Application state:
Foreground - all work as expected - There is no notification on the notification tray and the data is received on the onMessageReceived callback.
Terminated - a. app is opened via the notification tray - onMessageReceived is called as expected b. app is opened directly (not through the notification tray) - in this case the onMessageReceived is not triggered [expected behaviour that I would like to achieve - onMessageReceived will not be called (as the app will bootstrap & extract chat history anyway) and to make the notification disappear from the tray]
Background - neither when accessed directly, nor from the notification tray, the onMessageReceived is never called. Moreover, I find no way to distinguish the situation where my app was called from clicking the notification tray or directly (resumed from background/ accessed by clicking the app icon)
I am only talking only about Android platform (didn't test it on IOS yet).
I would be happy about any kind of help? even a demo would be awesome!
Thank you a lot!