Handling push notifications for multiple devices using the same account


I’m currently facing an issue regarding handling push notifications for the app I’m currently working on. Since the expo push token I receive on my back-end server gets different everytime the app is being updated or re-installed, I cannot find a way to track which tokens are obsolete. Because of that I’m facing two issues:

  • Whenever a user receives a push notification after updating the app, he receives two push notifications on his device for the same information (one for the token relative to the previous installation, and one for the current installation).
  • Push tokens stored in my server keeps accumulating, therefore at some point I will have a lot of them and it will slow the push sending process for sure. Especially since accounts from my app are often supposed to be used regularly by several different people, and therefore by multiple devices.

Since we cannot get a single identifier per device, I can not make sure each device used by an account corresponds to a single token. Is there a way to either check if a token is outdated so I could set up a CRON task on my server or execute some code when the app is being uninstalled ? The solution should work for both Android and iOS.

Any suggestion would be highly appreciated,


1 Like

Hi @lucaswhatson, thanks for the clear question!

If the user deletes your app and reinstalls, the old push token should be returning DeviceNotRegistered in the error field of the details object inside both push tickets and push receipts. This is a great way of knowing you can stop sending messages to the corresponding Expo push token.

However, afaik the push token shouldn’t change just from updates to the app, only from deleting/reinstalling, so I’d like to dig into that a little further. Is this on iOS, Android, or both? And by “after updating the app”, do you mean after an OTA update, or after a binary update (via the corresponding app store)?

Thanks a lot for your reply @charliecruzan

I must have been wrong assuming the token would change on every update.
The app I’m working on was not released yet, we only tested it with the standalone app built by expo-cli into Android APK and iOS testflight. Since the token changed everytime we uninstalled the previous version before installing the latest, we asumed that any update after releasing would have the same behaviour.

Concerning the error field I should be getting for each send on an outdated token, is it normal that the push notification is still received by the device linked to this token ?

No, if you receive an error then the notification shouldn’t have been delivered (read over the push notifications docs for more details)

I would check your receipts and see what those responses are

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.