Mining app system

Hello,I want to make an application where there were a target number and a available Claim balance.
It will be increase upto target amount even the user ofline or exit app.and when it will 5000/5000 it will automatically off.and when user claim it click on a button it be increase again upto target.

Screenshot_2024-07-15-00-46-43-49_5f48d69e3d30a093162f7e0ee7d45862

1 Like

To create this application in Kodular, you’ll need to manage a few components and logic blocks. Here’s a step-by-step guide:

Components Needed:

  1. TinyDB: To store the claim balance persistently.
  2. Clock: To update the claim balance periodically.
  3. Button: To allow the user to claim the balance.
  4. Label: To display the current claim balance and the target balance.

Steps:

  1. Initialize Components:

    • Add a TinyDB component to store the claim balance.
    • Add a Clock component and set its TimerInterval to a suitable value (e.g., 1000 ms for 1 second).
    • Add a Button for claiming the balance.
    • Add a Label to display the claim balance and target balance.
  2. Initialize Variables:

    • Create a variable for the target balance (e.g., targetBalance set to 5000).
    • Create a variable for the current claim balance (e.g., claimBalance).
  3. Screen Initialization:

    • On the screen initialization event, load the claim balance from TinyDB.
    • If no value is found in TinyDB, initialize claimBalance to 0.
  4. Clock Timer Event:

    • In the Clock’s Timer event, increment the claim balance by a certain amount (e.g., 1).
    • Check if the claim balance has reached the target balance.
    • If it has, stop the clock and update the label to indicate the balance is ready to claim.
  5. Claim Button Click Event:

    • When the user clicks the claim button, reset the claim balance to 0.
    • Start the clock again to continue incrementing the balance.
    • Save the new claim balance to TinyDB.

Example Blocks:

Screen Initialization

when Screen1.Initialize
  set global claimBalance to call TinyDB1.GetValue tag "claimBalance" valueIfTagNotThere 0
  call Clock1.TimerEnabled to true
  call Label1.Text to join "Balance: " global claimBalance " / " global targetBalance

Clock Timer Event

when Clock1.Timer
  if global claimBalance < global targetBalance then
    set global claimBalance to global claimBalance + 1
    call TinyDB1.StoreValue tag "claimBalance" value global claimBalance
    call Label1.Text to join "Balance: " global claimBalance " / " global targetBalance
  else
    call Clock1.TimerEnabled to false
    call Label1.Text to "Balance: 5000 / 5000 (Ready to claim)"

Claim Button Click Event

when Button1.Click
  set global claimBalance to 0
  call TinyDB1.StoreValue tag "claimBalance" value 0
  call Clock1.TimerEnabled to true
  call Label1.Text to join "Balance: " global claimBalance " / " global targetBalance

Summary:

This setup ensures that the claim balance increments up to the target amount even if the user is offline or exits the app. Once the balance reaches the target, it stops incrementing until the user claims it. After claiming, the balance starts incrementing again.

Feel free to modify the intervals and increment values according to your application’s requirements.

It’s chatgpt answer :woozy_face:

It does not work when the app is exited or offline.Here is my Blocks…
Can anyone help me Please :unamused: :smiling_face_with_tear: :pray:
blocks
blocks (1)
blocks (2)

are you trying to build hamster combact?

No,but I need same Process

They use server based techniques for adding coin

you might need to use this extensiom for offline counting

I need counting even offline.
Can you send me the block using the extension you reffed.

i will build a similiar project please wait

Try using start time and current calculate

mining_app (10).apk (4.4 MB)
Is this what you meant?

If you need I will sent an advanced version soon

Can you please try this
mining_app (16).apk (6.4 MB)

please give me a aia filw