Cho*_*ngh 10 dart flutter flutter-dependencies flutter-ios
我正在制作一个具有推送通知的应用程序,当我们在前台点击通知时,属性应用程序正在工作,但是当应用程序位于后台时,我的 _backgroundHandler() 方法不会调用,它仅在 IOS 应用程序中发生
小智 8
也在这个问题上挣扎。
设置有效负载如下。可变内容是有道理的。
apns: {
payload: {
aps: {
'mutable-content': 1,
'content-available': 1
}
}
}
Run Code Online (Sandbox Code Playgroud)
https://github.com/firebase/flutterfire/issues/9381#issuecomment-1229167020
在有效负载中设置“mutable-content:1”,iOS 将通知传递给我们的通知服务应用程序扩展。
有关 APN 负载的更多信息,请参阅以下链接:
编辑
将可变密钥添加到有效负载中
{“至”:“dWdhfjfjdbzbmjJ5....”,“content_available”:true,“mutable_content”:true,
"data": { "message": "some msg", "mediaUrl": "图片网址在这里" },
"notification": { "body": "notification msg", "sound": "default" } }
编辑
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"
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4913 次 |
| 最近记录: |