You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
When I am calling fcm server push notification api data is not showing on onNotification function.
Environment info
react-native info output:
// paste it here
Library version: 3.4.0
Steps To Reproduce
I use the following code for recieving push notification
Call the service from postman collection for fcm
we got data in onNotification when app is in foreground but not in backgorund
...
Describe what you expected to happen:
Reproducible sample code
PushNotification.configure({
// (optional) Called when Token is generated (iOS and Android)
onRegister: function (token) {
console.log("TOKEN:", token);
thats.setState({deviceToken:token});
},
// (required) Called when a remote or local notification is opened or received
onNotification: function (notification) {
console.log('** NOTIFICATION: **', notification);
if (Platform.OS === 'ios') {
if (notification.alert.length !== 0) {
//handleNotification(notification)
notification.finish(PushNotificationIOS.FetchResult.NoData);
}
} else {
//handleNotification(notification)
}
},
// IOS ONLY (optional): default: all - Permissions to register.
permissions: {
alert: true,
badge: true,
sound: true,
},
// Should the initial notification be popped automatically
// default: true
popInitialNotification: true,
requestPermissions: true,
});
PushNotification.popInitialNotification((notification) => {
console.log(notification);
})