-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Bridge] Run JavaScript Code on background notifications #3213
Comments
There have been a few issues created about background execution of the JS Runloop. I speak from experience. From what i've seen. As of current, it's definitely suspended and what i've read, I don't think there's a way to make it wake up unless so-called signals are sent to it, which React Native doesn't do. The solution most people are finding is creating ObjC extensions to make this possible. See this thread: #1282 |
@jaygarcia I think it is now possible to run arbitrary JS in response to remote push notifications, even when the phone is locked and screen is off: #1282 (comment) Closing this unless I'm making this up. |
Definitely, I am controlling music player while the app is in background - works. What's worth noting is that all intervals and timeouts are stopped by React, but - if you have some handlers registered on NativeAppDeviceEmitter - they will be called and if you setState on that, this will be respected as well (e.g. if you call some native APIs in |
hi guys, does someone knows - is it react native that postpone http |
@grabbou do you have a sample code snippet how you manage to execute a js while the app is in the background? I'm building a music player too with a module that makes the app runs in the background, even lock screen. But the thing is. I was not able to update the module via JS because it's preventing JS execution for some reason. |
I'm not sure there's a definitive issue for this topic yet. Is it possible to run JavaScript code in the background, for example in response to background push notifications? For my specific use case I'd like to fetch data from the network and store it in a persistent database. The app will read from the database when becoming active and update its UI.
It would also be feasible to run a different JavaScript entry point module instead of the main app.
For my specific use case I'm relying on iOS libraries that I'd rather not have to rely on and instead use the JavaScript equivalents.
The text was updated successfully, but these errors were encountered: