Foreground notification handling (onMessage) and NotificationServiceExtension #6556
Replies: 1 comment 2 replies
-
Interesting - I'm not sure, I have not considered that use case, it's literally never come up before :-) There may not be a way owing to control flow / when things happen, and what data is provided to onMessage. More concretely: onMessage is a hook called in our code from firebase-ios-sdk and we are just like a postal carrier, delivering the message to higher levels that we received from lower levels There may be something you can do with regard to swizzling such that the call chain has your extension prior to the firebase-ios-sdk Messaging delegate swizzle (if I'm understanding that correctly) - but that would be experimental on your behalf, you would have to play around with it to see if a) I am even guessing in the correct area b) you even have control of the order and c) you can effectively change it to work the way you want A separate path may be to use NSUserDefault in the extension to leave yourself a clue as to what happened then in react-native check it (via https://reactnative.dev/docs/settings) - a bit less elegant then a perfect swizzle+ordering thing but also a lot less subtle. Maybe useful? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
In iOS, I use NotificationServiceExtension to modify the message before showing to the user. This works fine when the app is in the background. But when in the foreground, I see that the NotificationServiceExtension does get called when the message arrives, BUT the onMessage listener does not see the modified message.
How can I get onMessage to see the modified message?
Thank you for your help.
Beta Was this translation helpful? Give feedback.
All reactions