onNotification handler not being fired
See original GitHub issueI have remote push notifications setup correctly using a 3rd party service + APNS and my iOS device is both calling the onRegister
callback correctly and receiving subsequent notification alerts but the onNotification
handler is not being called at all. This is a problem because it prevents me from PushNotification.setApplicationIconBadgeNumber()
in an appropriate manner. I’m pretty sure that the handler is not being called at all because, in Xcode, I am not even receiving the provided log output of onNotification
in the example PushNotification.configure
code (console.log( 'NOTIFICATION:', notification );
). I am, however, receiving the log output of onRegister
(console.log( 'TOKEN VALUE: ' + token );
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:9 (1 by maintainers)
Top Results From Across the Web
onNotification() is not fired when app is killed - Stack Overflow
i'm using https://github.com/zo0r/react-native-push-notification to get push notifications and the onNotification is working as aspected when ...
Read more >ServiceWorkerGlobalScope: notificationclick event - Web APIs
The notificationclick event is fired to indicate that a system notification spawned by ServiceWorkerRegistration.showNotification() has been ...
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 >SDK Notification Event Handlers - OneSignal Documentation
iOS - Force-quit state is when the app has been "swiped away" and not running in the foreground or background. Apple still keeps...
Read more >react-native-push-notification Code Examples - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues ... await saveToken(tokenRegistration); }, onNotification: globalHandler....
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 FreeTop 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
Top GitHub Comments
@ndc466 is this still an issue? Or did you find a way to solve this?
@HoogsterInc I spent several hours dealing with this issue on Android the other day, and the thing that got it working was to ensure the message payload object had only a data key and nothing else.
All the time I was having troubles, my message payload object had other keys (eg “notification”) in addition to data. When that was the case, the message looked different in the Android notifications drawer (large icon was missing), and it didn’t trigger onNotification when I tapped it.
When I removed all keys other than data, the message looked the same in the notifications drawer as it did when the app was in the foreground, and it triggered onNotification when I tapped it.
I also had to take care to ensure Firebase was installed correctly, but simply following the instructions in the readme was enough to get that right.