In the standard Corona docs, the sample code to detect the back key on Android seems to have a couple of flaws. Here’s the sample code:
if ( event.keyName == "back" ) then if ( system.getInfo("platform") == "Android" ) then return true end end return false
It doesn’t test for event.phase=“up”, and it tests for platform (which seems un-necessary) but it looks for “Android” instead of “android”. This code works:
if (event.keyName=="back") and (event.phase=="up") then if (system.getInfo("platform")=="android") then --do something return true end end return false
These are minor bugs, but it’s hard for me to believe that they have gone undetected. So can anyone tell me: is there a “better” version of the documentation that I have not found yet? Or does the original code work in some context?? Thanks.