Runtime:addEventListener can't run

I want to give a note when I press the home key,but the follow code can’t do anythong

–Handle the applicationExit event to close the db
local function onCloseApp()

end

local function onSystemEvent( event )
if( event.type == “applicationExit” ) then
native.showAlert( “note”, “app will exit”, { “ok” } )
end
end

–setup the system listener to catch applicationExit
Runtime:addEventListener( “system”, onSystemEvent ) [import]uid: 29364 topic_id: 12136 reply_id: 312136[/import]

You cannot show a note when the home button is pressed; this isn’t a Corona limitation but an Apple one.

The home button closes (or really, minimizes) the app - it stops sound, notifications, everything - instantly.

Typically you’d use it only to write data to a file.

Also, please post your codes in Lua tags.

Hope that helps,
Peach :slight_smile: [import]uid: 52491 topic_id: 12136 reply_id: 44184[/import]

thank you peach, my dear you are [import]uid: 29364 topic_id: 12136 reply_id: 44282[/import]