Amazon App Store rejection for Suspend/Resume

Just had my app rejected from Amazon App Store - reason being:

"Pressing the power button and invoking sleep mode while in game play will cause a loss of user state. When the user returns to the game from sleep mode the user is prompted with a loading screen and then is taken to the main menu. All progress has been lost."

My experience testing on various phones/tablets seems to indicate that some devices will "kill" your app when the device sleeps, thus requiring a reload, while others will just suspend it and the app works fine when you turn it back on.

I'm assuming the smartest way to deal with this is to save all game state data to a text file during the applicationExit and applicationSuspend routines and then force a reload of everything during resume/load - but I'm wondering if anyone has any feedback/advice.

thanks!

Hi,

i have submitted my app for 4 days... so after i have read your post, i think my app will be rejected too :-)

here are some advice i've found..
http://developer.anscamobile.com/forum/2011/10/29/how-pause-game

I need to implement it too..

You should be saving your game data when your app is "suspended", but you should NOT restore your game data when your app is "resumed". This is because your app is still loaded in memory when suspended. Instead, restore your game data on app startup.

For saving your game data, I recommend saving all "state" variables into a table, encoding that table into a JSON string, saving the string to a text file.

When you're ready to restore (on app startup as Josh mentioned), you simply load the text file contents into a variable, and decode the JSON into to a Lua table and work with your data from there.

Here's a tutorial for easily using JSON with Corona:
http://blog.anscamobile.com/2011/08/tutorial-exploring-json-usage-in-corona/

views:1510 update:2011/11/5 17:18:39
corona forums © 2003-2011