Action "sleep"

Post your questions and help other users.

Moderator: Martin

Post Reply
User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Action "sleep"

Post by Rafi4 » 17 Jun 2018 12:14

Hi
I am a bit confused about action "sleep". I want to know about action "sleep". In which type of flows I can use this action? Any clarification?
Thanks in advance.
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

User avatar
digitalstone
Posts: 342
Joined: 21 Oct 2017 12:36
Location: The Netherlands

Re: Action "sleep"

Post by digitalstone » 17 Jun 2018 15:18

The simplest example is a countdown timer (also stated inside the help section i believe):
In this case of a countdown, you're looping through 10 seconds to 0 seconds let's say...
But you want a second to pass between each second.
In that case you would setup a timer for 1 second.
Now, your phone would normally countdown as fast as the CPU could run through the whole flow, but with the "Sleep" action within it, you're basically saying that it has to wait an entire second between each loop iteration.


Another example would be a "check-counter":
When a flow has been triggered and you want to check-up on afterwards, before you want Automagic to do something else.

You then have to build a continuous cycle of evaluation to check if a certain value has been reached.
like this:
Image

Except... If you would adopt the flow (from the picture) into any digital system, it will strain a LOT of unnecessary calculation from your CPU, because it will run an entire loop EVERY 10ms or so (depending on what you're checking by today's standards).
To make things easier/efficient for your processor, we would like to tell the CPU to sleep until we (we=developers/users/people) decide to check a certain value once again to take a certain action based on that value.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Action "sleep"

Post by Rafi4 » 18 Jun 2018 05:23

Hi digitalstone
Thanks a lot. Thanks to your quick response and valuable information
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

Post Reply