Hi team,
i am struggling with following code… not sure why is not working in the real device and working fine in simulator when i change “back” to “b” for testing :
[lua]
function onKeyEvent( event )
local phase = event.phase
local keyName = event.keyName
print( event.phase, event.keyName )
if ( “back” == keyName ) then
Runtime:removeEventListener( “key”, onKeyEvent )
print(“current scene is”, composer.getSceneName( “current” ))
if ( composer.getSceneName( “current” ) == “levels” ) then
native.requestExit()
else
restartGame()
end
end
end
Runtime:addEventListener( “key”, onKeyEvent )
[/lua]
any idea?
regards
Abdul