I want to make it so that after logging in to the game, the player can collect e.g. gold coins that were collected when the game was turned off on the phone
What is the expected result
After starting the game, information should appear about how long he was unavailable in the game and how much gold he managed to collect. To make it easier, let the player receive one gold coin for every minute outside the game
What is the actual result
If the player has been out of the game for at least one minute, no message is displayed
You’ll need to store the time the player left the game into local storage. Read in this time when the game starts and work out how many minutes difference.
Will this procedure be resistant to artificial changes in the time or date on the phone, which would make it seem that more time has passed than it actually did?
I don’t think so. But you have to ask yourself, how many people will play the game and fiddle with the device’s time settings just to get more of a bonus?