I will make the user see the advertisement video. Click the ad every 4 hours to get an item. So I set the timer to 4 hours. I want to watch the advertisement video when the advertisement button is clicked, and to turn on the timer when the advertisement video ends. Advertisements cannot be clicked again while the timer is on. After 4 hours, I want to activate the advertisement button again. What should I do?
In your Button Click
block first check if the timer is enabled. If this is true do not start the video and you may display message to the user.
If the timer is not enabled then show the video. After the video is finished, enable the timer.
This is the basic logic that should do what you described.
Can I do this? After the user sees the ad, a timer is triggered. In the advertisement screen, there is a variable for whether the timer works. When the timer works, the message that there are no ads and the button to see ads are removed. If the timer is not running, a message is written that an advertisement can be viewed and the advertisement button is activated.
In this case, the timer is automatically reset when you turn off the app. How can I keep the timer saved even when the app is turned off and on?
When the user views an ad, set stored variable startTime to seconds since 1970.
When user attempts to view an ad, if seconds since 1970 ≥ startTime + 14400 then allow them to watch the ad.
The number of seconds in 4 hours is 4 * 60 * 60 = 14400.
I want it as a picture. I’m just confused by the article.
Here you go:
If you want to try it out, see the screen with your username in this project:
https://x.thunkable.com/copy/5db904f6b32ab3f07250d282207fb7a0
I recommend using a small value for “seconds to wait” so you’re not having to wait four hours.
https://x.thunkable.com/projectPage/6228de0d46aaf70012429d19
See this demo using 120 seconds to see results when you try it.
Basically the same design as @tatiang
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.