Skip to content

[Bug]: Android app stays on "You are offline" after reopening (expo-network misses the background network unblock) #28624

Closed

Description

@kahlstrm

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/mobile

Steps to reproduce

On an Android 16 emulator, with the app built at da21606:

  1. Pair an environment, go to the home screen and background the app.
  2. adb shell cmd connectivity set-chain3-enabled true and adb shell cmd connectivity set-package-networking-enabled false com.t3tools.t3code
  3. Reopen the app. It shows "You are offline", which is correct.
  4. adb shell cmd connectivity set-package-networking-enabled true com.t3tools.t3code

An automated reproduction of both the bug and the fix: https://github.com/kahlstrm/config/tree/main/infra/experiments/t3-mobile

Expected behavior

The app reconnects once the network is available again.

Actual behavior

It stays on "You are offline" with no connection attempts. The environment page says "T3 Code reconnects on its own", but it doesn't. Toggling the environment off and on doesn't help.

Cause: Android blocks a backgrounded app's network and lifts the block shortly after it returns to the foreground. If the app reads its network state before the block lifts, expo-network reports offline. It never hears the lift, because it doesn't implement NetworkCallback.onBlockedStatusChanged (Expo issue: expo/expo#52725). The connection supervisor waits for an online report, so it never retries. Re-reading on resume (#4528, #5597) doesn't help either: a read while the block is still on also returns no network. #24932 doesn't cover this, since the home screen has no Retry action.

Fix: add onBlockedStatusChanged to the existing patches/expo-network@58.0.3.patch; a PR follows.

Impact

Minor bug or occasional failure

Version or commit

2.2.0 (Play Store); reproduced at main @ da21606

Environment

Pixel 9a, Android 16; Android 16 emulator (google_apis x86_64)

Logs or stack traces

No response

Workaround

Background the app and reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions