background timer not running in ios 12.3 version
in 12.3 version ios timer is not running in background
Hi @SwathyPA I'm using iOS 12.3.1 and works well.
can I get a basic code of yours
Hi @SwathyPA, you can try in 2 ways:
Same code:
BackgroundTimer.runBackgroundTimer(() => {
// Your scheduled task.
},
3000);
BackgroundTimer.stopBackgroundTimer(); //after this call all code on background stop run.`
Selecting the platform:
startDownloadsInBackground = () => {
Platform.select({
ios: () => {
BackgroundTimer.start();
// Your scheduled task.
},
android: () => {
this.backgroundTimer = BackgroundTimer.setTimeout(() => {
// Your scheduled task.
}, 0);
}
})();
};
stopDownloadsInBackground = () => {
Platform.select({
ios: () => {
BackgroundTimer.stop();
},
android: () => {
BackgroundTimer.clearTimeout(this.backgroundTimer);
}
})();
};
Note:
For security reasons the task is blocked after 3 minutes, I hope this will fixed.
https://github.com/ocetnik/react-native-background-timer/issues/125
I hope it helps!
For security reasons the task is blocked after 3 minutes...
What does that mean @skantus? Is that an Android thing or something limited in this codebase?
If I'm understanding right, if I set a timer and want to do something exactly 4 minutes later, then that is not possible?
Hi, @alexfinnarn this is a similar issue about background task to a better understanding:
https://github.com/EkoLabs/react-native-background-downloader/issues/42#issuecomment-527653821
Hi @SwathyPA I'm using iOS 12.3.1 and works well.
Could you please share your working code, please? My task is to send my position every 15 minutes