3

Foor Loop Help

Hello, I am trying to make Tasker do, what i believe, is a fairly simple task.

I am using Tasker in my car. I have an aftermarket headunit that is running Android on it.

What I would like is, when the headunit turns on, I would like Tasker to wait 2 minutes, then open an app. "Waze" app to be exact. Thats it.

I was able to make this happen by simply creating a task with the following:

1. Wait -> 2 minutes

2. Launch App -> Waze

However, this proved to be unreliable because the aftermarket headunit does not keep time when it is turned off. (it does not have a backup battery either)

So when I start the car, the time is incorrect, the unit has a SIM card in it so within 5 to 30 seconds the time is updated to the correct time. This random time update causes Tasker to think that the 2 minutes have elapsed and it launches the app at very random times. Sometimes immediately after device boot, sometimes very close to 2 minutes. Its completely random.

I was thinking to do a FOR loop of some kind, where the FOR loop waits for 1 second and then increases a counter, then keeps looping through until the counter reaches the 120 seconds (2 minutes) and then launches the app. I believe this would be a good work around for the time update and would allow me to get what i need. I understand that when the time update occurs, one of the 1 second cycles might be off, but that doesnt matter as long as i am somewhat close to the 2 minute time.

Could anyone help with how this could be accomplished?

1 reply

You can do something like:

Task: Test

A1: For [
Variable: %count
Items: 1:5 ]

A2: Wait [
MS: 0
Seconds: 1
Minutes: 0
Hours: 0
Days: 0 ]

A3: End For

A4: Flash [
Text: Done
Continue Task Immediately: On
Dismiss On Click: On ]

This example does it for 5 seconds, but you can just change the number in A1 to whatever count you want :)

Hope this helps!