I have the “Back” input binding, and it works perfectly find for button navigation. Touching the back (in case of back in screen) and touching the back button out of the screen (old phone) works all well.
But when I enable the gesture navigation it does not work as expected.
The system is detecting the back, as I get the vibration feedback, but the game does not.
The game does detect sometime, like if I swap multiple times, it detect sometimes and no regular pattern.
I tried not sending the event to button (from defold input) and moving the back_button test to top, it did not help.
function on_input(self, action_id, action)
if action_id == hash("back_button") and action.released then
back_pressed(self)
end
-- button.on_input(action_id, action)
-- self.druid:on_input(action_id, action)
Yes input binding is set for Back to back_button. Removing the action.released does not work as well.
britzl
January 7, 2025, 2:56pm
2
I wonder if we broke something during glfw migration? It is supposed to work correctly with gestures:
defold:dev
← defold:issue-6821
opened 11:27AM - 19 Apr 23 UTC
Android 13 doesn't support Back button anymore. Instead, it uses back gesture. T… his fix added support for this gesture in the engine using the same "Back" event in the input bindings. More info is available in t[he official Android documentation](https://developer.android.com/guide/navigation/predictive-back-gesture#migrate-app).
>⚠️ `AndroidManifes.xml` updated with new flag `android:enableOnBackInvokedCallback="true"` for the `<application>` tag. If you use your own manifest, make sure you apply the same changes.
Fix https://github.com/defold/defold/issues/6821
## PR checklist
* [x] Code
* [ ] Add engine and/or editor unit tests.
* [x] New and changed code follows the overall code style of existing code
* [x] Add comments where needed
* [ ] Documentation
* [ ] Make sure that API documentation is updated in code comments
* [ ] Make sure that manuals are updated (in github.com/defold/doc)
* [ ] Prepare pull request and affected issue for automatic release notes generator
* [x] Pull request - Write a message that explains what this pull request does. What was the problem? How was it solved? What are the changes to APIs or the new APIs introduced? This message will be used in the generated release notes. Make sure it is well written and understandable for a user of Defold.
* [x] Pull request - Write a pull request title that in a sentence summarises what the pull request does. Do not include "Issue-1234 ..." in the title. This text will be used in the generated release notes.
* [x] Pull request - Link the pull request to the issue(s) it is closing. Use on of the [approved closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
* [x] Affected issue - Assign the issue to a project. Do not assign the pull request to a project if there is an issue which the pull request closes.
* [ ] Affected issue - Assign the "breaking change" label to the issue if introducing a breaking change.
* [ ] Affected issue - Assign the "skip release notes" is the issue should not be included in the generated release notes.
Ping @AGulev and @jhonny.goransson
britzl
January 7, 2025, 3:33pm
3
@InfoDevkota do you happen to have a custom AndroidManifest.xml file without android:enableOnBackInvokedCallback="true"
?
Yes, I am using custom AndroidManifest.xml, but android:enableOnBackInvokedCallback="true"
is there.
<application
{{#has-icons?}}
android:icon="@drawable/icon"
{{/has-icons?}}
android:extractNativeLibs="{{android.extract_native_libs}}"
android:label="{{project.title}}" android:hasCode="true"
android:name="android.support.multidex.MultiDexApplication"
android:enableOnBackInvokedCallback="true"
android:debuggable="{{android.debuggable}}">
The phone I have tested is Android 9 and 10.
I have seen you answer lots of questions and were really helpful. Happy to interact with you.
1 Like
I run the BackButtonTest.zip included on that PR, and Its not working as expected on my phone as well.
It recognize sometimes and the pressed and released happened at once (as seen in the UI of that zip).
britzl
January 8, 2025, 10:26pm
6
Hmm, ok, we need to do some tests here on our end then. I can’t say exactly when we have time to look into it. I’ll try to at least verify the issue tomorrow.
1 Like
Hello, did you manage to confirm the issue?
britzl
January 12, 2025, 10:51pm
8
Sorry, yes I was able to reproduce it!
opened 11:09PM - 12 Jan 25 UTC
bug
_Is it a private platform, and a platform specific issue? (i.e. would it break y… our NDA?)<br>
Then please report your issue in the corresponding extension repository!_
**Describe the bug (REQUIRED)**
A clear and concise description of what the bug is.
**To Reproduce (REQUIRED)**
Try to use a gesture navigation to "go back"
**Expected behavior (REQUIRED)**
Android back gesture should be recognised as back navigation and generate an on_input() action.
**Defold version (REQUIRED):**
- Version 1.9.6
**Platforms (REQUIRED):**
- Platforms: Android
- OS: 14
**Minimal repro case project (OPTIONAL):**
[Archive.zip](https://github.com/user-attachments/files/18391494/Archive.zip)
**Additional context (OPTIONAL):**
- https://github.com/defold/defold/pull/7591
- https://forum.defold.com/t/back-key-not-detected-on-android-gesture-navigation/79360
1 Like