how to detect user tap the "return" on Android Phone

how to detect user tap the “return” on Android Phone [import]uid: 22631 topic_id: 21793 reply_id: 321793[/import]

Here’s my code:

function androidBackButton(event)  
 if(event.keyName == "back") then  
 if(event.phase == "up") then  
 functionWeRunOnBackButtonPress()  
 end  
 return true   
 end  
end  
  
---  
-- This check is only necessary if your code is meant to run on both Android an iOS  
---  
if(system.getInfo("platformName") == "Android") then  
 Runtime:addEventListener( "key", androidBackButton)  
end  

You can find more documentation in the API section “Events” -> “key” [import]uid: 65996 topic_id: 21793 reply_id: 86527[/import]

hi simon, thanks so much!
the forum is helpful for me as a new corona beginner! [import]uid: 22631 topic_id: 21793 reply_id: 86529[/import]