I Am making an app which has push notification Property app is working when we hit notification on the foreground , but when app is on background my _backgroundHandler() method is not invoking, its happening only In IOS App Only
4 Answers
also struggle this issue.
set payload as below. mutable-content make sense.
apns: {
payload: {
aps: {
'mutable-content': 1,
'content-available': 1
}
}
}
https://github.com/firebase/flutterfire/issues/9381#issuecomment-1229167020
set "mutable-content:1" in payloads, iOS passes the notification to our notification service app extension.
For more information APNs payload, see the following links:

- 63
- 1
- 4
-
'content-available': 1 did the trick for me – jola Mar 27 '23 at 18:55
Enable background fetch, background processing and remote notification in Xcode
Edit
Add mutable key to payload
{ "to": "dWdhfjfjdbzbmjJ5....", "content_available": true, "mutable_content": true,
"data": { "message": "some msg", "mediaUrl": "image url here" },
"notification": { "body": "notification msg", "sound": "default" } }
EDIT
var payload = {
notification: {
title: `msg title here`,
body: `msg body here`
}`,
},
// Set Android priority to "high"
android: {
priority: "high",
},
// Add APNS (Apple) config
apns: {
payload: {
aps: {
contentAvailable: true,
},
},
headers: {
//"apns-push-type": "background", // This line prevents background notification
"apns-priority": "10",
},
},
token: "dnqTQVso60GfnnuOjHv8_e:APA91bElr-K3xkQMdYHX8VMrasdfasdfkjhasidfgjn"
};

- 15,510
- 2
- 12
- 30
-
Already did it, but same problem exists , I am sucking on it for 5 days I did not find any solution of that – Choudhary Robin Singh Jul 06 '22 at 11:20
-
-
-
-
-
in android, all state notifications are working , means foreground,background,and also kill state – Choudhary Robin Singh Jul 06 '22 at 12:40
-
sory to say but already added this in my payload but same result no message received in background handler – Choudhary Robin Singh Jul 06 '22 at 12:49
-
-
-
https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message – Kaushik Chandru Jul 06 '22 at 12:59
-
-
-
No an update available cannot be an issue. Should be some settings that's missing. Are you getting notification when the app is in foreground – Kaushik Chandru Jul 06 '22 at 13:07
-
-
And if i used content_available true it's showing 2 notifications first firebase server then it comes to my modified notification (means if I used content_available true notification is coming in the background but first notification shows silently then my original notification come with image – Choudhary Robin Singh Jul 06 '22 at 13:10
-
-
already tried to added the paylod and check same result coming 2 notification – Choudhary Robin Singh Jul 06 '22 at 13:13
-
first silently (Like when we send through direct firebase messaging server ) and second one is my modified notfication – Choudhary Robin Singh Jul 06 '22 at 13:14
-
Same problem with small body , notification also coming twice – Choudhary Robin Singh Jul 07 '22 at 04:38
-
Same issue here, all of a sudden it is not working. When I then opens the app the notifications arrives via local notifications package – kragekjaer Aug 07 '22 at 14:13
Adding this in my payload solved my issue:
apns: {
payload: {
aps: {
'mutable-content': 1,
'content-available': 1
}
}
}

- 11
- 1
I have face this issue too.
@goza's answer should been accepted.
This is my sending json.
{
"message":{
"token":"fcm token",
"notification":{
"title":"NotifyTitle",
"body":"NotifyBody"
},
"data":{
"title":"DataTitle",
"body":"DataBody"
},
"apns":{
"payload":{
"aps":{
"content-available":1
}
}
}
}
}

- 53
- 1
- 12