I was hoping someone might enlighten me why suspending an app in the simulator functions differently than if you suspend it in hardware? For example, if I suspend a game in the simulator it pauses the game as if frozen on an individual frame and picks up straight from there. If I suspend the project on my iPhone3GS by “home buttoning” out of it, the game resumes from it’s base state. Am I doing something different than suspending it in that case? I was under the impression that would suspend the game. I am on an old iOS so maybe that has to do with it?
The interesting thing about the suspend on hardware is that although it “restarts” the game from it’s base state rather than freezing it like it does in the simulator, it restarts with the x and y values initially assigned to my testObject rectangles.
So I guess I’m trying to understand how applicationSuspend and Resume really work and why there’s an inconsistency between my app in the simulator and on hardware.
Thanks! 
(I’m working on the following to test my ability to save and load the state of a game. Clearly I’ve not actually fleshed out my game state functions!)
[lua]-----------------------------------------------------------------------------------------
– main.lua
–
local moveAmount = 5
local dwidth = display.contentWidth
local testObject = {}
local function makeNewObjects( num )
– body
local number
if num ~= nil then
number = num
else
number = 3
end
for i = 1, number do
testObject[i] = display.newRect(math.random(32, 480 - 32), math.random(32, 320 - 32), 32, 32)
end
end
makeNewObjects()
local function moveObject( … )
– body
for i = 1, #testObject do
testObject[i].x = testObject[i].x + moveAmount
if testObject[i].x > dwidth then
testObject[i].x = testObject[i].x - dwidth
end
end
end
Runtime:addEventListener(“enterFrame”, moveObject)
local function save_state( … )
– body
print(“save_state called”)
end
local function load_saved_state( … )
– body
print(“load_saved_state called”)
end
local function pause_game( … )
– body
print(“pause_game called”)
end
local function resume_game( … )
– body
print(“resume_game called”)
end
local function onSystemEvent( event )
if (event.type == “applicationExit”) then
save_state()
elseif (event.type == “applicationOpen”) then
load_saved_state()
elseif (event.type == “applicationSuspend”) then
pause_game()
elseif (event.type == “applicationResume”) then
resume_game()
end
end
Runtime:addEventListener( “system”, onSystemEvent )[/lua] [import]uid: 105707 topic_id: 29389 reply_id: 329389[/import]