How to listen a notification when app is terminated or in background?

Hello folks,
this is my first question here!

I'm developing an app that correctly listen apns notifications, but i couldn't be able to listen for a notification when app is in background or closed and execute a custom code instead notifying the notification UI.

I try to use silent notification, but i couldn't find where tell to the os that when a particular notification is received, it have to execute a custom code instead showing the default notification UI.

I also tryied to use voip notification, but without success, i 'm not able to execute custom code when app is in foreground or terminated.


The final effect could be something like a video call incoming (i.e. skype or whatsapp) and the notification could be the trigger to start the app and play the call ring.

This is a pretty common topic and you should first invest more time reading the main developer documentation on Notifications. Then also look at how apps are allowed to execute background code.

If your use case is really about incoming calls, you should also look more specifically to the Pushkit framework.
How to listen a notification when app is terminated or in background?
 
 
Q