[英]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? 我想每次用户单击某个按钮时,该按钮停用X个小时,我该怎么做?
if i just get the current time and next time from android device the user can cheat. 如果我只是从android设备获取当前时间和下一次用户可以作弊。
you can get the current time from API. 您可以从API获取当前时间。 TimezoneDb provides a free API:
TimezoneDb提供了免费的API:
When you wanna deactivate the button. 当您想停用按钮时。
1) call the api get the time. 1)调用api获取时间。
2) calculate the deactivation time by adding X hours. 2)通过添加X小时来计算停用时间。
3) save the time in shared Pref or db. 3)将时间保存在共享的Pref或db中。
for activating it again 再次激活它
1) call api get the time. 1)调用api获取时间。
2) compare time with saved time. 2)比较时间与节省的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.