Closed scesbron closed 2 years ago
Another point I found in the rnfirebase.io doc (https://rnfirebase.io/messaging/usage#notifications) is that there is no notification shown by default if the message only conains a data
attribute and no notification
attribute. This is the case for the intercom message : is this done on purpose so the intercom sdk can handle internally the notification ?
same issue @scesbron did you find a solution to this?
Currently I managed on android to capture the events received on my phone with two pieces of code.
In my app.js
file
messaging().setBackgroundMessageHandler(async (message) => {
// do something
});
and in my top level component
messaging().onMessage((message) => {
// do something
});
My first piece of code capture intercom notifications received while the app is in background and the second one while the app is in foreground.
What I plan to do (after some ios tests) if there is no other solution is to use a library like https://github.com/zo0r/react-native-push-notification to locally show the notification by myself.
The main drawback I see here is that I think that intercom can't detect that the notification is opened in this case so this will not be shown in the intercom dashboard.
Yeah, I had also added the first two bits of code. So, we are able to detect that we have received a notification from Intercom.
Will try out react-native-push-notification and similar libraries for local notifications. Thanks for the suggestion 👍 We can probably still navigate the user to the Intercom dashboard if such a notification is clicked. Will have to handle that manually.
@browniefed you closed this issue but without any comment: is it because the problem I described does not occur anymore or is it because it is the normal behavior and with the latest versions of Intercom I have to add some code to my app to correctly handle the notifications?
This library is no longer maintained. Please use the official package https://github.com/intercom/intercom-react-native
I have an application which integrates
react-native-intercom
and push notifications with FCM and that works well on production withreact-native-intercom 16.0.0
andreact-native-firebase 5.5.6
.My app is using
react-native 0.59.10
and I am trying to migrate it toreact-native 0.62.2
.For this I need to updage
react-native-firebase
to the new version and I want to upgradereact-native-intercom
to the latest version (17.0.0) to use the intercom sdk 7+.I cannot find in the
react-native-intercom
documentation a clear statement on which version to use for the@react-native-firebase/messaging
dependency and for the underlying FCM sdk.I tried with version
6.7.1
of@react-native-firebase/*
dependencies and with the latest version (8.x
for core and7.x
for other libs).With both configurations I cannot receive the intercom push notifications. What I have tested on my phone
messaging().onMessage
to check that intercom notifications are received on the phone when the app is in the foreground and it is the case.So the problem seems to be one of
react-native-intercom
and@react-native-firebase/messaging
What I managed to do is to use https://github.com/zo0r/react-native-push-notification to show the notifications I received from FCM as local notifications but with this solution the notification is not seen as sent nor as opened in the intercom dashboard.
I found that there is a modification between the v5 and the v6+ of the react native firebase messaging dependency. With the old version the notifications were shown when the app is in the foreground but it is not the case with the new versions.
In the intercom documentation it is said that we have to override
FirebaseMessagingService
which I did for the old version because it seems to be required for the react-native integration. But with the new versions of@react-native-firebase/messaging
this is not possible.I am also using OneSignal for my app push notifications.