I want to clear the values in a Tag in tinydb when my application closes.
So I call Tinydb.ClearTag when the event occurs. Eg. when.CloseButton.click Call TinyDb.ClearTag. And this works fine.
However, here is my problem/
If the user closes the app, without using the CloseButton in my app.
i.e if the user closes the app from the android phone... then I didnt clear my tag and then my app does not work.
I cannot Clear the Tag at screen.initialize because i am adding another value to the same tag when screen.initialize
is there a when app closed block?? or any other way to ensure that the tag is cleared even if the app is closed "externally"
This is a simplified view of the problem I want to solve. In screen 3, when I close it with back.pressed or closeButton, i am restoring x to 0.
But if user closed the app from the phone, then is there a way to still make x=0 any other idea? If there was a when app.closed block then that would have solved my problem.
when the app opens, i need to check if x=o or 1. and it has tasks in each case.
The first image, upper image is from screen 3.
The second image (the one which is down ) is from the screen 4
This block can delete all existing tags in tinydb :
This block can delete 1 tag that you want :
This block can delete 1 tag that you want too, but this block checks if the value is there or not, so if the value exists it means it will delete the tag :
You want to clear all tags when the app is closed. This implies that when the app is opened, there should be no values tagged in the tinyDb. So Clear all Tags when Screen1 Intialises.
But the app is not "closed", necessarily, when the users leaves the app via the back or home button, it can still be opened where it was "left" using the Overview/Recent button.
I wrote an app a while back that called in/used very sensitive data, I could not trust the users to properly exit the app, therefore as soon as the app was "paused" all the data was cleared/deleted, app more or less restarted, and requiring a new login.
ActivitiyStateChanged is exactly the stuff I needed. It works and feels like magic . Woow. Thank you. Thank you. Thank you.
Many bows to you for making it.