react-native-background-task
react-native-background-task copied to clipboard
no timers in background task
I think this info should be in the documentation if you define task with a setTimeont - callback will be called only after app comeback to foreground mode
export const define = function (dispatch) {
BackgroundTask.define(() => {
dispatch(devicesDetailsActions.startUpdatingCycleBackground())
setTimeout(() => {
console.log('BackgroundTask timeout') // <===THIS WILL BE RUN IN FOREGROUND
}, 3000)
})
}
On iOS or Android?
@jussirantala Andoird, haven't tested on iOS yet?
@vitto-moz how did you work around this issue? Because iOS will kill the app if the background task runs for longer than 30sec, I'm trying to use a timeout to stop the task if the asynchronous call has not yet finished after just below 30sec