MyTallest MyTallest - 1 year ago 269
iOS Question

Firebase messaging not working for "data" messages in iOS

I have an app running on iOS 9.3.5. I need to be able to send a push notification to my app when it's in the foreground or background. I don't actually need to include any data, I just need to ping the app so it will "phone home". So I don't need/want the user to see any notifications.

Since the company is already using Firebase for their Android app, I've set that up in the iOS app. If I send a message to
with the
key in the payload, it's received on the iPhone. When I try it with the
key instead, I get nothing. In both cases I get a
response from the POST. I've implemented the follow callbacks:

applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage

None of those are called when sending a message with the

This is the payload I'm using.

{ "data": {
"message": "phonehome",
"to" : "xxxxx"

After doing some more testing it looks like I get that message when the app is in the foreground but not the background. When I switch to the foreground then
gets called.

Edit 2: Added
and that did the trick. Thanks!

{ "to" : "xxxx", "content_available" : true }

Answer Source

It's a little bit hard to suggest without a sample payload, However, do try to use the priority parameter as high or content_available to true.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download