onBackPressed never called

Been looking for a definitive answer, although the code pretty much answers my question.

Does Unity consume the back button and not filter it down to the native Java if you’ve extended the Unity Activity?

I’ve tried onKeyDown as well onBackPressed and neither ever gets called.

I know that I can capture the event in C# and then find my class and call onBackPressed myself, but that seems clunky when it’s a system button.

And if this is the behavior for the back button why is it not documented?

I think it may be possible that Unity’s activity is capturing any key events and not propogating them any further.

You need to check to see if the escape key has been pressed. In Unity, pressing the back button triggers the escape key.

if (Input.GetKeyDown(KeyCode.Escape))
{
//Your code here
}