On latest versions, the back key event has problems.
code is
function onKeyEventDirections( event ) print('onKeyEventDirections') local phase = event.phase local keyName = event.keyName dump('',event,5) if phase == "up" and keyName == "back" then print 'directions key event' local alert = native.showAlert( "Do you wish to quit?", "", { "Yes", "No" }, onExitD) return true end return false end function onExitD( e ) print('onExit') if "clicked" == e.action then local i = e.index if 1 == i then Runtime:removeEventListener( "key", onKeyEventDirections ) print('yes exit') native.requestExit() -- forces app to exit Android only return false elseif 2 == i then print 'cancel exit' end end print ('on exit end') return false end Runtime:addEventListener( "key", onKeyEventDirections )
This works fine in version 1082, but not in version 1139.
Basically, hitting the back key just quits the app in version 1139, without calling onKeyEventDirections. In version 1082, function onKeyEventDirections is always called.
In another part of the code, we have another back key event that is working fine in version 1139, so its not like the functionality is totally gone
Is there anything wrong with the code above?
Has anyone else noticed this?