evollu / react-native-fcm

react native module for firebase cloud messaging and local notification
MIT License
1.73k stars 681 forks source link

Upgrading app version number results in a refreshed FCM token that does not work #1100

Open fredrikp opened 5 years ago

fredrikp commented 5 years ago

To begin with, my app is working fine and notifications are received in foreground, background and killed states.

Changing the code and restaring, including upgrading the build number causes no change in behaviour. Let's say that the FCM token the app receives is Token A. The token value remains constant while I make changes to the app.

Upgrading the version number of the app, e.g. from 2.4.1 to 2.4.2 causes a big problem in the app: When the app asks for the FCM token, the app now receives Token B. There is a change in the token. Normally, I would say that this is OK, just inform the backend of the new token. But the new token does not work.

Sending push notifications to the app using Token B has no effect in the app. Sending push notifications to the app using Token A works fine like before.

React Native version: 0.57.8 react-native-fcm version: 16.1.0 iPhone 7 Plus running iOS 12.1.4.

MaxiSantos commented 5 years ago

I've been this issue happening when I install the app in my android device with ENVFILE=.env react-native run-android --variant=debug for debugging purposes. The only way I can get the PN to work is by installing the app with export ENVFILE=.env && ./gradlew assembleReleaseStaging within the android folder.

prashen commented 5 years ago

Token issue found in our project also in iOS. The token is changed after changed our APP version. And push notification is not working.

"react-native-fcm": "^14.1.3",
"react-native": "0.57.8",

Is there any solution? It's very urgent because our APP not working in the production version. @evollu

JPig commented 5 years ago

This sounds like it could be related to https://github.com/firebase/firebase-ios-sdk/issues/2365 and https://github.com/firebase/firebase-ios-sdk/issues/2438

JPig commented 5 years ago

In your Podfile try with these versions pod 'Firebase/Core', '~> 5.15.0' pod 'Firebase/Messaging', '~> 5.15.0'

fredrikp commented 5 years ago

Not using cocoapods, but I tried with Firebase SDKs 5.16.0 with no change. Now I've switched over to react-native-firebase.