Tracking total play time
The Glessnerd
Member Posts: 65
What would be the easiest method to track a players total play time (or time while the app is open) that can be presented in the form of a stats page? Thanks
Comments
game.time will return the game time in seconds, that is time that the app is spent active.
devices.clock.epochTime can be used to track time since first opening the app -- this tells you the elapsed time since Jan 1,1970. You can do some math using different time stamps to pull off things, like if you want a button to work once every real-time 24 hours, for example.
FYI, epochTime is only available i the HTML5 engine for now. We'll add it to the native engine soon, but it's a bit harder.
The way people currently deal with it is to use a server to get the current time and then use the game.time to count up since then.
You also have some external options. You can use Tapjoy through the iron source mediation to display alerts at certain intervals based on session length. You can also use one of many external connection options to accomplish this. If you let me know what you want to show maybe I can help you.