Hi,
How to make the automatic logout timer keep running even when the application is closed
PS: Storage TinyDB
Hi,
How to make the automatic logout timer keep running even when the application is closed
PS: Storage TinyDB
You would probably need a background or foreground service for this:
What exactly is this?
At logout store the current time in TinyDB and next time you start rhe app calculate the elapsed time
Taifun
Hi, TIMAI2
Thanks for your response
Could you provide some guidance on using this extension?
I've imported it into my project
I also included my block project
And what i want is the timer to start running after the user logs in and ends 3 days later (259200000 ms).
The timer continues to run, even if the application is closed.
Please...I reallyhope for your help
Thanks n Regards
The simple approach is,
When iser sign up,
Save the time in millis in tinydb and date of sign up using any tag name say login
During screen initialization check the length of this tag length and use the if logics.
If the length is 2
Imagine used alredy signup.
Get the first item from this list (millis)
Again use one more if logic
If difference between saved milli (2nd item) and current milli is greater than equal to 259200000 (3 days)
Then user exceeds 3 days so save the milli as 0 in the first item and proceed to login page
Else user is less than 3 days so continue to user to open the logged in page.
Remember : if user clears app data then all will be reset.