-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
AppState
often fails to fire 'background'
until the app is foregrounded
#50415
Comments
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.8. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Tip Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Expo Snacks run in idk what version but the changelog suggests if 0.76.7 has this issue, so will 0.76.8. |
@Nantris thanks for the issue, we will look into it! |
@Nantris have you checked for similar issues: If I recall correctly this was already investigated in the past |
@cortinico thanks for your reply. I did look and I found at least one that was kind of close but it didn't seem the same. Not sure which it is now and currently on mobile but I can try to find it again if that might have value. |
have you try the 'blur' and 'focus' events? |
I have tried blur and focus and they've been a help, but I don't think they're an alternative to AppState firing the change event before the app backgrounds. What I'm seeing is that the background change event fires when the app comes back from background, immediately followed by the active change event. Edit: And just to reiterate this isn't entirely consistent in our project. Sometimes it does work, but often it does not. I'd say 90% of the time it doesn't work, 10% it does. The 90% of the time it fails, the background event fires after the app is foregrounded again. |
@cortinico I wonder if you have any thoughts on this? The fact I didn't find any issue that seemed quite like this one. |
Nope I'm sorry I don't have insights on this one (nor capacity to investigate further). If someone from the community could look into it, would be gold |
Seems like after my S24 upgraded to Android 15 this works properly. Not 100% sure (didn't hook up the debugger), but it seems like it. |
Description
AppState
fails to fire'background'
until the app is foregroundedSteps 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
Stacktrace or Logs
Reproducer
Expo Snack Repro
Screenshots and Videos
No response
The text was updated successfully, but these errors were encountered: