Please provide the following:
- SDK Version: 49
- Platforms(Android/iOS/web/all): Android/iOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
Hello, I’m using ExpoPushTokens (hereafter referred to as tokens) to send push notifications. Currently, I obtain the ExpoPushToken when notifications are enabled, store it in the database upon login, and remove the token from the database when users log out.
However, I’m curious about how to manage ExpoPushTokens that are stored in the database but are no longer needed. The Expo documentation mentions that when a device’s notification settings are turned off or the app is uninstalled, the Expo server returns a “DeviceNotRegistered” error in the Push receipt. However, because these errors are handled by FCM/APN, it can be challenging to promptly confirm this on the Expo server. Furthermore, even if you can confirm, both turning off notification settings on the device and deleting the app return the “DeviceNotRegistered” error. Therefore, if I delete tokens that trigger this error, there might be an issue where, after reactivating the device’s notification settings, the token information is missing, and I can’t send push notifications.
Especially on Android, when the app is reinstalled, a new token is issued, and it seems I need to delete unnecessary tokens already stored in the database.
I believe that I should only delete tokens when the app is deleted, not when notification settings are disabled. In this scenario, how can I effectively manage tokens? Thank you!
- Push notifications troubleshooting and FAQ - Expo Documentation
- Send notifications with Expo's Push API - Expo Documentation