Page 1 of 1

App Task Started question

Posted: 26 Jun 2015 09:11
by TraianC
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?

Re: App Task Started question

Posted: 26 Jun 2015 11:19
by MURTUMA
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.

Re: App Task Started question

Posted: 26 Jun 2015 19:32
by TraianC
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.

Re: App Task Started question

Posted: 27 Jun 2015 04:46
by TraianC
I found a workaround.
After the trigger (App Task Started / Ended) I have to check the condition App Task Running.
Now it works fine.

Re: App Task Started question

Posted: 27 Jun 2015 08:34
by MURTUMA
I was just about to post an example flow using that solution. Glad you found it out yourself.