react-native-background-timer
react-native-background-timer copied to clipboard
on ios14.3, bk timer only survive for 30s after switch to background run
On iOS 14.3, BackgroundTimer.runBackgroundTimer only run 30 second, the same as setInterval.
Does this work as design ?
BackgroundTimer.runBackgroundTimer(()=>{
console.log("BackgroundTimer: Hello world. Now is: ", (new Date()).toLocaleString());
},2000);
setInterval(()=>{
console.log("setInterval: Hello world. Now is: ", (new Date()).toLocaleString());
},2000)
same here
I am also facing same problem...any solution??
same here
After doing some research, iOS will kill the background timer after some amount of time. There is no way to run a long background timer except watching the location continuously or your app is playing music in the background. I solved my issue by watching user's location in the background. The timer will run as long as the location updates.
any solution??
any solution
Did someone find any solution?
I've tried this package: react-native-track-player It's keep my timer to work for more than 30 seconds, I've even reached full circle of 25 min to work in background.
But it's working only on simulator, on real device it's stop after 30 sec :(
I was trying to build pomodoro timer.
I thought running timer in background would be a good idea, but I was wrong, so I've decided to do something else: When I'm starting my timer I'm saving start time in storage and creating scheduled push notification so my user will get notification when timer is done.
When I'm going back to app from background state to foreground I'm checking difference between start time and current time and do some actions.
Maybe it will help someone
here is a solution https://codeburst.io/the-definitive-guide-to-react-native-background-processing-51df02540433 https://developer.apple.com/documentation/watchkit/background_execution/enabling_background_sessions