Keep Timer running even (1) the app screen is off or (2) the app it is closed or (3) in background

Hello.

A.

I have Timer that runs from a trigger and should do some changes on some specific values (create a visual bar as the times flows).
But if the screen goes off the timer will do the same.
So if I want a visual bar that indicates a minute, if the screen turn off, the bar will wait until the screen it is turned on again.
It is possible to keep the timer running even (1) the app screen is off or (2) the app it is closed or (3) in background?

B.

Do you thing would be an idea to keep the Timer changes but realted to the clock from device and calculate how many minutes, seconds, hours are from the trigger moment?

Thank you.
Ionut

Thunkable can’t run processes in the background but I believe there’s a way to still do what you want by comparing the time when the app last ran (in foreground) and the time it was re-opened.

I’ve been working on this (see this post) but I got stuck with a loop/wait bug. I think that’s working now so I may be able to figure out a method for this soon.

@mom7667yafy Said they figured out a solution: Can I make an app that alerts the user of the time to review?

2 Likes

Thank you.
I saw your post before and I had no idea if there was a solution for you. Also I am glad that somebody has a solution, but it may be a to high level for me.

Yes, the idea with the math and clock maybe something.
I will try to figure out as a logic first.

Again, thank you!

Thank you again.

Would be possible to have (1) a time stamp for start and (2) another one for end and a (3) math formula to know instant how much time was between them?
Did your original idea was like this? And why it was not doable?

Regards,
Ionut

Yes, my idea was similar to this. But several issues including the timer bug I mentioned prevented me from getting it working. It’s a complicated problem and takes some time to implement. I haven’t had the time myself.

1 Like

I can confirm you can create a timer based on the devices time. Store the start time of the timer in a stored variable when the user starts the timer and then whenever you open the app and the timer is running, you display:

current device time - stored start time

The math to calculate the hours, minutes, and seconds is semi-complex. I think I’ll write up a tutorial soon, however, I can’t share the app as it is project for one of my clients.

Good luck!

3 Likes

Thank you, @Darren!
I hope you are ok!

Thank you!