Doze-resistent timer with a random interval

75 views
Skip to first unread message

Soudane GMTA

unread,
Dec 16, 2021, 6:07:54 PM12/16/21
to Tasker
I have already read the following discussion, but unless I'm misunderstanding something, it doesn't address a question that I have:
https://groups.google.com/g/tasker/c/pZo93b987Ho/m/NLFvfcVnDgAJ

On my Android 10 device running the latest Tasker beta, if I create a time context with a fixed interval (say, "every 2 minutes"), it properly gets triggered every 2 minutes, irrespective of whether the OS is trying to doze. This is very precise and reliable. I'm guessing that this precision and reliability might have something to do with the fact that this kind of timer is implemented via an alarm.

In any case, what I am now looking for is a way for that interval to be random, instead of a fixed number of minutes ... **and** for it not to be affected by the OS's dozing behavior.

If I just create a task which loops forever with a "wait" of a random interval within each loop, this task is indeed subject to doze constraints, and the wait time might end up being a lot longer than the calculated random value.

Is there any way in Tasker that I can specify a random timer that is precise and unaffected by doze procedures?

Thank you in advance for any suggestions.


ktmom

unread,
Dec 17, 2021, 9:09:40 AM12/17/21
to Tasker

Soudane GMTA

unread,
Dec 17, 2021, 1:34:59 PM12/17/21
to Tasker
Thank you!  I'm glad to know that variables can be used.
Here's a summary of of the info in the link you sent ...
    PROFILE: "Custom Wait Time"
    TIME > FROM: %CustomWaitTime TO: %CustomWaitTime

What I'm looking for is the following:
    PROFILE: "Wait Random Amount Of Time"
    FROM: 00:00 EVERY: %ChangingVariable TO: 23:59
    => SomeSortOfTask


... where I can change the value of %ChangingVariable to a different random value
every time that SomeSortOfTask gets fired off.  In other words, SomeSortOfTask
will get fired off all day at random intervals.

Soudane GMTA

unread,
Dec 17, 2021, 1:43:00 PM12/17/21
to Tasker
... or will the first profile work for that, after all? I guess I could use that profile to fire off my "SomeSortOfTask",
and have that task recalculate %CustomWaitTime ... correct?  Instead of being an interval in minutes or hours,
%CustomWaitTime would have to be a time string like "HH:MM" or maybe "HH:MM:SS", correct?

Dave W

unread,
Dec 17, 2021, 5:10:44 PM12/17/21
to Tasker

I've gotten good timing results with the System/Tick event or setting the system timer.  These should allow you to use delta time values.  To use absolute time values, you will need to know time at midnight.

Dave W

unread,
Dec 17, 2021, 5:17:59 PM12/17/21
to Tasker

BTW...I hate doing time arithmetic.  I have one task that formats absolute seconds as HR:MM(am|pm) and another task that formats delta minutes as HR:MM.
On Friday, December 17, 2021 at 1:43:00 PM UTC-5 gmta.s...@gmail.com wrote:

Soudane GMTA

unread,
Dec 18, 2021, 12:57:51 PM12/18/21
to Tasker
Thank you. Yes, the System/Tick event indeed seems to be accurate enough for my purposes. I never knew about it before, and I appreciate your suggestion about this.
Reply all
Reply to author
Forward
0 new messages