Closed roeib closed 6 years ago
@evollu
do you have same issue in debug mode?
@evollu on the emulator i dont have this problem
@evollu in release build getting same issues after install the apk the app dont get token it giving null and then after relaunch the app getting token is there any other thing to do or am i doing wrong any thing, because in debug build its working perfectly fine. Please help
it takes a while to get firebase token. i wonder if it could be a firebase bug
Okk but now what should I do to handle this condition , can you please help me out
listen on FCM.on('FCMTokenRefreshed', token => {
and call FCM.getFcmToken
on app start. The token should be there eventually.
You can save the token in storage for future compare to see if it actually changed
Ok i will try it and let you know if its works or not, Thank you for help
@evollu Thank you very much, its working fine in release build.
@Seemapadiya I am facing the same issue. Could you please share code snippet?
@Udbhav12 previously i was used this method on my app start and its working fine in debug FCM.getFCMToken().then(token => { console.log("FCM >>>token>>" + token) }); For the release build issues i have to implement this method on app start and saved token in storage FCM.on('FCMTokenRefreshed', token => { console.log('FCMTokenRefreshed',token); }); if we didn't find token in FCM.on method but i have always get token in this method FCM.on('FCMTokenRefreshed', token => {})
@Seemapadiya Did you save parameter token
in FCM.on('FCMTokenRefreshed', token => {})
and FCM.getFCMToken()
to store?
Example:
FCM.on('FCMTokenRefreshed', token => {
AsyncStorage.setItem('NOTIFICATION_TOKEN', token);
});
FCM.getFCMToken().then(token => {
AsyncStorage.setItem('NOTIFICATION_TOKEN', token);
});
Yes direct store in to my model class
@evollu please help me i am not getting FCM token in release apk below is my code
FCM.on('FCMTokenRefreshed', token => {});
componentDidMount() { FCM.getFCMToken().then(token => { console.log("TOKEN (getFCMToken)", token); this.props.savePushNotificationToken(token) }); }
after install the apk the app dont get fcm token only after close the app and open again everything is fine.
FCM.getFCMToken().then(token => { console.log("TOKEN (getFCMToken)", token); //send to the server });
please help :)