My app has a counter that increments every minute.
We’ve tested it on several phones, iPhone and Android.
The counter doesn’t update when the phone’s screen is turned off.
Is there a way to make it at least update when the screen turns back on? @emmanuel
https://lilspace.me/
What’s the complete logic you are using?
It’s a “do every 60 seconds” action that adds 1 to a counter.
At least it was.
Now it’s a “do every 60 seconds” action that calculates the difference between current and start time. This seems to be working.
I believe the “do every X seconds” is something that the client does, not the server. So if the phone screen is off, the client is no longer running, so the workflow isn’t getting run. I’m 65% sure this is what’s happening in your case, and why it would work with the second bit of logic you outlined.
As @potentialthings mentioned, “Do every _ seconds” is ran on the client. So your initial implementation wasn’t going to work as there will be a period where some duration is missing.
Yeah, Today I Learned that action depends on the client’s browser not going to sleep.
Maybe the action’s name should be “do every X while the browser is awake”?
Anywho, I modified it to calculate the display number from current time minus start time instead of incrementing by 1. That’s working well enough now. It can still be a little off based on when the workflow updates and different rounding/floor calculations. But it’s close enough.
The important thing is that when the user turns their phone back on the counter is updating.