When does the token expire?

When we send a push after the application is deleted, the Apple 200 status code response continues to return for the token sent. Does this have a time? When does Apple notify that this token expires?

Answered by Engineer in 679234022

Push tokens never expire. APNs may start returning a 410 status for tokens if it has determined that a particular token is no longer in use. To make this determination, the device itself must report back to APNs that it is no longer accepting notifications for the app. This happens only if an app has been deleted on a device that is otherwise in use, and then a notification is sent to the app once, then the token will be marked as "not in use".

To avoid developers from detecting and tracking user behavior around installations and uninstallations, APNs will start returning a 410 status for these tokens on a fuzzy schedule. This schedule is not documented, and can change at any time. This is for protecting the users’ privacy, and is by design.

The 410 result was never meant to be the signal for developers to determine that the app has been removed, and to use that solely for that purpose is a mistake. It is simply 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, 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 status is an off-label use that would not guarantee the results you might expect.

Accepted Answer

Push tokens never expire. APNs may start returning a 410 status for tokens if it has determined that a particular token is no longer in use. To make this determination, the device itself must report back to APNs that it is no longer accepting notifications for the app. This happens only if an app has been deleted on a device that is otherwise in use, and then a notification is sent to the app once, then the token will be marked as "not in use".

To avoid developers from detecting and tracking user behavior around installations and uninstallations, APNs will start returning a 410 status for these tokens on a fuzzy schedule. This schedule is not documented, and can change at any time. This is for protecting the users’ privacy, and is by design.

The 410 result was never meant to be the signal for developers to determine that the app has been removed, and to use that solely for that purpose is a mistake. It is simply 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, 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 status is an off-label use that would not guarantee the results you might expect.

When does the token expire?
 
 
Q