Android setBackgroundMessageHandler to perform side effects in KILLED state #6995
Unanswered
raphaelpare
asked this question in
Q&A
Replies: 1 comment
-
No, not that I'm aware of. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I would like to use
messaging().setBackgroundMessageHandler
to perform some actions with my store (recoil (similar to redux)) or my translation service (i18n) but according to the documentation thismessaging().setBackgroundMessageHandler
should be declared at the highest app level (such as index.js).However, when declared at this position, I do not have access to my services and hooks to perform those side effects actions (because recoil is not inited yet).
I have tried to declare
messaging().setBackgroundMessageHandler
at a deeper level inside my providers, but when i do so, the handler is not mounted/triggered when a notification is received in KILLED STATE (WARN:No task registered for key ReactNativeFirebaseMessagingHeadlessTask
) but still works fine in BACKGROUND STATE.I do not have this issue on IOS since it seems like the whole app is started when a notification is received from a KILLED STATE (I don't do headless check) and I can put this handler at a deeper level and still work fine.
My question is : is there a way to mount the whole app on android similar to ios when receiving a KILLED STATE notification so that the handler is mounted/triggered when positioned at a deep level ? Or a way to access my services at a top level (index.js) so that i can declare my handler here and still perform my store actions ?
Thanks for your help
Beta Was this translation helpful? Give feedback.
All reactions