With Firebase I send this JSON:
{
"data": {
},
"priority": "high",
"to": "xxxxx",
"content-available": "true",
"notification": {
"body": "HI!",
"title": "FCM Message",
"badge": 1,
"sound": "Default"
}
}
But didReceiveRemoteNotification:fetchCompletionHandler is not called when app is in background.
I enable background Modes - Remote notifications from capabilities.
Any suggestions?
Your key/value for content-available is incorrect. The key is content_available (underscore, not dash) and the value is a boolean, not string:
{
"data": {
},
"priority": "high",
"to": "xxxxx",
"content_available": true, // <= CHANGED
"notification": {
"body": "HI!",
"title": "FCM Message",
"badge": 1,
"sound": "Default"
}
}
See Table 1 of the HTTP Server Protocol document:
On iOS, use this field to represent content-available in the APNs payload. When a notification or message is sent and this is set to true, an inactive client app is awoken. On Android, data messages wake the app by default. On Chrome, currently not supported.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With