Search code examples
androidandroid-10.0

Does the new Android 10 gesture for BACK trigger onKeyDown?


Android 10 has added this gesture navigation where you can go back by swiping from either the left or right edge of the screen.

Will this gesture trigger onKeyDown() just like when back is pressed on the traditional navigation bar?


Solution

  • Yes.

    onKeyDown() is triggered just like before. The key code will be KEYCODE_BACK (=4).

    Also, onKeyUp() is triggered just after as one would expect. Then onBackPressed() is called.