agilord/cron

Will this work in the background or not (flutter)?

Opened this issue · 6 comments

First of all, I'm not asking it to be work in the background.

There was already a closed issue #9 , but I believe it shouldn't have been closed.

The question asked there is what I want to learn.

Q:

Hi. Does this plugin run process in background, when the app is closed?
Or does it run when app is in foreground only?
Not much information is given.

A:

Hi, this package is for server-side apps, which run for a longer time. I'm sorry, but I have no idea how to achieve the same in a mobile app.

The answer assumes the user wants to use this in background and tries to achieve that functionality. However, question simply wanted to learn the behavior.

I think this information is crucial and should be in the readme.

isoos commented

I think this information is crucial and should be in the readme.

@ozgunozerk: I'm happy to accept PRs that help clarify this. Would you be interested in expanding on it?

Thanks for the kind offer, but I already have too much on my plate atm :)

I tested and it won't work when the app come to background

On Flutter Web, I minimized Chrome and the Cron still worked on time. Wouldn't a minimized Chrome be in the background? Thus, I believe it does work in the background.

I think Chrome tabs may be suspended after a while (I'm using an extension that forces this after an hour at most, but recent Chrome updates have this natively). I'm pretty sure that means no JS execution, including anything Timer based.

I think Chrome tabs may be suspended after a while (I'm using an extension that forces this after an hour at most, but recent Chrome updates have this natively). I'm pretty sure that means no JS execution, including anything Timer based.

Active tab maintained a timer for 8 hours without issue. I will try a test with a minimized tab as well soon.