Need help. Revalidation of trigger after one hour

jazer

New member
Hi Macrodroid experts, I'm newbie in macrodroid, I'm doing a macro that needs to revalidate the trigger before any action to do. My scenario is this:

1. I have an app running in the foreground. Sometimes when app is starting it always stuck up to a specific page..I will use the content text trigger for it to restart it.
2. But my issue is I want to re-check again if the screen/page is still the same (means in stuck up), maybe after one hour
3. if not the same, it will end the macro, but if the same page or the trigger text is still showing (means stuck up), action is to kill the app and launch it again

Is there a way to do it ? appreciate any help/advise you can give. Thank you.
 

Dm114

Well-known member
Hi Macrodroid experts, I'm newbie in macrodroid, I'm doing a macro that needs to revalidate the trigger before any action to do. My scenario is this:

1. I have an app running in the foreground. Sometimes when app is starting it always stuck up to a specific page..I will use the content text trigger for it to restart it.
2. But my issue is I want to re-check again if the screen/page is still the same (means in stuck up), maybe after one hour
3. if not the same, it will end the macro, but if the same page or the trigger text is still showing (means stuck up), action is to kill the app and launch it again

Is there a way to do it ? appreciate any help/advise you can give. Thank you.
You could use a trigger to fire your macro every hour and check the content of the screen (maybe with a general Constraint: "this App in foreground" to prevent from checking the screen uselessly)
 

jazer

New member
You could use a trigger to fire your macro every hour and check the content of the screen (maybe with a general Constraint: "this App in foreground" to prevent from checking the screen uselessly)
I don't think trigger every hour suits my use case. I just want to trigger it if the trigger text only appears, but before any action is to wait 1 hour then recheck again if trigger fires, if yes, will execute the kill/launch app. If not, just exit the macro. then if that trigger text appear again, same process. I don't know how to do it, i think the combination of wait until trigger, the if cause will work and the constraint triggered fired. Maybe someone here can give me ideas to try. thank you
 

jazer

New member
I've solved my issue. I utilized constraint (not invoke) for 1 hour and utilized an "if clause" with a variable (cycle) set to 1. When the cycle equals 2, it triggers and performs the actions (kill and lauch the app) and then resets the cycle back to 1. Otherwise, it increments the cycle by 1. Thus, during the first cycle or trigger, it doesn't perform an action, but simply increments the cycle by 1. On the second cycle (after on hour), it performs the actions set since the cycle is now 2. It's a just simple programming solution, but thanks to @Dm114 for the advice. Much appreciated.
 
Top