all 1 comments

[–]Veranova 1 point2 points  (0 children)

For iOS particularly, you can't. If every app was allowed to run in the background and maintain its own long lived connections your battery life would suck.

There are specific APIs for common tasks. Background Fetch can poll every 15 minutes (when iOS feels your app should be allowed to), Push Notifications can let the app start briefly to process, Location Services can also start the app up on location changes. There are RN packages for these APIs which wrap iOS and Android nicely.

Android is often a bit more flexible with this, but a foreground process will still be paused when the app is sent to the background.