-
Notifications
You must be signed in to change notification settings - Fork 233
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
Background task creates the risk of termination #373
Comments
Same |
Same issue. |
As far as I understand it you can just run code up to 30 seconds after the app enters background, and then you can only fire events again in a period of 15 minutes (also 30 seconds). You could start the timer again with https://github.com/transistorsoft/react-native-background-fetch Please correct me when I'm wrong, still figuring this background stuff out with react-native. |
Has anyone faced this warning and seen timer performance issues with iOS in production? I'm getting timer issues with iOS but works seemingly fine on Android. |
@Tim4497 So does this mean we have to use this package in conjunction with react-native-background-fetch? Or should we solely use react native background fetch for background tasks? |
I used: BackgroundFetch from 'expo-background-fetch'; and queue, { Worker } from 'react-native-job-queue'; in the end. You can use them in bare rn projects, so no expo required |
I have opened the app and on initial load I create a set interval to send the location to backend every 5 seconds. I left the app in foreground and then in Xcode logs started to show me this
2021-11-25 14:41:34.367850+0000 Driver[3314:522530] [BackgroundTask] Background Task 5 ("RNBackgroundTimer"), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. Remember to call UIApplication.endBackgroundTask(_:) for your task in a timely manner to avoid this. 2021-11-25 14:42:02.242027+0000 Driver[3314:523175] [tcp] tcp_output [C8.1:3] flags=[R.] seq=1461532209, ack=806701271, win=2047 state=CLOSED rcv_nxt=806701271, snd_una=1461532132 2021-11-25 14:44:59.632334+0000 Driver[3314:523177] [tcp] tcp_input [C18.1:3] flags=[R] seq=2256668869, ack=0, win=0 state=LAST_ACK rcv_nxt=2256668869, snd_una=1943136650 2021-11-25 14:44:59.632865+0000 Driver[3314:523177] [tcp] tcp_input [C18.1:3] flags=[R] seq=2256668869, ack=0, win=0 state=CLOSED rcv_nxt=2256668869, snd_una=1943136650 2021-11-25 14:44:59.633033+0000 Driver[3314:523177] [tcp] tcp_input [C18.1:3] flags=[R] seq=2256668869, ack=0, win=0 state=CLOSED rcv_nxt=2256668869, snd_una=1943136650
Any idea why I get this and how can I avoid it?
The text was updated successfully, but these errors were encountered: