App Task Started question

Post your questions and help other users.

Moderator: Martin

Post Reply
TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

App Task Started question

Post by TraianC » 26 Jun 2015 09:11

Hello,

I don't have a rooted phone and I want to launch the Location settings each time I start and close Waze in order to enable / disable GPS.
I use App Task Started as a trigger to test when Waze is launched and Launch App to display Location settings.
The problem is that after I close Location settings Waze comes up and right after Location settings shows up. Is like an endless loop.
What is happening is that when Location settings is displayed Waze goes to background. After I close Location settings, Waze comes to foreground. The problem is that the App Task Started is triggered when Waze comes in foreground.
All I want is that the flow to be executed only once when Waze is launched.
Please tell me how can I do that?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: App Task Started question

Post by MURTUMA » 26 Jun 2015 11:19

Add some boolean variables to your flow: when you launch waze > action script: global_waze = true. When closing waze,make it to false. Then add an expression to check whether it's true of false > condition expression: global_waze == true.

This guide might require you to have some basic understanding of boolean logic in the flow structure. So if you have trouble understanding this, just ask for more help.

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: App Task Started question

Post by TraianC » 26 Jun 2015 19:32

I've already tried with a global boolean variable.
I have two flows, one that should be executed when Waze starts and another flow that should be executed when Waze closes.
The solution with global variable doesn't work because when Waze goes to background it triggers the STOP flow just as it would when it closes, so my global variable becomes FALSE. I've also tried to disable one flow from the other (START flow disables the STOP flow and vice-versa) but the result is similar. The problem is that the START / STOP flows are executed also when the application goes to foreground / background.
I think the solution is a trigger that executes only when the application starts / stops and not when the application goes to foreground / background.

TraianC
Posts: 66
Joined: 24 Oct 2014 13:29

Re: App Task Started question

Post by TraianC » 27 Jun 2015 04:46

I found a workaround.
After the trigger (App Task Started / Ended) I have to check the condition App Task Running.
Now it works fine.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: App Task Started question

Post by MURTUMA » 27 Jun 2015 08:34

I was just about to post an example flow using that solution. Glad you found it out yourself.

Post Reply