Ad

Firebase Silent Notification Does Not Start Up A Closed IOS App

Can FCM silent notification start up a closed iOS app?

Request Type: POST

Request URL: https://fcm.googleapis.com/fcm/send

Request Headers:

Authorization -> key=MY_KEY

Content-Type -> application/json

Request Body:

{
  "to": "/topics/my_topic",
  "content_available": true,
  "data": {
    "contentAvailable": 1
  },
  "priority": 10
}

However, this payload does not start up my iOS app if the user closes it.

How to make the iOS to start my app whenever a silent notification is received?

Ad

Answer

It's the expected behavior to not launch the app. I mean why should it? The user for some reason has decided to kill the app. They don't want battery or bandwidth getting used for it anymore!

From documentation.

Use this method to process incoming remote notifications for your app. Unlike the application(_:didReceiveRemoteNotification:) method, which is called only when your app is running in the foreground, the system calls this method when your app is running in the foreground or background. In addition, if you enabled the remote notifications background mode, the system launches your app (or wakes it from the suspended state) and puts it in the background state when a remote notification arrives. However, the system does not automatically launch your app if the user has force-quit it. In that situation, the user must relaunch your app or restart the device before the system attempts to launch your app automatically again


For non-silent notifications. They would get delivered to the device. But not to the app.

If you force-quite your Whatsapp on your iPhone and your mother sends you a message, then your iPhone would show it among its notifications. However it won't trigger any of your AppDelegate methods. AppDelegate methods are only triggered if the app is not user terminated.

Ad
source: stackoverflow.com
Ad