Skip to content

CONVOSDK-4493: Fix slow reconnection after network switch or app foregrounding#17

Open
blackneck wants to merge 16 commits into
mainfrom
acharnashei/CONVO-1145
Open

CONVOSDK-4493: Fix slow reconnection after network switch or app foregrounding#17
blackneck wants to merge 16 commits into
mainfrom
acharnashei/CONVO-1145

Conversation

@blackneck

Copy link
Copy Markdown
Contributor

Fix slow reconnection after network switch or app foregrounding

Summary

Fixes issue where the SDK takes 28-30 seconds to reconnect after network changes (WiFi ↔ cellular) or when returning from background.

Problem

When the device's network changed, the SDK continued using exponential backoff from previous failed attempts, causing unnecessary 28-30 second delays.

Root Cause

  1. No detection of default network changes - only tracked availability, not active network switches
  2. Backoff not reset on network/foreground events in WaitAndReconnect state
  3. No immediate reconnect trigger - waited for scheduled timeout

Solution

1. Default Network Change Detection (Android)

  • Implemented registerDefaultNetworkCallback() to detect active network switches
  • Added onDefaultNetworkChanged callback to ConnectivityMonitor

2. Reset Backoff on Network/App Events

In WaitAndReconnect state:

  • OnDefaultNetworkChanged / OnAppForegrounded / OnConnect: Reset failedReconnectionAttempts = 0 and immediately transition to Connecting

3. Force Reconnect on Network Switch While Connected

  • When default network changes while connected, force reconnect to use new network path

@blackneck blackneck requested a review from a team as a code owner March 24, 2026 14:56
@@ -1,3 +1,3 @@
ext {
sharedInternalVersion = "3.0.0"
sharedInternalVersion = "2.1.1"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was not released yet

@@ -1,3 +1,3 @@
ext {
sharedPublicVersion = "1.2.2"
sharedPublicVersion = "1.2.1"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as sharedInternal - bumped but not actually released

@blackneck blackneck changed the title Acharnashei/convo 1145 CONVOSDK-4493: Fix slow reconnection after network switch or app foregrounding Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant