Issue
is there a way to make the user add just one item per day, then get an alert saying "only one time a day"
what to use, coroutine, tasktimer, work manger ?
Solution
I will try and give a general answer. Usually when it comes to such requirements it is good to compare the date and time of the last item that was created and the current date and time. That means you would need to store the item in a database.
The reason I'm suggesting such an approach is because a user might close your app, or the OS might put it to sleep / terminate it and all of your tasks and timers might be stopped. By having it persisted in a DB, you can always be sure your requirements are met.
For example if the requirement is 24 hours or perhaps just a calendar day (after midnight), then you would do the comparison and know if they have been met and allow the creation of new items, or not.
Additionally, it's always good to try and experiment at first. See what works and what doesn't before asking your question. Good luck.
Answered By - Filip Petrovski
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.