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

Lifecycle events and HeadlessJS on Android #15960

Closed
vjeranc opened this issue Sep 15, 2017 · 4 comments
Closed

Lifecycle events and HeadlessJS on Android #15960

vjeranc opened this issue Sep 15, 2017 · 4 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@vjeranc
Copy link
Contributor

vjeranc commented Sep 15, 2017

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 and onHostPause 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?

@pull-bot
Copy link

pull-bot commented Oct 9, 2017

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!

@vjeranc
Copy link
Contributor Author

vjeranc commented Oct 9, 2017

What exactly happened here?

@vjeranc
Copy link
Contributor Author

vjeranc commented Oct 9, 2017

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?

@hramos
Copy link
Contributor

hramos commented Oct 10, 2017

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.

@facebook facebook locked as resolved and limited conversation to collaborators Oct 9, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Oct 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants