-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix for reconnecting when Android app comes to the foreground #8855
Conversation
|
This might fix a long-standing issue downstream: firebase/flutterfire#6749 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't entirely match our style, but the automated checker is happy so that can be fixed after it is merged.
Thank you! Great find! |
@ejona86 Any way this can find its way into a release before March 8th? |
@larssn, there'd be no problem backporting it to 1.44. We should do that. But it is unclear when it'd be released. I'm not sure it is worth doing a release just for this improvement. While it looks like it would be quite beneficial, this has apparently been an issue for 2.5 years, which makes it a hard case for urgency. Due to some other events we're more limited on time than ordinarily. Looking around, I see some other fixes that might deserve a backport that haven't been backported. There may be enough to make it worthwhile. @larssn, I assume this is a "Gee, 1.45 is a month away. Sure would be nice to get it sooner." You have no hard deadline, but simply "sooner is better than later"? I could easily make a 1.44.1-SNAPSHOT release, but that probably doesn't excite you. |
@ejona86 Appreciate the reply. We're in a situation currently where our product doesn't handle coming out of standby correctly on Android, which is unfortunate because we're dealing with money. This is all the way upstream in Flutter territory. I'm not even sure this fixes it, but I'm pretty confident it does. But the main reason I'm asking is because it will also take time for the fix to propagate all the way upstream. So yeah, you're spot on about the "sooner is better than later"-part 🙂 Edit: |
v1.44.1 is available on Maven Central. It isn't indexed by search.maven.org yet, but it is there. |
Thank you, will upgrade from our side! |
When an app goes to the background, onBlockedStatusChanged is called with true and then called with false when it comes back to the foreground. The function onAvailable isn't called in this case and the connection wasn't being reset. Closes #8850
I noticed the comment that this is used for API versions 24+ but onBlockedStatusChanged was added in 29. I'm not sure if some kind of guard needs to be added or not.
https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback#onBlockedStatusChanged(android.net.Network,%20boolean)