简体   繁体   中英

Is it possible to run a method only if it has not yet been run on the current day?

I am currently working on a project that makes API calls to get data on release dates for movies. Currently, every time I load up an activity, I loop through the release dates saved on the device, and make several API calls to compare the data on the device to the data that the API returns. However, because I am dealing with "release dates," running this check a single time per day would be more than enough. Now here is the catch: This activity can be opened and closed several times by the user per day! So my question is: Is there some way to check and ensure that a method is only executed if it has NOT yet been executed on the current day?

并非没有某种后备存储,例如,一个文件或数据库表可以告诉您最近的运行时间。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM