Skip to content

AppState often fails to fire 'background' until the app is foregrounded #50415

@Nantris

Description

@Nantris

Description

AppState fails to fire 'background' until the app is foregrounded

Steps to reproduce

Seems inherent to usage on Android 14, where sometimes it gets called properly before backgrounding is completed but usually it does not.

It seems less likely to occur on the first instance of backgrounding the app.

I'm not sure an Expo Snack can be expected to reliably repro this, but it seems to demonstrate similar behavior. I'm not certain it's not a limitation of Snacks themselves though.

React Native Version

0.76.7

Affected Platforms

Runtime - Android

Output of npx @react-native-community/cli info

Using Expo, but...


System:
  OS: Linux 6.8 Ubuntu 24.04.2 LTS 24.04.2 LTS (Noble Numbat)
  CPU: (6) x64 AMD Ryzen 7 5800X 8-Core Processor
  Memory: 6.07 GB / 27.36 GB
  Shell:
    version: "5.9"
    path: /usr/bin/zsh
Binaries:
  Node:
    version: 20.18.1
    path: ~/.nvm/versions/node/v20.18.1/bin/node
  Yarn:
    version: 4.5.1
    path: ~/.nvm/versions/node/v20.18.1/bin/yarn
  npm:
    version: 10.8.2
    path: ~/.nvm/versions/node/v20.18.1/bin/npm
  Watchman:
    version: 4.9.0
    path: /usr/bin/watchman
SDKs:
  Android SDK:
    API Levels:
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 33.0.1
      - 34.0.0
      - 35.0.0
      - 35.0.1
    System Images:
      - android-34 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: Not Found
Languages:
  Java:
    version: 17.0.14
    path: /usr/bin/javac
  Ruby:
    version: 3.2.3
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

No failure. No logs.

Reproducer

Expo Snack Repro

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions