How to disable button 12 hours after click

Hello everyone I want to disable a button 12 hours after click using internet time


I want to disable quiz button

See here

You can cotrol your any button to clickable and non clickable by using firebase database.

For that, in your firebase database create a bucket, tag and set value “false” (text)

(Fill all firebase properties. Like bucket, tag, url, api key)

In your app set blocks firebase get value on screen initialize.

When firebase got value use if then condition:

If get value is equal to “false” (text)
Then set button clickable to false
Else set button clickable to true.

Whenever you want to disable the button set your firebase value to false and if you want to re enable it then change value to true.

Now its totally in your hand, when you want to enable disable it, change firebase value and thats it. All happens in the app.

1 Like

Simplest way to do this would be to calculate (in milliseconds) what time it would be when the button will be disabled. Store the amount of milliseconds. When the user enters the app again, check if the amount of milliseconds 12 hours after the button was clicked is smaller than the current amount of milliseconds.

2 Likes

You can use my countdown extension. It provides the block to get current time from the internet and also you can display the countdown if you want. You just have to input end date. Read more about the extension here: