-
Notifications
You must be signed in to change notification settings - Fork 4k
🐛 [firebase_core] Firebase taking too long to reconnect after returning from background #6355
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
After some more adequate testing on iPhone 7, it seems the issue does not occur on iOS. |
Updated dependencies to the latest versions (that are supposed to remove the backoff problem):
however, the problem still persists. @tw-tjd @frankyvij - any comments would be greatly appreciated. I may be missing something. |
Can you update your firebase_core to 1.3.0. and try again. Your pubspec should have pulled the correct version but we specified it. |
Please excuse me, it seems the file didn't save upon exiting Android Studio. I have run |
Personally, for me, the issue has not appeared again. There have been a couple of times when my app couldn't connect to the internet immediately (after opening the app from the background), but it definitely did establish the connection in less than 10 seconds. May I ask if you execute firestore query immediately after coming to the foreground or do you have to press a button to execute a query? I execute the query as soon as the app comes to the foreground with a delay of 500ms, and honestly, I haven't experienced this issue with the latest Firebase Android SDK 28.1.0. |
I was not able to reproduce this issue as well with environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: ^1.3.0
cloud_firestore: ^2.2.2 Seeing as no others have run into this issue either I'm going to close this issue for now as it needs a generally reproducible case on the latest versions. Please make sure you aren't overriding the Firebase SDK version in your app-level |
@frankyvij - No, I have a button that leads to a page which retrieves data through a FutureBuilder. Which means at least 1500ms before the first execution. @markusaksli-nc - At the moment I'm using |
I waited form more than 10 minutes as with the previous iteration of this issue. I was on nullsafety but I don't really see how that could cause the issue for you (however you are on an outdated flutter version, latest stable is |
Bug report
Description
If an application is in the background for alonger period of time, Firebase will take too long (up to 90 seconds) to establish a connection when returned to the foreground. It seems this happens because of Android's "Doze" mode. This bug is mentioned in many places, including here, but the fix suggested (FirebaseSDKVersion=28.1.0 update) does not solve the issue for me - so maybe this is a different bug.
Steps to reproduce
Expected behavior
Expected behavior: Connection is established under 10 seconds
Actual behavior: Connection is established under 90 seconds
Sample project
I'm working on it. In the meantime here is a sample project someone else created for the (assumingly) same issue.
Additional context
The issue occurs on both mobile data and Wi-Fi, and in both debug and release mode.
I've also tried connecting in my office through a different ISP, and nothing changed.
Devices: 2x Samsung Galaxy A41, Samsung Galaxy A6, iPhone 7 (so far the issue was not detected on iOS, but no proper testing has been done).
Flutter doctor
Click To Expand
Flutter dependencies
Click To Expand
Exception
Click To Expand
The text was updated successfully, but these errors were encountered: