Tamagotchi time and save when app is closed

Hi i’ve an app similar to Tamagotchi , I set the time with that of the bios of the computer.
The problem is that when I go out of the app it has to keep working otherwise my variables remain freeze and do not continue to change along with time.

Any suggestions?

Thanks

Assuming you’re doing this for desktop I can think of two possibilities.

  • One you don’t close the application, keep it running in the background so you can still keep track of time.
  • The other one would be storing the times you want in files and when opening the application again you’d have to verify the values and apply your logic.

Otherwise, If your application is intended to run on Android/iOS you can also schedule notifications for the operational system.

Yes is for mobile device.

For you it’s better to leave the app in Stand-bye so that it continues to work or that I leave the chance to save (with playerpref) and then when it open after load checks how much time has passed and updates the variables?

thk you