-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[🐛] Cannot receive notification with fcm token on the first launch after reinstall (iOS) #4656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I knew just from the title that when I expanded your versions section I would find old versions. |
I've updated both
However, the issue is behaving differently, not resolved. The notification works fine on the first app launch. After uninstall and re-installing the app, the given token is different from the first token. However, this token gives The response of HTTP API with
Every native configs, such as
|
So after the update the admin sdk works for the token you get? What I am trying to understand is: after the update, you do get a valid token that works in some contexts, and notifications are received from those contexts on first launch? If that's correct then I'm not sure how I explain same token working from one senders and not the other |
I've experimented with various conditions, and this is what I've found until now:
What I'm keep looking for is an optimal solution for handling local notification with |
The packages you are using are fine, should work. The problem you're having is token generation and registration not reception Can you provide the firebase-ios-sdk version, for the avoidance of doubt? And perhaps retest with 7.2.0 making sure that it is a clean build? Finally while we are working on this it may be possible (and maybe I'll implement this in my app!) you can have a firebase function call that attempts to send the current token a data only message, and logs success in firestore then return the status. If it's unregistered, call delete token, store the new one and maybe try again. If it fails again raise an alert or log analytics or something just as a means of detection and self healing In the meantime if you Google firebase ios quickstart and use the messaging Quick start to reproduce without react native layer that is part of the isolation we need to resolve |
It seems like I'm using |
I mean to re-open this actually - I do think you might be on to something, the initial token registration I marked this as a dupe for should have been resolved in 7.0.0. I think there may be a problem and while there may be some clever-ish workaround it means there would be a problem. In the end it will likely be in firebase-ios-sdk so if reproduced in 7.2.0 definitely try the pure firebase-ios-sdk quickstart to reproduce as a bug in that repo will be the place to go, but we will obviously be very interested here |
Hello 👋, to help manage issues we automatically close stale issues.
|
This needs either a clean reproduction here with a self-contained App.js file that shows the issue when dropped in the result of a project created fro https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh or a related issue in firebase-ios-sdk repo created from their auth quickstart - not sure how to advance it otherwise |
I might be experiencing the exact same issue here @mikehardy I will provide a demo tomorrow, here are the test logs.
|
Issue
When the app starts and a user logins, I get a new fcm token with
messaging().getToken()
and send the token to my server. I've properly registered both foreground and background notification handler thus it works fine on the first install.However, when I uninstall and re-install the app,
messaging().getToken()
gives a new token different from the previous one. If I try to send a notification to the device with this new token, the notification is sent find (with node/firebase-admin and HTTP v1 API). However, the device does not receive the notification. After quitting and re-launching the app,messaging().getToken()
method gives the same token but the notifications are received fine.This issue is shown only with iOS devices.
Project Files
Javascript
Click To Expand
package.json
:iOS
Click To Expand
ios/Podfile
:AppDelegate.m
:Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:android/app/build.gradle
:android/settings.gradle
:MainApplication.java
:AndroidManifest.xml
:Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:^7.8.4
Firebase
module(s) you're using that has the issue:messaging
TypeScript
?Y / ^4.0.3
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: