Push Notifications API generating and posting the token everytime?

Hi, I’m learning Push Notifications and am having some confuse.

According to the snippet in the docs, it looks like the token generation and saving that token to the server is fired everytime the user opens the app.

(https://docs.expo.io/versions/latest/guides/push-notifications.html)

Is this the right way to go? Or should I save the push token to a local storage like asyncStorage and check whether the token exists already and if so, return from the whole process?

1 Like

You want to do it every time the user opens the app. A fun science experiment to see why: console.log the token, notice that it won’t be the same each time. You can learn more about why here: objective c - Does the APNS device token ever change, once created? - Stack Overflow

2 Likes

I understand now. Thank you so much!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.