How to handle data type fcm notifications when app is not running or closed state in iOS similar to android?

Viewed 787

In android, We can receive data type of notifications when app is not running or closed state. And can parse and display notification with code and can do anything like updating old message, etc..

public class FCMListenerService extends FirebaseMessagingService {
    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        Log.d("onMessageReceived for FCM", remoteMessage.getData().toString());
    }
}

How can I do similar thing in ios?

I'm able to get data type of notifications when app is in background or foreground. So I'm able to do what ever I want. But I'm unable to debug how to handle data type notifications when app is not running? Can someone help me?

Below is the payload I'm trying to send.

{
  "to": "..............",
  "data": {
    "body": "data",
    "title": "Portugal vs. Denmark",
    "icon": "myicon"
  },
  "content_available": true
}
1 Answers
Related