Storyboard API and applicationSuspend/resume - HowTo?

For my game I am using the storyboard API. So far I have implemented a splash scene and the main game scene. (main.lua calls scene in splash.lua, splash scene calls game scene in game.lua)

Now I wonder how to handle the applicationSuspend and applicationResume events the right way. I had a look at the docs, the API references and some of the not very detailed examples.

The examples I found are either showing a placeholder comment or just print out some values (event.name).

How do I get back to the game.lua scene with all graphics and objects in place where they where before?
Where should I place the listeners for these system events? In main.lua or game.lua?

Are there any tutorials or code examples I missed?

Thank you! [import]uid: 96902 topic_id: 18824 reply_id: 318824[/import]

Put this line in build.settings plist;

[lua]UIApplicationExitsOnSuspend = false[/lua]

When you resume the app it will be as you left it.

Peach :slight_smile: [import]uid: 52491 topic_id: 18824 reply_id: 72600[/import]

Hi Peach,

that was the missing piece of my puzzle! Almost too easy! %-)
Thank you very much!

One more question: Using this setting is there any reason to store stage stage data in a file while catching the applicationSuspend event and loading it again when receiving the applicationResume?

Jens [import]uid: 96902 topic_id: 18824 reply_id: 72631[/import]

Hey,

No worries at all.

Unless you are giving the user an option to save their game and resume where they left off after a full quit (not just a suspend) then no, this should do the trick. (I’ve used it in several apps, it hasn’t failed me yet!)

Peach :slight_smile: [import]uid: 52491 topic_id: 18824 reply_id: 72653[/import]

Thanks again, Peach! :slight_smile: [import]uid: 96902 topic_id: 18824 reply_id: 72657[/import]