-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Lifecycle events and HeadlessJS on Android #15960
Comments
Hey, thanks for reporting this issue! It looks like your description is missing some necessary information, or the list of reproduction steps is not complete. Can you please add all the details specified in the template? This is necessary for people to be able to understand and reproduce the issue being reported. I am going to close this, but feel free to open a new issue that meets the requirements set forth in the template. Thanks! |
What exactly happened here? |
This is not a bug report and this is not a question or a problem I have with the library? Should I frame the NetInfo implementation as a bug? |
Hey @vjeranc, we have a bot that periodically closes issues that don't use the template provided. We're only using GitHub issues for bug reports at this time. If you can frame this within the requirements set forth by the template, go ahead and open a new issue. Otherwise it might be best to find another avenue to direct this sort of question. |
I'm interested in how exactly lifecycle events work with HeadlessJS and how they should be used by react-native modules.
Example: If I were to make a background task where I'm fetching messages only over WiFi, I'd need NetInfo to tell me the network type. I'd register a listener and stop fetching if network provider changed.
The problem is that
onHostResume
,onHostDestroy
andonHostPause
listeners are triggered when something happens with the main activity.In the above case, NetInfo unregisters receiver and the background task that can still be running (despite activity being destroyed or on pause) will no longer receive events on network provider. There might be other ways to solve the task above but there can be plenty of similar tasks that are crippled by things done in native when actions on activity trigger lifecycle changes.
There seem to be other non-
react-native
modules doing similar things and completely crippling the background task.Is this expected behavior?
The text was updated successfully, but these errors were encountered: