Is there a way to distinguish a background push notification in ios?

In my app for Android when a message is received if the user is not already in the app then when you click the notification the app opens in the messages page but if the user is already using the app I don’t redirect him.

I am now trying to implement this in ios but I cant seem to find out how to distinguish the background notification.