We just migrated from GCM to FCM. For tracking uninstalls we send a silent notification to all our users and if we get a "NotRegistered" response we treat the user as uninstalled. Since the last few days, we started getting "NotRegistered" for some of the users who have not uninstalled the app.
On querying the FCM diagnostics for the same Registration token the messages are being delivered but they are continuously in accepted state.Attached is the screenshot. The error code I received while sending the message is still "NotRegistered" . The user has not uninstalled the app.Attached is the screenshot.
We are getting "Not Registered" since 1st of June while messages are in accepted state till 4th of June. This image shows message Ids of notifications sent till 4th of June:
Would like a clarification on the following:
Why did the status of the FCM registration token change to NotRegistered. There was no upgrade since the last month and the user has been using the latest version since a long time?
Is checking FCM error code "NotRegistered" a full proof way to track uninstalls? Are there better mechanisms available?
If specified and a notification with the same tag is already being shown, the new notification replaces the existing one in the notification drawer.
The FCM backend receives the message request, generates a message ID and other metadata, and sends it to the platform specific transport layer. When the device is online, the message is sent via the platform-specific transport layer to the device. On the device, the client app receives the message or notification.
APNs needs to be used for push messaging when an application is in the background. Hence, FCM uses APNs to deliver messages when the message contains user visible payload, e.g., body, sound etc. FCM also delivers via APNs when content available is set.
Reasons as to why a NotRegistered
happens are stated in the docs, the third one, being a probable reason for your case (emphasis mine):
An existing registration token may cease to be valid in a number of scenarios, including:
- If the client app unregisters with FCM.
- If the client app is automatically unregistered, which can happen if the user uninstalls the application. For example, on iOS, if the APNS Feedback Service reported the APNS token as invalid.
- If the registration token expires (for example, Google might decide to refresh registration tokens, or the APNS token has expired for iOS devices).
- If the client app is updated but the new version is not configured to receive messages.
For all these cases, remove this registration token from the app server and stop using it to send messages.
Nope. As I linked above, the NotRegistered
error doesn't only trigger during uninstalls. AFAIK, there is no standard way of doing this. Have a look at some of these posts.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With