Learn Courses My Dashboard

How to run some code when notification appears on screen and app is in background

Hi all,
Im using local notifications, I want the notification to appear and even if user is not interacting I want to run some code in the app, I have been advised to use delegate of the notification center for this,but I cant find the exact method that is called when the notification appears, can you please tell me which method do this?