Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 871
malhobayyeb Avatar asked May 08 '18 19:05

malhobayyeb


People also ask

Do push notifications work when app is closed iOS?

Apple does not offer a way to handle a notification that arrives when your app is closed (i.e. when the user has fully quit the application or the OS had decided to kill it while it is in the background). If this happens, the only way to handle the notification is to wait until it is opened by the user.

Will iOS awake my app when I receive silent push notification?

Yes. It will. When you click on that. Yeah its ok but being push notification is silent,you are not able to view any alert and cant click.

Does Firebase notification work on iOS?

For Apple client apps, you can receive notification and data payloads up to 4000 bytes over the Firebase Cloud Messaging APNs interface.

Can FCM send notification to iOS?

Once your client app is installed on a device, it can receive messages through the FCM APNs interface. You can immediately start sending notifications to user segments with the Notifications composer, or messages built on your application server.


1 Answers

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.

like image 175
mfaani Avatar answered Sep 19 '22 16:09

mfaani