How to prevent Dynamic card views from disappearing?

I have an app with dynamic Card views. And it is behaving strangely. It has a timer, which seems to work even in the background (even when the screen is off), but at a much slower rate. But comparing the state of the timer before minimizing (and offing the screen) and after reopening, I can confirm that the timer still sort of runs in the background but much slower. How do I fix this?

Also, after minimizing the app and it would work for around 30 minutes (timer runs slowly), but if I open it about 2 hours later, it seems like the app is completely reset, all my dynamic card views are gone! How do I prevent this from happening? This is also a pain since I have timer that needs to run in the cards.

1 Like

You have to show blocks to get appropriate answer…
I think you should try on app pause and on app resume block .

And I don’t understand what you mean by this

.
.
.
By the way read this

2 Likes

Android system will close minimise apps if the OS requires more memory or CPU power for the app that is actively on the screen

Do not rely on background activity, Kodular apps are not designed for background processes and Android will shut down if needed

1 Like

I see, is there no way around that? Dynamic cards are not meant to be permanent then? Can using a database prevent the app reset or automatically restore my dynamic cards when I reopen the app? And can I make the timer in the dynamic cards run again from where it left off? I am a complete newbie, sorry if my questions sound stupid.

Sorry I didn’t explain clearly. And I am not very good with English either. Timer runs slowly means that it runs slower than system clock. When you compare 10 seconds on the timer and 10 seconds on the clock, you will find that the timer’s 10 seconds last longer compared to 10 seconds on the clock. So, the timer ticks are lagging behind the clock ticks.

I didn’t post blocks because, maybe due to my non-existent programming skills, the blocks are all over the place and the program more than fills my entire screen, when I try to make the letters visible. And I thought there could be a more general answer to the problems. But I guess I could be wrong. And I will check out the app resume blocks, as you suggested. Thank you.

1 Like

Is there anyway I can prevent the eventual reset of the app in the background and retain my created dynamic card views? Or does this deserve a new topic?

Dynamic UI elements are not permanent. It only appears when it’s programmed to do so and will disappear when closed.

2 Likes

Bummer… but I got my answer. Thank you.

1 Like

What is it? Would you mind not sharing it here?

The answer I meant was as Joseph222 suggested in the quote above.

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