How to increase my coin price every 24hrs weather the app is open or closed?

Hello, I am creating an app where my digital coin price increases every 24hrs weather the app is open or closed, but my coin price should keep increasing by some amount (for example 0.21 every 24hrs) the increased price should be stored in the firebase & when the user opens the app they should see the latest price of the coin. please help me how to code the blocks without any extensions. thanks in advance.

You do not need an online database for this
Just store the start day and start value in TinyDB
In Screen Initialze do a calculation like this
Determine the number of days from start day to today and calculate the current coin price, which is start value + 0.21 * number of days

Taifun

1 Like

Thanks for the response, please can you show me the block image for the reference so that I can do it at once without any mistake. actually I am still learning while doing, it would be of great help.

Great
If you do something yourself you learn the most
Just try something yourself and if you got stuck, then provide a screenshot of your relevant blocks

Taifun

Hello, I tried this way


but the result is weird, its calculating the Coin value also for 13 days. I just want the increased value to be added to the Coin value.

store the start day in milliseconds, this makes it easier to calculate the number of days between today and the start day

how did you calculate global Days?
the Clock component offers methods for this

Taifun

I found the solution. downloaded the extension called datetool.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.