I'm new with firebase and react-native so im sorry about the questions but I want to know
what is the different between onTokenRefresh to getToken in push notification with firebase?
why not use only with getToken?
why onTokenRefresh is always occurs in this code, I thought it will run this function only if the token actually changed...
componentDidMount() { kittensApp.onReady().then(app => { app.messaging().getToken() .then(fcmToken => { if (fcmToken) { console.log('fcmtokenApp', fcmToken) } else { console.log('here 2') } }) app.messaging().onTokenRefresh(token => { console.log('refreshtoken', token) }) })}- another question is in case I want to get the token and send it to the server to save it in the database for pushing notification in the future in what function I should use with (the get token or the refresh)? and how can I make sure that in case the token change (by updating the app or reinstall) it will send the new token to the server? or there is any way to keep the token new without make the user open the app?
Thank you for the help!