I'm wondering if there is any way to harness the device clock to determine how much time has passed between making an app inactive and then active again.
I was able to make an app keep track of the amount of time between closing/quitting an app and opening it again, and I can certainly track time while an app is active (every 1 second, add 1 second to game.timer), but when I switch apps and come back to the app, I can't figure out a way to keep track of the time that has passed. I can't use a timer because the app isn't active (in the foreground) and when I switch back to the app, my rules don't re-trigger because they've already run.
Am I out of luck?
I tried a simple test:
Change Attribute game.deviceMinutes (real) to game.Clock.Minute
DisplayText game.deviceMinutes --> works "once" when the app is first launched but does not update again until the app has been force-quit and re-opened.
DisplayText game.Clock.Minute --> always shows the current minute of the device's internal clock
Both of those DisplayText behaviors work as I would expect in the iOS Viewer (they both update when the app is made active).
Attached is the very simple project file I used to test this after I figured out what the issue was.
I was able to make an app keep track of the amount of time between closing/quitting an app and opening it again, and I can certainly track time while an app is active (every 1 second, add 1 second to game.timer), but when I switch apps and come back to the app, I can't figure out a way to keep track of the time that has passed. I can't use a timer because the app isn't active (in the foreground) and when I switch back to the app, my rules don't re-trigger because they've already run.
Am I out of luck?
I tried a simple test:
Change Attribute game.deviceMinutes (real) to game.Clock.Minute
DisplayText game.deviceMinutes --> works "once" when the app is first launched but does not update again until the app has been force-quit and re-opened.
DisplayText game.Clock.Minute --> always shows the current minute of the device's internal clock
Both of those DisplayText behaviors work as I would expect in the iOS Viewer (they both update when the app is made active).
Attached is the very simple project file I used to test this after I figured out what the issue was.