Clock background extension

P1_clock

Hi Community,
I created a clock for timming and it runs normally (as above photo). But when I switched off the screen of my phone for power saving, I found the clock stop counting until the screen is on.
Is there any background extension for my case?
Thanks for helping !

Just use a lifecycle extension to capture the current time and the value of the timer.

When the app is then started again, use the current time to calculate where the timer should be, and start it.

This is probably going to be easier than setting up a background task.

@EricPang take a look at this topic, that explains how to set a wave lock and keep alive the screen »

[App Keep alive always - #79 by MengeneeringSoft]
:pray:

Lito

@>-->---

for example the tools extension and its ActivityChanged event

if pause 
then capture the current time and the value of the timer

if resume
then calculate new timer value = current time - captured time - captured timer value
 and continue the countdown from there

Taifun

1 Like

Hi Taifun,
I have tried your method and it works. Thank you very much!

1 Like

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