TL;DR
I'm detecting uninstalls using FCM. If I receive a NotRegistered token on sending notification, I assume that the app has been uninstalled.
Everything works fine with Android, while on IOS I'm always getting a success response, even if the app has uninstalled for days.
More info
I have read that it is possible to detect uninstalls using APNs feedback Service, where Apple reports any inactive tokens.
Also I read on Firebase official documentation that:
content_available - 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, and the message is sent through APNs as a silent notification and not through the FCM connection server.
In order to send notifications via APN, I have tried to send push notifications using content_available: true, but I cannot reproduce a NotRegistered token error on IOS. It still returns a success message.
I'm sending notifications using sendMulticast. my payload:
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
}
I also cannot reproduce a NotRegistered token response via an HTTP request:
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": ""
}
}'
Bottom Line
1. How do I detect IOS uninstalls using FCM?
2. And if it's not possible, how can I detect uninstalls on IOS?