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.

Handling notifications when app is closed

See original GitHub issue

On iOS handling notifications that launch the app is relatively straightforward to use

PushNotificationIOS.getInitialNotification().then((notification) => {
//bootstrapping logic
})

However, what would be the equivalent API to use in this library here? The idea is that one should be able to capture the data the notification is coming with before the app is launched ( whether it exists or not ) so that then the app can appropriately route, bootstrap etc.

From my understanding of the documentation doing this isnt clear to me yet, i would be grateful if you could point me to the right direction and i shall submit a PR on the documentation as this seems to be a very common use case.

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
Estebank94commented, Aug 12, 2019

I am also having this problem. onNotification is not being called when the app is closed.

0reactions
plafferty64830commented, Jun 3, 2022

I’ve been struggling with this concept for some time now and have just figured it out. I knew it was possible because whatsapp/facebook can be opened from a notification and we are directed to a specific page based on the notification content.

PushNotificationIOS.getInitialNotification() works as long as it’s called outside PushNotification.configure in your index.js.

To access the data passed in the notification simply use:

PushNotificationIOS.getInitialNotification().then((notification) => { const yourNotificationData = notificaton._data })

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push Notifications when app is closed - android - Stack Overflow
Yes, it is possible 'to receive notifications from google cloud message when the application is fully closed'. Infact, A broadcast receiver ...
Read more >
Push notifications when the App is closed - Apple Developer
I have problem, my app is fully closed or the user closed the app, it is really dead, push notifications do not arrive...
Read more >
How to handle Push Notifications when the app is closed?
This works great when the app is open in the background. Although if I close the app, and trigger a push notification, then...
Read more >
How to notify users when the application is closed in xamarin ...
I am developing an example app based on notifications , with concepts (websockets SignalR ). all working fine , but when applications are...
Read more >
Android push notification not working when the app is closed
So the situation is like, all are getting the notification as per their custom modification done in the app but some devices are...
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