Not working for background after 3 minutes
I search all posts, no one provides any solutions. I am targeting android system, I want to refresh a webview in the background each one min, Well after passing 180 sec. the app stop.
I am following the normal example provided on the home page of this plugin.
So what is the deal here?
Hi @beshoo I found the problem:
The tasks cannot be scheduled any more frequently than every 15 minutes, in this case is blocked 3 minutes.
The exact timings of task execution are unpredictable, as both Android and iOS use black-box algorithms, which depend on factors like device sleep state.
For more information see here:
https://github.com/transistorsoft/react-native-background-fetch
I find a solution in internet but it's not really great...
const monitorProgress = async (dispatch, id) => {
if (pos >= duration * AUDIO_DONE_AT) {
BackgroundTimer.stopBackgroundTimer();
dispatch(addAudioDone(id));
}
};
const startMonitoring = (dispatch, id) => {
BackgroundTimer.runBackgroundTimer(() => {
monitorProgress(dispatch, id);
}, MONITOR_INTERVAL);
};
reload... the timer every 3minutes
@yelkamel hi friend, any better solution here of the 3 min limitation?
I am facing the same problem
I need to send the current location of the device every minute but I'm having a problem when the device is locked.
First I created a timer that runs every 10 seconds (just for testing purposes ) when the app is open or in the background works perfectly fine, but if I lock the device, the timer takes more than 10 seconds to run.
These are some test that I did that measure how often is running (in seconds):
[ 10, 9, 9, 9, 10, 9, 10, 9, 10, 10, 9, 10, 41, 89, 44, 76, 55 ]
As you can see, it's running every 10 seconds because the app is open or in the background but as soon as I locked the phone the time to run increases.
I did another test, this time setting the timer to one minute and these are the results:
[ 60, 60, 164, 219, 395, 326 ]
As you can see, it takes more than 5 minutes to run when it suppose to be running every minute.