简体   繁体   中英

Android - Unlock A Button Every X hours

I Want to every time A user Clicks Some Button, The Button Deactivate For X hours, How Can I Do this?

if i just get the current time and next time from android device the user can cheat.

you can get the current time from API. TimezoneDb provides a free API:

When you wanna deactivate the button.
1) call the api get the time.
2) calculate the deactivation time by adding X hours.
3) save the time in shared Pref or db.

for activating it again
1) call api get the time.
2) compare time with saved time.

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