Is it possible to make the game run in background on android?
**for example: when i open the game, my score are “0” iam start a mission and every hour i will get score “100”, but when phone turn off, score still runing 100 point per hours
i try it, but when i goes back to game, score restars to zero,
Thanks for helping me.
I think this is possible, I don’t have direct way about how you can do it but there’s two event that might help you (I found them in GameInstance):
they may help you.
that doesn’t do anything to keep the app running while in the background
we need a fix Epic this is very important Epic
Maybe not WRT keeping game running in background no, but if you’re just adding some periodically generated resources, can you not dump a
timeMovedToBackground, then on opening the app, do
resource += generationRate * (timeNow - timeMovedToBackground? Simplified code, but you should get the gist of it.
No, not quite. If you are actually an intelligent programmer and the point is to cause an actual time delay, you sync to an online server for the time.
Otherwise it takes less than a second to change the device time.
Generally speaking Android OS will disable apps from doing anything the moment they are closed - but nothing stops you from creating a service to deal with notifications and time management.