#7830·libgdx

Predictive back gesture does not fire keyUp event

Author: LobbyDivinusCreated Jul 14, 2026Updated Sep 3, 2026

Describe the bug

PR #7429 added support for predictive back gestures. That is a special way of triggering the back key via a gesture on Android. In contrast to the previous implementation - and my expectation on how it would work - it does not fire a keyUp event.

From my understanding the solution would be to also fire a KEY_UP event in the OnBackInvokedCallback.onBackInvoked() implementation: https://github.com/libgdx/libgdx/blob/32eb91a76e7d8bef051cf5a6c88153cc6dd88395/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/DefaultAndroidInput.java#L1420-L1425

Reproduction

The main difficulty may be to know if your device is even using predictive back gestures.

Here's a setup to create a test bed:

java
    Gdx.input.setCatchKey(Input.Keys.BACK, true)
    Gdx.input.setInputProcessor(new InputAdapter() {

        @Override
        public boolean keyDown(int keycode) {
            Gdx.app.debug("input", "keyDown: " + Input.Keys.toString(keycode));
            return true;
        }

        @Override
        public boolean keyUp(int keycode) {
            Gdx.app.debug("input", "keyUp: " + Input.Keys.toString(keycode));
            return true;
        }

    });

On my test device (only using gesture back button) it outputs: [input] keyDown: Back [input] keyDown: Back [input] keyDown: Back ...

While I would expect it to output: [input] keyDown: Back [input] keyUp: Back [input] keyDown: Back [input] keyUp: Back [input] keyDown: Back [input] keyUp: Back ...

version

1.13.0+

Affected platforms

  • Android
  • iOS
  • HTML/GWT
  • Windows
  • Linux
  • macOS