Can Corona detect that the iPhone locked while app was open?

My app does real time inventory but if the user leaves the app active and the iPhone locks it’s in an unknown state when he/she unlocks the iPhone, as far as the user is concerned.

I either have to time out the app, assuming the app would keep running after the iPhone locks, I.e. put to a just opened equivalent state or if I can tell that the iPhone was just unlocked I can do a reset to known state based on that.

Last alternative is a restart button for the user to press, but since that requires some smarts on the users side, it’ll be missed and therefore least favourite option :slight_smile:

Open to any/all suggestions.

TIA [import]uid: 6547 topic_id: 1472 reply_id: 301472[/import]

There is a “system” runtime event that indicates “applicationStart”, “applicationExit”, “applicationSuspend”, and “applicationResume” [import]uid: 7559 topic_id: 1472 reply_id: 4106[/import]

Thank you.
Any hints on where to find a sampling?

Going searching :slight_smile:
[import]uid: 6547 topic_id: 1472 reply_id: 4108[/import]

Try this:

local function systemMsg(event)  
  
 print( "System event: " .. event.type )  
  
end  
  
Runtime:addEventListener( "system", systemMsg );  

You can use the Simulator to Suspend/Resume your app and view the messages in the Terminal. It also shows the app starting and exiting. [import]uid: 7559 topic_id: 1472 reply_id: 4110[/import]

Thank you Tom.

Heinz [import]uid: 6547 topic_id: 1472 reply_id: 4111[/import]