Closed mikeangelsilva closed 3 years ago
For when the app is foreground, the recommended way is NOT to rely on push notifications. Instead - use regular chat connection for it and display local notifications when receive chat message
@DaveLomber hi,do you have idea on how to pass payload using local notification ?
https://github.com/react-native-push-notification-ios/push-notification-ios i used react-native-push-notification-ios
PushNotificationIOS.addNotificationRequest(request);
i tried it, but i cant get the dialog data when i passed it.
thank you :)
@mikeangelsilva use this API
So my solution so far:
These two in isolation work fine. The problem is that when I receive a remote push notification I receive it then open the app, and then a local notification is fired from the onMessageListener.
As we cannot display remote notifications in the foreground, can anyone recommend a solution?
@stevenblake-banntech you mean you have 2 notifications displayed instead of one?
So my solution so far:
- onMessageListener will display a local notification when a message is received
- subscribe to remote push notifications which works when a message is received and app is closed or in the background.
These two in isolation work fine. The problem is that when I receive a remote push notification I receive it then open the app, and then a local notification is fired from the onMessageListener.
As we cannot display remote notifications in the foreground, can anyone recommend a solution?
i know its out of topic, but it would be great if you can help me in how to add onMessage listener in a function component. @stevenblake-banntech @DaveLomber
I do only recieve notification when the app is in background/kill. But when the app is in foreground, notification wont show.
Do i need to pass something on the payload, or is there any configuration on that?
Thank you.