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
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:
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"
};
Adding this in my payload solved my issue:
apns: {
payload: {
aps: {
'mutable-content': 1,
'content-available': 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
}
}
}
}
}
© 2022 - 2024 — McMap. All rights reserved.