react-native-background-actions
react-native-background-actions copied to clipboard
iOs Background Action stalls after background time
To me it seems this is just normal behavior since the ios part relies on beginBackgroundTaskWithname. As it states there the background tasks have an assigned time which they get to run, after that time the process is stalled.
@Rapsssito Would it be possible to use "normal" Background Tasks in iOs to prevent the process to be stopped so soon?
Im willing to contribute to make this happen, I just don't know if Background Tasks will perform as desired
(The same topic applies to react-native-background-timer)
Hi @lauhon, you are more than welcome to send a PR! However, take a look at this comment here: https://stackoverflow.com/questions/58960411/how-to-get-your-ios-app-to-run-in-the-background-for-longer-than-3-minutes
We haven’t had the old 10 minute window for years so that is simply no longer applicable. That was reduced to 3 minutes in OS 7, and further reduced to 30 seconds in iOS 13. (There is a new concept of background tasks, for running tasks longer than 30 seconds, but the the OS will run these at its own discretion, e.g. at night, when the user is charging their device, so that’s not really applicable here).
Nice to know. I will look into it as soon as I can.
Hopefully, the behavior of background tasks ends up making sense. I guess if it's not 100% intuitive I can add a setting/flag to control if the task should run as it's possible already, or with the background task API.
FWIW, I have an app using this library on iOS that successfully stays in the background for 2+ hours. That being said, I'm also doing background audio and location. For me, the key to getting background execution to run longer was ensuring that the app's memory and cpu usage in the background was low.
FWIW, I have an app using this library on iOS that successfully stays in the background for 2+ hours. That being said, I'm also doing background audio and location. For me, the key to getting background execution to run longer was ensuring that the app's memory and cpu usage in the background was low.
@contactsimonwilson can you share a snippet or gist on how you were able to implement this?