Androizing your mobile app - Moving to composer

Hi,

I was reading this very nice article (https://coronalabs.com/blog/2013/03/26/androidizing-your-mobile-app/) and noticed that is wrote for the old ‘storyboard’ but now corona has migrate to ‘composer’. I’m new using corona and I have to ask for the equivalent code for Android Key Processing but using composer. 

Could any one please help me? Thanks in advance.

You can use the Storyboard to Composer migration guide to update the code from that blog post:

https://docs.coronalabs.com/api/library/composer/migration.html

This is a pretty simple version:

local function onKeyEvent( event )     local phase = event.phase     local keyName = event.keyName     print( event.phase, event.keyName )     if ( "back" == keyName and phase == "up" ) then         if ( composer.getSceneName( "current" ) == "menu" ) then             native.requestExit()         else             if ( composer.isOverlay ) then                 composer.hideOverlay()             else                 composer.gotoScene( "menu", { effect="crossFade", time=500 } )             end         end         return true     end     return false end Runtime:addEventListener( "key", onKeyEvent )

Great info!! Thanks !!

You can use the Storyboard to Composer migration guide to update the code from that blog post:

https://docs.coronalabs.com/api/library/composer/migration.html

This is a pretty simple version:

local function onKeyEvent( event )     local phase = event.phase     local keyName = event.keyName     print( event.phase, event.keyName )     if ( "back" == keyName and phase == "up" ) then         if ( composer.getSceneName( "current" ) == "menu" ) then             native.requestExit()         else             if ( composer.isOverlay ) then                 composer.hideOverlay()             else                 composer.gotoScene( "menu", { effect="crossFade", time=500 } )             end         end         return true     end     return false end Runtime:addEventListener( "key", onKeyEvent )

Great info!! Thanks !!