-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending Custom Data in FCM not working #212
Comments
Same issue here... |
seems to be a problem with expo, doesn't it ? |
Hey guys. Let us know if you can confirm that this is an issue with expo. |
i experienced the same problem. i am not using Expo just nativescript for my app. The problem seems to be due to the migration of the new http api of FCM. my problem was that after migration it seems the data-only notification was not send anymore. Also the android_channel_id property is now just channel_id (although i am currently not using it anymore thus you will not find it in the code below) anyhow, this is working for me now: const data = {
collapseKey: Math.random().toString().replace('0.', ''),
title: 'test',
topic: 'all',
body: 'text',
priority: 'high',
custom: {
id:'123',
},
fcm_notification: {
},
icon: 'notification_icon',
sound: 'test.wav',
category: 'alarm',
truncateAtWordEnd: true,
pushType: 'alert',
};
const pushResult = await push.send(result.user.fcmToken, data); strangely i need to put the empty fcm_notification object into it, because otherwise https://github.com/appfeel/node-pushnotifications/blob/master/src/utils/tools.js#L77 will create these properties for a notification message it seems and then my custom messaging service is not invoked on the android client side. Really strange, but this was doing the trick for me. hopefully this also helps others |
Sending custom data with FCM is not working. When trying to log the notification received in Expo React Native, no custom data is received.
Here's the code:
The notification is received but the custom param "name" is not there.
The text was updated successfully, but these errors were encountered: