How to stop sending HTML 'get' requests when app in background

I have a couple of apps that do home automation stuff. When active, they repeatedly poll Arduino-based systems with HTML "get" requests. When I inadvertently put the app in the background (swipe up on Android phone) instead of stopping it, when I come back to the app there is almost always an error message that a request failed. It's somewhat annoying. Is there a way to make the app go inactive, or at least stop sending the requests, when it's in the background ?

Have you tried turning off the Clock flag that lets it continue in the background?

I'm not really sure what you mean, I'd be grateful if you'd explain. I do have timers which cause the polling 'get' requests. Disable them ? But how do I detect app moving to background ?

The TimerAlwaysFires flag.

Read its tool tip.

1 Like

That looks interesting, but. the response of @ABG worked perfectly though.

Followup question: is there any way to perform actions immediately when my app returns to the foreground ? Would “OtherScreenClosed” work ?

Try the ActivityStareChanged event from the tools extension

If state = resume
Then do something

Noze: this also gets triggered after starting your spp

EDIT: You can do the same using @Anke 's suggestion How to stop sending HTML 'get' requests when app in background - #5 by Anke
Taifun

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.