Android still has no control with hardware buttons?

So i have searched in the forums and seen in the past that corona cannot communicate with the hardware buttons on android phones, i just wanted to double check and see if that is still the case? If that is the case, im wondering if there is any possibility of disabling the “back” button. Because with the way things currently are when people push the back button or the home button, it just exits the app completely. Any info would be great thanks [import]uid: 19620 topic_id: 13361 reply_id: 313361[/import]

The newest release of Corona “does” support the Android buttons via “key” events. Please see sample app “Hardware\KeyEvents” included in the Corona SDK.

Here is the API documentation…
http://developer.anscamobile.com/reference/index/events/key
[import]uid: 32256 topic_id: 13361 reply_id: 49025[/import]

glad to hear it, thank you for the quick response [import]uid: 19620 topic_id: 13361 reply_id: 49027[/import]

So here is my code,

[lua]local function onKeyEvent( event )
local returnValue = true

local phase = event.phase
if phase == “back” then
audio.play(clickSound)
end
return returnValue
end

Runtime:addEventListener( “key”, onKeyEvent )[/lua]

so now when i run it on the device, it doesnt kick me out of the game when i touch the hardware keys but it doesnt play the sound like i ask it to either. what am i doing wrong here? [import]uid: 19620 topic_id: 13361 reply_id: 49043[/import]

nevermind i figured out what i was doing wrong, i was telling it to give me the phase rather than what button was pressed, this is how you can get both the phase and the keypress

[lua]local function onKeyEvent( event )
local returnValue = true

local phase = event.phase
local whatKey = event.keyName
if whatKey == “back” and phase == “down” then
audio.play(clickSound)
return returnValue
end

Runtime:addEventListener( “key”, onKeyEvent )[/lua] [import]uid: 19620 topic_id: 13361 reply_id: 49049[/import]

Great! I’m glad it’s working for you! [import]uid: 32256 topic_id: 13361 reply_id: 49070[/import]