[Bug] Trigger on app start in infinite loop

Post your questions and help other users.

Moderator: Martin

Post Reply
goocreations
Posts: 4
Joined: 11 Jun 2014 19:15

[Bug] Trigger on app start in infinite loop

Post by goocreations » 11 Jun 2014 19:43

I want to auto-enable my WiFi when I start one of my browsers. I've created a flow with a trigger "App Task Started" and selected Chrome from the list. When I open Chrome, the flow is correctly executed, but once done it immediately calls the flow again and again, forever. This seems to happen only in some cases if you add a condition to the flow. I've tried a number of other apps (including Firefox), but the same problems occur. I've attached the flow and the log. Chrome was only opened ONCE, but the 2 dialogs keep on popping up.

Am I doing something wrong or is this a bug?

I'm running Android 4.4 (Cyanogenmod 11 - rooted) on a Motorola Droid Razr Maxx.
Attachments
log.txt
(4.23 KiB) Downloaded 547 times
flow_Chrome_Connection_20140611_213033.xml
(1.74 KiB) Downloaded 598 times

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: [Bug] Trigger on app start in infinite loop

Post by Martin » 11 Jun 2014 20:35

Hi,

That's the expected behavior when the flow opens some kind of confirmation or input dialog since Chrome is moved to the background when the flow executes and Automagic becomes the active foreground app. As soon as the confirmation dialog is closed, Chrome is brought to the foreground again, which executes the flow again that shows the confirmation dialog and so on.
Automagic checks the currently running foreground app approximately every 2 seconds so you can break this endless loop by dismissing the confirmation dialog very fast.

There are some ways to prevent this (not all solutions might be applicable):
  • use action Set Flow State: Disable {flow_name} to turn off the flow before the confirmation dialog is shown, wait some seconds after the dialog is dismissed (to ensure that the 2 second check passes) and then enable the flow again
  • set Menu->Options->Flow execution policy to Skip execution... and add an action Sleep: 5s after the confirmation dialog to ensure that the flow takes enough time to execute until Chrome is in the foreground again
  • instead of starting Chrome using a regular shortcut on the launcher, create a flow with a shortcut trigger that asks for the confirmation first and then starts Chrome using an action Launch App
  • instead of a confirmation dialog, post a notification to switch on mobile data
Regards,
Martin

goocreations
Posts: 4
Joined: 11 Jun 2014 19:15

Re: [Bug] Trigger on app start in infinite loop

Post by goocreations » 11 Jun 2014 20:55

Thnaks, I'll try these solutions

Post Reply