onKeyDown

open override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean

Immersive messages can alternatively be closed by the back button.

Return

If the button pressed was the back button, close the in-app message and return true to indicate that the event was handled.