onNotification() is not fired when app is in background.
See original GitHub issueI am able to get logs on the console from onNotification() method when app is open (in foreground), but not getting any when app is closed (not killed).
Here is my code -
PushNotification.configure({
// (required) Called when a remote or local notification is opened or received
onNotification: function (notification) {
console.log(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,
/**
.....
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9
Top Results From Across the Web
onNotification is not calling when app is in background #1431
The main reason this is not triggered on Android is that you put .configure inside a component. Move it outside of a component...
Read more >onNotification() is not fired when app is killed - Stack Overflow
I am not positive but when I remember correctly killing (alias force closing) an app disables the onNotification functionality in Android ...
Read more >IONIC 5 FCM Plugin onNotification not fired when app is killed ...
IONIC 5 FCM Plugin onNotification not fired when app is ... onNotification() method isn´t fired (it works fine in background and foreground)
Read more >Events | Notifee
Please note, for iOS, the DELIVERED event is not fired for trigger notifications when the app is in the background. App open events....
Read more >Receive messages in an Android app - Firebase - Google
Notification messages delivered when your app is in the background. ... but many Firebase APIs do not support being called in direct boot...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
React Native Push Notifications clearly states that we need to call configure outside of the React Native Lifecycle. This is very important.
https://product.farewell.io/visible-react-native-push-notifications-that-work-on-both-ios-and-android-5e90badb4a0f
https://prnt.sc/k61hz7
@atebit why is this the way it is? I need to navigate and do react things in the onNotification() call back.