Link ionic push device token with users in my db


#1

what is the best approach to link ionic push device token with my users id stored in my sql db?

For example if i schedule a push notification in 6 months for a specific token and my custom user id (saved in the database), if in the meantime the user do the logout (so, i have to unregister from notifications) and login to another device, how can i manage this? The token changes? then i have to update the old scheduled notification? What you suggest?
I hope I was clear


#2

I would save this “notification” in the database with a connection to the user. Then when the worker sending the notification is activated in 6 months time, just get the current push token(s) and send a push there.


#3

thank you , can i kindly ask to give me more details?i have no idea about how to manage it.
in the db i have to save the current device token, then?


#4

it is possible to attach my custom userId value when i do the push.register() ?


#5

You get the the token, then submit it to your backend which saves it to the database, connecting it to your user’s ID.

Maybe, but that isn’t what you want. You want to attach the push token to the user in YOUR database.