On Tue, Jan 6, 2015 at 5:55 AM, Jan Jongboom <[email protected]> wrote:
> Hmm, this actually sucks for our use case:
>
> 1. minInterval - in seconds. It can happen that this operation will be 
> scheduled with a bigger interval.
>
> How hard would it be to make this an *exact* interval?

The point of the API is to *not* be exact. And instead allow the
platform to schedule callbacks whenever is most battery efficient to
run them.

This way if two apps ask to sync data, one every 20 minutes and one
ever 25 minutes, rather than wake up the CPU and radio twice, we can
just wake it up once and tell both apps to sync. Likewise, if the user
turns off syncing for one of the apps, we won't wake that app up at
all.

It also means that we can do things like: If an app asks to sync every
20 minutes, but at a given sync interval there is no internet
connection, we won't wake the app up at all (thus saving battery). But
if 2 minutes later we do get internet connectivity, we won't need to
wait another 18 minutes, we can immediately wake up the app and tell
it to sync.

What problem are you trying to solve by enabling an exact interval?
I.e. what type of app/website are you building, and how do you want
that app/website to behave?

What do you want to happen if there is no internet connectivity at the
exact interval that you specified but there is internet connectivity 2
minutes later? Do you want the user to be able to override how often
the callback fires?

/ Jonas
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to