Would like to resume my App state on App restart

In Kodular, there is such a thing as “On App Resume”. Is there such a thing as “on restart” or “on Start” like in the picture above? I need this because Android kills apps in the background. And “On Restart” (Not just App Resume" I need my timer to start running.

1 Like

You could use “Timer Always Fires” feature to ensure that your timer is running even when your app is minimized or running in the background.

As an alternative, you could try storing the state of your system in a Firebase DB in regular intervals, obtain the latest state when the user opens the app again, and sync the data to resume from where the user paused.

1 Like

I see… What’s the difference between firebase and TinyDB?

Well Firebase is an online database, while TinyDB is a local storage. The contents of TinyDB is lost when the user clears the app data in Android Settings. However, Firebase being an online DB stores the data in the cloud and the data is not easily lost. Also Firebase offers better authentication when compared to Tiny DB.

TL;DR If you want to store data locally use TinyDB. You want to store data online use Firebase DB

1 Like

I see. Thank you. I will attempt that.

I think simply killing the app from background may not result in loss of TinyDB data. The TinyDB data is only lost when the user clears the app data or we can say resets the app data.

2 Likes

That is wrong. TinyDB is only erased when doing it with the ClearTag block or when erasing the app’s data in Android settings.

1 Like

Are you sure about this?
.
The site was on read only mode so the reply posted lately

There’s an easier way to do this. Since Kodular apps can’t run in the background, there’s no way to keep a timer running. Instead you only need to save in TinyDB the starting time and have clock running while the app is active, checking if the time passed since the starting is the time we want.

1 Like

Just verified TinyDB storage property and what @Italo and @Vaibhav mentioned is true. I have made the changes in my answer. Thanks for pointing it out.

1 Like

Where did you get the info that TinyDB would be erased? I see you are a new user. It is ok if you want to help here and give answers but make sure you try to give the right ones. Changing you previous post this late in the discussion makes the whole topic very odd to read.

3 Likes

Hey Guys, Thank you so much for helping out. I am doing something else right now, And want to take my mind off this project for at least a few hours. It’s been taxing for the mind for a newbie like me. I will give a follow up post once I did at least some of your suggestions and see how they work. And Again Thank you so much.

Hey Peter,

I had been a user of Thunkable for the past 4 years and have implemented TinyDB in many of my apps. I was under the impression that killing the app in the background deletes the data maybe cause I had particularly programmed my apps in that way. Also like the others mentioned the community was in read only mode for some time and I was able to edit the post only after the community was restored to its normal state.

I do apologise for the late changes though. Will ensure that I double check before I answer next time.

Regards

1 Like