0
votes

as title says, how to catch the event of tapping on local notifications when the app is in foreground? E.g. like whatsapp does, when it receives a new message and the app redirects you to the conversation by tapping on notification while you’re using the app. All around I’ve read about checking the app state in didReceive local notifications, but it doesn’t works for me, because it goes in there every time I get the notification, while I want a specific action only when it’s tapped. Thank you.

2

2 Answers

0
votes

Can you tell me, are you actually seeing local notifications while your app is in the foreground?

Apple's documentation says this:

"With local notifications, your app configures the notification details locally and passes those details to the system, which then handles the delivery of the notification when your app is not in the foreground."

I think the WhatsApp notification you are seeing (while using that app in the foreground) is a custom-built feature of the app, not an iOS local notification. You may want to look at building your own in-app notification system.

0
votes

The didReceiveNotificationResponse gives a callback at all times you click on the notification. It doesn't matter if its in foreground or background. It only matters that you interact with the notification. For more see here