GeoTecINIT / nativescript-task-dispatcher

NativeScript-based mobile background task scheduler and dispatcher

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(Question) Run task while app is closed

Peasplayer opened this issue · comments

Hi, I wanted to ask if it's possible that a task continuos to run while the app has already been closed. Thanks

Hello @Peasplayer, thank you for your interest. All the tasks dispatched by the plugin run by default in the background, therefore, they run whether the app is open or closed.

From your comment do I understand that you'll want to run a task longer than the default maximum execution timeout (3 minutes)? If so, our approach with this library is to split the task into steps, so we can schedule the task repeatedly and resume the execution from the last checkpoint. We do this because a background service is not guaranteed to run endlessly in Android without being killed by the OS at some point.

Nevertheless, could be good to know about your use case, so we can better help.

Hi, my mistake was that I tried to access a variable that was set while the app was active. That caused an exception which stopped the task and didn't show the desired result. Thank you for you quick response!

Glad that you could fix the issue @Peasplayer! Thanks for the update