OneSignal is a free service that has an api to send notifications to different devices (Android, iOS).
When the user registers to our app, the OneSignal player_id (a device token id) is stored as a deviceToken in our own backend.
From our backend we store the deviceTokens (playerIds) for the user and send a request to OneSignal to store the userId as a tag to the OneSignal service.
Since one user can have multiple player_id's (devices), and one device can have multiple users, we use this as a filter when sending out notifications.
However when the user re-installs the app, the player_id can possibly change:
OneSignal Documentation: Player ID
(When does the OneSignal User / Player ID change?)
On Android, there isn't a method available that can be called to remove the deviceToken from OneSignal before uninstall:
Perform a task on uninstall in android
This basically means that our backend has no way to destroy unused devicetokens (when a device gets a new player_id after reinstall).
Also, we cannot send a request to OneSignal to remove expired player_ids.
I don't like this since our backend will continue trying to send notifications to devicetokens that are no longer valid.
This adds overhead and will pollute the system.