I'd like to disable android screentouched keyevents and systemevents from buttons in corona sdk: home button, screenshot and recently opened applications, so that they don't work at all in the application, and the application cannot get suspended ever.

2

There are 2 answers

0
Jordan Schuetz On

You can't disable the home button in any Android or iOS applications.

Here is how you would control those key events, but I'm not sure you can disable them:

-- Called when a key event has been received.
local function onKeyEvent( event )
    -- Print which key was pressed down/up to the log.
    local message = "Key '" .. event.keyName .. "' was pressed " .. event.phase
    print( message )

    -- If the "back" key was pressed on Android, then prevent it from backing out of your app.
    if (event.keyName == "back") and (system.getInfo("platformName") == "Android") then
        return true
    end

    -- Return false to indicate that this app is *not* overriding the received key.
    -- This lets the operating system execute its default handling of this key.
    return false
end

-- Add the key event listener.
Runtime:addEventListener( "key", onKeyEvent );
0
Rob Miracle On

Adding on to what Ninja Pig Studio's said, the recently opened apps button cannot be trapped either. Those are handled by the OS and about the only key buttons your app gets is the Back button and the Volume Up/Down buttons.