-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Cannot send to notification centre because there is no 'message' field in: Bundle #1452
Comments
Hi @rohitkum28 |
Hi @Dallas62 |
I'm not sure to understand the problem with Comet Chat. I don't see any notification library in the link you provided ? |
Here is my code for Component to handle Push notification
And I using this component inside my App.js. This same code works with version 3.1.9 of the library with the above push notification json I shared. But, with version 3.5.0, I see the above error message in adb console. |
The problem is a side effect of moving data from
Note:
|
Since we don't have the control over the server that sends the payload, is downgrading the library only option left now? |
There is another option, you can trigger a local notification when you receive data from server. |
Could you please elaborate on this, where was the move from I got the same issue: My resolution was to use the |
I ended up with a temporary solution of patch-packaging the latest version with the following change. I simply included all of the keys in the bundle, like the lib used to work, but retained the latest code as well. It's not a clean solution as it possibly duplicates things, but it works for my case.
|
I try calling PushNotification.localNotification() after receiving a remote notification, and I STILL get another "Cannot send to notification centre" error for the local notification. How do I fix this? What version did this break? I'm at the point where I'm seriously considering switching over to using FCM directly via react-native-firebase. |
Hi @tmaly1980 |
@Dallas62 it looks like
Since there is a free tier, perhaps that would suffice as a repro example? The last version that was working with this (and I have the same problem with aws pinpoint) was |
Hi @bneigher |
@Dallas62 understood and frankly I wouldn't either if I were you lol. At least take a look at this - intercom's README specifically calls out to a change that FCM clients must do: If it looks like we can substitute your library so we don't have to install react-native-firebase to accomplish this that will probably suffice for most people. Otherwise if by looking at this you see a way to adapt the source to include this payload change that would be cool too |
Hi @bneigher Can you share you AndroidManifest ? (Remove secrets and hide name if you prefer) This will help if I found time on this issue. |
@rohitkum28 I am facing the same issue, by any chance were you able to fix it" |
Hi @MaganAnkur onNotification: function(notification) {
if(!notification.userInteraction) {
PushNotifications.localNotification(notification.data);
}
} This is an example from my phone, fix syntax if needed. |
As a temporary solution, I downgraded the version of the library to 3.1.9. But after that, I shifted to react-native-firebase. |
Any updates on this? The proposed workaround with LocalNotification is not working |
Thanks, it works! |
This workaround works for me :
Used with Sendbird service (but works for Intercom too i think) EDIT : thanks to @Dallas62 advice |
Hi @Sylchauf This code is working, but take care of Regards, |
Do you happen to have an example of that full payload which is working for you? I am still having this issue sending via AWS SNS. |
Hi @nicholascm onNotification: function (notification) {
if (!notification.userInteraction) {
PushNotification.localNotification(notification.data);
}
} Where data is the content of: Regards, |
I think my issue maybe around what the person I quoted mentioned, where AWS SNS does not send the properly formatted message as I am also using AWS SNS. Even if I send messages formatted with the required fields as you mentioned, I have the
|
So you must adapt the SNS format to the right format (firebase one or to fit |
I was able to get the remote notification sent by AWS SNS to show by doing the below: PushNotification.configure({
...config,
onNotification: function(notification) {
let message = notification?.data?.default; // this seems weird to me. My data is always a string - I can Parse the JSON if it is JSON here or send only a string and display (as shown below)
if (!notification.userInteraction) {
PushNotification.presentLocalNotification({
message: message || 'New notification',
channelId: 'default-channel-id',
});
}
},
senderID: 'some-id',
popInitialNotification: true,
requestPermissions: true,
}); |
I was able to get the remote notification sent by Mattermost Push Proxy using workaround provided by @nicholascm |
Hi @Dallas62 i have the same issue for silent push notification, i got the PN when the app it's running or it is in background but not getting any PN when the app it's killed, i tried all the solution mention above but nothing it's working, when i add the body key to PN it hits the app and PN it's shown, but it s not the intended functionality as i want to show a local PN after i process the data from PN: In Android Studio i see that onMessageReceived: has the PN, sendNotification: has the same PN, but i still get RNPushNotification: Ignore this message if you sent data-only notification. Cannot send to notification centre because there is no 'message' field in: Bundle etc. |
Please check the example project and Readme, your configuration must be wrong. |
Hi @Dallas62 , thank for hint , as a POC i created a new project from 0. when i sent this payload from postman i get PN when the app it s killed (in STATUS BAR from where i can open the app and show a local notification where i can do my localization( the issue it s that in status bar i have a message that it s not localized) when i send this paylaod - to show a local notification with localized data did i missed something as i already tried all that it is in readme and the example model and i still have the same issue, Thank you |
Please fix your markdown. Then re-read the readme Regards |
Fixed it |
State of the repositoryThis repository is not actively maintained. The main reason is time. The second one is probably the complexity of notifications on both iOS and Android. Since this project probably need a huge refactor to fix some issue or to implement new features. I think you should probably consider these alternatives: Notifee free since september or react-native-notifications. If you are interested in being a maintainer of this project, feel free to ask in issues. |
I am trying to include version 3.5.0 of the library in my current react-native project. Earlier in one of my older project I was using version 3.1.9 of the library.
From my server when I try to POST something like
It shows up in as a notification in my old project but it doesn't show up as notification with the latest version of the library.
On debugging the issue further and checking my adb logs, I see the following error.
This is not the case with version 3.1.9 of the library.
Environment Info
The text was updated successfully, but these errors were encountered: