Skip to content
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

Foreground events not tracked after app comes back to foreground #818

Open
matus-tomlein opened this issue Sep 12, 2023 · 0 comments
Open

Comments

@matus-tomlein
Copy link
Contributor

This can be reproduced using the example app in the React Native tracker. The example app tracks background events when the app goes to background but does not track any foreground events when the app comes back to foreground.

This seems to be an issue in the iOS tracker because when debugging what happens, it seems that the Session.updateInBackground() and Session.updateInForeground() functions are called correctly, however the state in the Session object is not correct – when the app comes back to foreground, the isBackground variable is false even though the updateInBackground() call was executed previously.

I think this is because iOS makes a memory snapshot of the app before the isBackground flag is changed. When the app comes back to foreground, the snapshot does not know that it was in background before. This is just a hypothesis but in case it is true, we should store the background state in user preferences instead of in memory (that would also make it more resilient to crashes in the background).

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

No branches or pull requests

1 participant