In the react-native app I've followed the manual and seen the example but I can't get it to receive the notification.
I call Notifications.registerRemoteNotification(); and receive the token successfully.
This is how I subscribe to events:
Notifications.events().registerRemoteNotificationsRegistered((event) => {
// TODO: Send the token to my server so it could send back push notifications...
console.log("Device Token Received", event.deviceToken);
});
Notifications.events().registerRemoteNotificationsRegistrationFailed(
(event) => {
console.error(event);
}
);
Notifications.events().registerNotificationReceivedBackground(
(notification, completion) => {
console.log(
`Notification received in background: ${notification.title} : ${notification.body}`
);
completion({ alert: true, sound: true, badge: true });
}
);
Notifications.events().registerNotificationReceivedForeground(
(notification, completion) => {
console.log(
`Notification received in foreground: ${notification.title} : ${notification.body}`
);
completion({ alert: true, sound: true, badge: true });
}
);
Notifications.events().registerNotificationOpened(
(notification, completion) => {
console.log(`Notification opened: ${notification.payload}`);
completion();
}
);
(Just like the example)
Notifications.postLocalNotification isn't working either
My bad, I haven't completely uninstalled react-native-push-notifications and that was colliding with this library. After removing everything from the other library it works fine.
Thanks
Hi, I'm able to receive the device token, but when I try sending a notification from my Node.js server it doesn't work.
This is how I send a notification:
and I receive success with the notification ID.
In the react-native app I've followed the manual and seen the example but I can't get it to receive the notification. I call
Notifications.registerRemoteNotification();
and receive the token successfully. This is how I subscribe to events:(Just like the example)
Notifications.postLocalNotification
isn't working eitherAny thoughts? Thanks