how to check app open/close

CaptainChocoCaptainChoco Member, BASIC Posts: 124

Hello
I want to make an event which starts when the app is closed(or sleep mode...) to give the offline-rewards to the player.
Is there any way to check those states???

For now, I'm trying to save the event-start time and event-end time...

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    No. You can determine when the app has been re-opened but not when it has been closed/slept.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • CaptainChocoCaptainChoco Member, BASIC Posts: 124

    Thanks~! I'd better change the logic. :D :D

  • ArmellineArmelline Member, PRO Posts: 5,354
    edited March 2018

    You can keep a record every second of the number of seconds since a specific date. Then when the app is closed and reopened, you can compare the recorded value to the current number of seconds since that specific date. This tells you how long the app was closed - and also, effectively, when it was closed.

    I have a template on GSHelper (though GSHelper seems to be down atm) that does this, but be warned that implementing this kind of logic project wide isn't easy!

Sign In or Register to comment.