Reputation: 690
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)
})
})}
Thank you for the help!
Upvotes: 3
Views: 6033
Reputation: 1277
console.log
from your else statementHope it will help.
Upvotes: 1