question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onNotification handler not being fired

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Reactions:13
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
VicEsquivelcommented, Feb 6, 2019

@ndc466 is this still an issue? Or did you find a way to solve this?

2reactions
mrtomhowardcommented, Oct 21, 2018

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found