Tasker – timers, how to do this correctly.

It's important to know how to handle the Time context in Tasker. Creating correct timers does not have to be complicated. Just follow few simple rules and you will be able to set any timers without issues.

Yes, there is a Wait and Wait Until action available already, and you can get away using this for a while. Unlike before, these actions are no longer as CPU intensive as it’s used to be.  I will show you how to set up Tasker timers correctly. This way, you will be sure, that you take the most battery efficient approach possible. Interested? Read on!

If you have any issues with timer context not working for you please read this post.

Tasker timers, theory…

I write this as I was asked about how to terminate the incognito chrome browsing on a mobile when the phone is no longer in use. Potentially, the person interested didn’t want to disclose their browsing habits. I get the lock screen arguments, but having such thing on is not always desired for many reasons. Motives apart I will use this, and turn off wifi if not connected to show you how to deal with timers correctly.

The idea is simple. I don’t want to start a timer. This may seem counter-intuitive at first but bear with me. The lowest CPU, and therefore battery condition are time-based. Your mobile is running a UNIX timer anyway, and we can hook up to it. Instead of telling Tasker to start counting till 300 (5min = 5 x 60sec=300)and perform an action, we can schedule an action to happen at the time which is 300sec away. This works as some sort of timer, can be easily cancelled (unlike wait), changed or updated.

Tasker timers, practice…

These 2 profiles will show you how to deal with a tasker timer, how easy is to cancel it or update it. We will use AutoNotification (optional for timer routine alone) to give us short notification of what’s happening and intercept the incognito session in the 2nd profile. In 2 profiles I can contain all it takes to cancel, update or reschedule the timer. It is simple, and CPU efficient.

WI-FI OFF after 5 min if not connected

If you are not interested in any notifications for this profile the project looks very simple:

TASKER PROFILE: Turn OFF WiFi [spoiler]

If you wish to have timer giving you notifications, few additional steps are needed to create and discard the notifications as required.

TASKER PROFILE: Turn OFF WiFi - notifications [spoiler]

Close Chrome Incognito after 5 min if

Closing the chrome can be done in a similar manner. Root and AutoNotification are required for this to work correctly. We are going to kill the chrome app, as only incognito browsing sessions will perish, our other chrome tabs will load on next chrome launch. AutoNotification will be used to look for an incognito notification in one of our contexts, to make sure the chrome is only killed when incognito tabs are opened. There is no need for notifications really as profile will only work when the screen is off.

TASKER PROFILE: Close Chrome after 5 min [spoiler]
Support NotEnoughTech
A lot of time and effort goes into keeping NotEnoughTech alive! If my work helped you out, consider buying me a coffee or check out exclusive rewards available to Patreon supporters.