I am currently working with push notifications in my new project right now, and I am therefore experimenting with the generation of push tokens. My question is, when do these expire? I store each users push token in my Firebase database, but I know for a fact that these tokens expire/re-generates themselves. So my question is, what is the best way to hold the push token up to date?
Would I simply do this every time the user navigates to their profile?:
let token = FIRInstanceID.instanceID().token()
ref.child("Users").child(id).child(pushToken).updateChildValues(["tokenid":token])
You see, as of right now I am asking the user to allow push notifications right after signup, but somehow it seems that it still generates a token id even though I deny the request. So my question is, how can I keep this token id updated? Would I have to do this in AppDelegate?
Thanks. Help is much appreciated!