How to know when the game is closed or in background

Hello,

I was wondering what was the best way to check the time between two game sessions, typically for an idle game.

I imagine I can store the time on an event like OnApplicationClosed and compare with the one at the start of the app but I don’t know if it’s the proper way to do it.

Thank you,

Nicolas LP

Yep, pretty much it. You’ll need a way to record time when closed/put in background and then calculate an amount when the app is back up again.

2 Likes