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.

[IOS] onNotification not working (triggered) when app on foreground

See original GitHub issue

Everything is doing fine on Android and IOS. Except when on IOS and receiving and then clicking the notification when app on foreground, the onNotification callback is not working. But when I received and clicking the notification while the app is killed or not running, the app is starting up and then the onNotification callback work perfectly.

I use PushNotification.localNotificationSchedule.

Any idea what is going on?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:19
  • Comments:8

github_iconTop GitHub Comments

5reactions
izzisolomoncommented, Feb 13, 2019

After spending 3 days on this, in my case turns out the APN notification generated by the backend was missing the property "content-available": 1 . once I added that to the “aps” object, onNotification started to fire! here is an example notification structure (from the apple docs):

{
"aps" : {
    "content-available" : 1
},
"acme1" : "bar",
"acme2" : 42

}

0reactions
github-actions[bot]commented, Mar 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

onNotification doesnt trigger on iOS devices for remote ...
I have configured app as described in docs. On android it works fine (local and remote), but not on iOS. So i have...
Read more >
firebase - Reactnative IOS pushotification/PushNotificationIOS ...
I used reactnative PushNotification/PushNotificationIOS modules , My issue is when notification received on foreground to my device IOS ,the ...
Read more >
Ionic3.9 onNotification not triggered when app is in foreground ...
Hi Team, I have implemented push notification its working properly android in both foreground / background state and but in IOS ...
Read more >
react-native-push-notification - npm
React Native Local and Remote Notifications for iOS and Android ... Read the troubleshooting guide before raising an issue.
Read more >
Sometime tapping on notification's… | Apple Developer Forums
Sometime tapping on notification's action button is not firing ... iap2d[177] <Warning>: process com.myapp.watchkitapp is now running the foreground Sep 29 ...
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