Open Rhys-Woolcott opened 3 years ago
the same. It was normal before
the same. It was normal before
Explain. Your comment makes 0 sense
Also running in to this. I've been able to get a local notification to show by duplicating some keys in a data
field, e.x:
function onNotification(notification) {
...
const { data, id, userInteraction, message } = notification;
if (!userInteraction) {
PushNotification.localNotification({
channelId: ANDROID_CHANNEL_ID,
...data,
...notification,
data: { ...data },
});
}
...
}
But without the data
field, no local notification shows
Also running in to this. I've been able to get a local notification to show by duplicating some keys in a
data
field, e.x:function onNotification(notification) { ... const { data, id, userInteraction, message } = notification; if (!userInteraction) { PushNotification.localNotification({ channelId: ANDROID_CHANNEL_ID, ...data, ...notification, data: { ...data }, }); } ... }
But without the
data
field, no local notification shows
I see. That is quite odd. Might try making a pull request later with a fix if i can work one out.
Hi, duplicate the information inside data
doesn't change the way it's working. The data
field is not used to display the notification.
Hi, duplicate the information inside
data
doesn't change the way it's working. Thedata
field is not used to display the notification.
Hmmm. Maybe it just requires a data field but does not say in the docs
You should take a look at your AndroidManifest, you probably disabled foreground notifications.
Following up - after looking through some app logs, seems my issue was on the back-end rather than with the library; our service was not correctly sending along the message
field in the payload and was instead setting it in a nested data
field
@tavour-frank , Can you please share the notification object sent from backend? I am still struggling to fix this. In my case onNotification is not trigger when app is in foreground.
Bug
I have sent a local notification but it doesn't show on the device even though my console shows no errors
Environment info
react-native info
output:Library version: x.x.x
Steps To Reproduce
Describe what you expected to happen:
1. 2.
Reproducible sample code
Notification should send but does not.
output in react native: