react-native-background-task icon indicating copy to clipboard operation
react-native-background-task copied to clipboard

no timers in background task

Open vitto-moz opened this issue 6 years ago • 3 comments

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)
  })
}

vitto-moz avatar Jul 12 '18 09:07 vitto-moz

On iOS or Android?

jussirantala avatar Jul 31 '18 11:07 jussirantala

@jussirantala Andoird, haven't tested on iOS yet?

vitto-moz avatar Aug 03 '18 12:08 vitto-moz

@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

jnurkka avatar Feb 07 '19 10:02 jnurkka