gen*_*ser 5 apple-push-notifications node.js ios firebase-cloud-messaging
我正在使用 FCM 检测卸载。如果我收到NotRegistered token发送通知,我认为该应用程序已被卸载。
在 Android 上一切正常,而在 IOS 上我总是收到success回复,即使应用程序已经卸载了好几天。
我已经读到可以使用 来检测卸载APNs feedback Service,其中 Apple 报告了任何不活动的令牌。
我还阅读了 Firebase 官方文档:
content_available - 在 iOS 上,使用此字段表示 APNs 负载中的内容可用。当发送通知或消息并将此设置为 true 时,会唤醒不活动的客户端应用程序,并且消息通过 APNs 作为静默通知而不是通过 FCM 连接服务器发送。
为了通过 APN 发送通知,我尝试使用 发送推送通知content_available: true,但我无法NotRegistered token在 IOS 上重现错误。它仍然返回一条success消息。
我正在使用sendMulticast. 我的有效载荷:
const payload = {
notification: {
title: text,
},
android: {
priority: "high",
ttl: 60 * 60 * 1,
collapseKey: "yo",
notification: {
channel_id: 'YO',
tag: userDoc.id,
},
},
apns: {
payload: {
aps: {
sound: "reminder.caf",
"content-available": 1,
}
},
headers: {
"apns-collapse-id": "yo",
"apns-priority": "10"
}
},
priority: 10
}
Run Code Online (Sandbox Code Playgroud)
我也无法NotRegistered token通过 HTTP 请求重现响应:
curl -X POST \
https://fcm.googleapis.com/fcm/send \
-H 'authorization: key=server_key_here' \
-H 'content-type: application/json' \
-d '{
"to": "fcm_token_here",
"priority": "high",
"content_available": true,
"notification": {
"empty": "body"
},
"data": {
"key1": ""
}
}'
Run Code Online (Sandbox Code Playgroud)
1. 如何使用 FCM 检测 IOS 卸载?
2. 如果不可能,我如何检测 IOS 上的卸载?
| 归档时间: |
|
| 查看次数: |
130 次 |
| 最近记录: |