Push Notifications API generating and posting the token everytime?

#1

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
#2

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: https://stackoverflow.com/a/7999690/4047926

2 Likes
#3

I understand now. Thank you so much!

1 Like
closed #4

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