Clock remains active when changing screen

Hello all.

I have a screen with a countdown timer and therefore a clock component activated.
When I change screens I would like the countdown of the other screen to continue so when I return to this screen I see the time remaining.

But when I change screens, and I come back to my previous screen, I see that the countdown is reset to zero as if the clock component had deactivated when changing the screen.

How can I do when changing the screen so that my countdown does not reset and continue to run?

the simple solution, make use of with millis… or use some extension…

How do you set timer, about min:ss or HH:MM:SS?

for this purpose only i said, use millis…

when timer starts, get the current time in milli and final millis
(e.g 5 min countdown timer mean, initial millis is current time milli, final timer will be initial milli + 300000 and save the final milli in tinydb, then start clock to run

for every second, add 1000 with current mill and find the difference between current milli and final mills and convert it into hh.mm,ss

if you go to any screen and come back mean, just check any final milli is in tinydb. if exists, again check the difference between current milli and tinydb milli and make clock to timer. once it timers, already you have designed block so it will take care untill timer goes to 0

1 Like

but I think I found my problem.

When I switch to a new screen and go back to the previous screen where I want my countdown to continue, the screen initializes with the clock off causing it to reset.

I’m going to think about how to let the countdown run even if I change screens and come back to the screen.

not possible without the help of tinydb or any extension… , i hope… may be i am wrong but …

1 Like

here is very simple timer … it will work with the help of tinydb Untill user clears data

Extension you can find it here created by by @vknow360

(PS: timer always fires and timer enabled must be untick from designer part of clock)
image

1 Like

Thank you I will see to adapt it to my project.

1 Like

@Still-learning
Hello,

I just tested.

The countdown starts well at 5 min and decreases.
On the other hand, when I go to another screen and return to the countdown screen, the countdown no longer decreases but resets to zero and increases.

Example :
I leave screen 1 with a timer at 0d 0h 4m 34s
When I come back it goes to 0d 0h 0m 0s and makes an increasing countdown.

See solution provided in

Try this
countdown_5.aia (9.8 KB)

firebase.apk (5.2 MB)

I have used the above procedure…

Just hit start button, go to screen 2, press back button to return… also close the app and reopen… and tell me whether it is continue from where it left or restarting from zero…

@dora_paz @Still-learning

Thanks for your help.
I will look at your 2 proposals.

1 Like

I mis read your topic, I think… actually you want where you left… But my design is just it will goes on decreasing… little arrangement will solve, just save the remaining time in tinydb and start from that point when screen initialise

@dora_paz

In the spirit, yes it is that of going from one screen to another and when we return to the 1st screen the countdown continues.

But I misspoke when I said that when I returned to the 1st screen, the countdown resumed where I was. I actually meant it continues to count down while I’m on screen 2.

Example :
I leave the 1st screen at 4m 30s
I’m going to the 2nd screen for a while
I return to the 1st screen afterwards with the countdown updated to for example 3m 30s if I spent a minute on screen 2.

Ok let me modify it. Also what will happen in both screens if time elapsed ?

@Still-learning
that’s exactly what i want to do yes.

It also works well with the app closed and when switching screens.

what is your aia?

1 Like

@dora_paz @Still-learning

Thank you @dora_paz , your solution is good but @Still-learning brought me the solution beyond my expectations with the stopwatch which continues even with the app closed.
It remains to be seen the aia he uses.

2 Likes

@dora_paz

To answer your question, once the time is up, a button appears.

1 Like

@Still-learning

I used airtable instead of TinyDB to store the time values.

I can try to adapt what you put there Clock remains active when changing screen - #7 by Still-learning

but I do not get the result of your APK.

the point is, where and all i used get tinydb tag value, you must use your airtable value… and where and all i use save the tinydb value you must use save to airtable…

1 Like