Skip to content

[expo-network][android] State stays offline after Android lifts a network block (no onBlockedStatusChanged) #52725

Open

Description

@kahlstrm

Minimal reproducible example

https://github.com/kahlstrm/config/tree/main/infra/experiments/t3-mobile/expo-repro

Steps to reproduce

While Android blocks an app's network (for example a backgrounded app on Android 15+, blocked=APP_BACKGROUND in dumpsys netpolicy), getActiveNetwork() returns null and expo-network reports isConnected: false. Android reports the block lifting only through NetworkCallback.onBlockedStatusChanged, which NetworkModule.kt doesn't override. So no event is sent, and useNetworkState stays offline until some other network change. The block itself isn't reported either. Related to #47846 / #48478 (same symptom from a stale onLost after a freeze); that fix doesn't cover this case, because onBlockedStatusChanged is the only callback when the block lifts.

Android 16 emulator (google_apis x86_64), release build (npx expo prebuild + ./gradlew assembleRelease), npm:

  1. adb shell cmd connectivity set-chain3-enabled true and adb shell cmd connectivity set-package-networking-enabled false com.example.expnetrepro
  2. Start the app. It shows isConnected=false, which is correct.
  3. adb shell cmd connectivity set-package-networking-enabled true com.example.expnetrepro
  4. Wait 30 seconds, then press getNetworkStateAsync.

Expected: a network state event with isConnected=true shortly after the block lifts.
Actual: no event. useNetworkState stays isConnected=false, while getNetworkStateAsync returns isConnected=true type=WIFI.

Fix:

override fun onBlockedStatusChanged(network: android.net.Network, blocked: Boolean) {
  asyncEmitNetworkState(DELAY_MS)
}

With it, and expo-network built from source, the app reported isConnected=true within 3 s of the unblock in 2 of 2 runs; without it, it stayed offline in 2 of 2.

Environment

expo-env-info 2.2.1 environment info:
  System:
    OS: Linux 6.18 NixOS 26.11
  Binaries:
    Node: 26.12.0
    npm: 11.20.0
  SDKs:
    Android SDK:
      Android NDK: 27.1.12297006
  npmPackages:
    expo: ~58.0.22 => 58.0.22
    react: 19.3.0 => 19.3.0
    react-native: 0.88.1 => 0.88.1
  Expo Workflow: managed

expo-network 58.0.4.

Expo Doctor Diagnostics

Running 20 checks on your project...
20/20 checks passed. No issues detected!

Activity

  1. expo-bot commented on Nov 1, 2026

    @expo-bot
    Collaborator

    Bug · 80% confidence

    This assessment assumes the reported bug is real; the behavior has not been verified.

    • Severity: S2 - Medium: Breakage in a narrower configuration, or common breakage with a reasonable workaround.
    • Impact: useNetworkState reportedly stays isConnected=false after Android lifts a per-app network block, until some other network change occurs.
    • Scope: Reporter reproduced on an Android 16 emulator release build using an adb-forced block; the Android 15+ APP_BACKGROUND case is described but was not the tested path.
    • Platforms: Android
    • Labels: sdk-58, Android, 📦 expo-network, severity: medium
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

    Androidcontributor: externalPR author is not a member of the expo GitHub orgneeds reviewIssue is ready to be reviewed by a maintainersdk-58severity: mediumS2 - Medium: narrower breakage, or common breakage with a reasonable workaround.📦 expo-network

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions