APNs Returning 200 OK for Uninstalled Apps Instead of 410 Error

We're experiencing an issue with Apple Push Notification service where APNs continues to return 200 OK responses for device tokens belonging to uninstalled applications.

Issue Details:

Expected Behavior:

  • APNs should return 410 status code when device token is no longer valid (app uninstalled)

Thanks in advanced for support

Answered by Engineer in 849666022

The 410 status was never meant to be a signal for developers to determine that the app has been removed. It is actually a signal to the push provider server that they should stop using that token.

Although this could mean that the app may have been removed, it could also mean the token has changed while the app is still installed.

The app token may change due to certain system events. Deleting and reinstalling the app, restoring the device from a backup, resetting the device (and then installing the app), certain major iOS updates, transferring all apps and data to a new device are all events that will cause the token to change. Because of this, it is recommended that apps register for remote notifications at every launch. If the token has changed, the app would need to update the push server to use the new token for the device/user. If an existing token is receiving 410, it might be that the app is still installed but one of these cases occurred.

Indeed if you look at the description of the 410 status, it says "The device token is no longer active for the topic.". Topic, in most cases means "your app". It is an indicator of the state of the token, not the app. And trying to determine whether an app has been deleted or not based on the 410 result is an off-label use that would not guarantee the results you might expect. Additionally, beginning the return of the 410 state is non-deterministic for the sole purpose of discouraging this interpretation.

To summarize this interpretation: Existence of a 410 status merely indicates that the token is no longer valid and should not be used anymore. It does not mean the app has been deleted. Nor, the lack of a 410 status mean the app is still installed and receiving notifications.

If you receive a 410 status for a token, you should stop using it. If you believe that the app has been removed but still receiving 200 status for the token, there is no harm in sending notifications to it until if and when you receive a 410.

The 410 status was never meant to be a signal for developers to determine that the app has been removed. It is actually a signal to the push provider server that they should stop using that token.

Although this could mean that the app may have been removed, it could also mean the token has changed while the app is still installed.

The app token may change due to certain system events. Deleting and reinstalling the app, restoring the device from a backup, resetting the device (and then installing the app), certain major iOS updates, transferring all apps and data to a new device are all events that will cause the token to change. Because of this, it is recommended that apps register for remote notifications at every launch. If the token has changed, the app would need to update the push server to use the new token for the device/user. If an existing token is receiving 410, it might be that the app is still installed but one of these cases occurred.

Indeed if you look at the description of the 410 status, it says "The device token is no longer active for the topic.". Topic, in most cases means "your app". It is an indicator of the state of the token, not the app. And trying to determine whether an app has been deleted or not based on the 410 result is an off-label use that would not guarantee the results you might expect. Additionally, beginning the return of the 410 state is non-deterministic for the sole purpose of discouraging this interpretation.

To summarize this interpretation: Existence of a 410 status merely indicates that the token is no longer valid and should not be used anymore. It does not mean the app has been deleted. Nor, the lack of a 410 status mean the app is still installed and receiving notifications.

If you receive a 410 status for a token, you should stop using it. If you believe that the app has been removed but still receiving 200 status for the token, there is no harm in sending notifications to it until if and when you receive a 410.

APNs Returning 200 OK for Uninstalled Apps Instead of 410 Error
 
 
Q