Save variables (tinyDB) at shut-down?

Hi,
There are 18 variables in my app which I am saving for the next app start-up. They are (list) saved and (list) restored by TinyDB. Works OK.

Each time I am changing a frontend parameter (slider or button) all 18 variables are saved. A bit of too much overhead I think.

Better is to save all variables at shut-down (last situation). I did take a look at the ActivityLifecycle extension but I do not know if this is suitable.

please advise.

Henk Wijtman
Rotterdam

I prefer a different approach.

I keep a separate tag/value for each datum, and load and save immediately, deferring nothing.