I have an app, with user authentication through an email and password - which all works well.
Through the use of the app the user will enter various dates, and on these dates I want to send a notification to that user (e.g. their birthday).
At the moment I store in to a Collection (let's say 'dateEntires') the users UID and the date they enter. I am trying to write a cloud function for a cron job to check the Collection every day and if a date matches today, then send the user (through their UID) a notification. The issue I have is with registration tokens.
I have read that I need to send the notification to the user based on their registration token. This I could probably set up - but my question is what happens if their registration token changes (i.e. they uninstall and reinstall the app)?
In order to achieve this should I?
Store the registration token within the Authentication, check this each time the user opens the app and update where necessary - and the Cloud Function can check the Collection and if a date does match today, then it will use the UID in the Collection to find the Registration Token in the Authentication table to send the message
Store the Registration Token and UID in to dateEntries and each time the user opens the app, check the Registration Token in all records in 'dateEntries' for this users UID and update where needed
Or is there a better approach to this?
It would be much easier to send the personalised notifications based on their (fixed) UID rather than their (variable) Registration Token - but I've been told this isn't possible (?)