Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: Can't get the Back key event on Android #26985

ntop001 opened this issue Aug 14, 2018 · 0 comments

x/mobile: Can't get the Back key event on Android #26985

ntop001 opened this issue Aug 14, 2018 · 0 comments


Copy link

@ntop001 ntop001 commented Aug 14, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.8.1 darwin/amd64

Does this issue reproduce with the latest release?


What did you do?

Add following code in the basic example:

for e := range a.Events() {
	switch e := a.Filter(e).(type) {
		case key.Event:
		log.Println("key event:", e)

Build and Run the basic example on an Android devices.

What did you expect to see?

Print the correct key code value (BacK == 4 on Android).

What did you see instead?

It prints 'KeyCodeUnknown'. It seems that in the 'android.go', there is a filter method convAndroidKeyCode which map the Back key as unknown. I think gomobile should properly process the keycode such as Back. On Android, Menu/Back are commonly used keycode. Maybe we can add a 'Origin' field in the key.Event struct, that I can get the original (no filtered) value.

PS: unity map the 'Back' key on Android to ESC.

@gopherbot gopherbot added this to the Unreleased milestone Aug 14, 2018
@gopherbot gopherbot added the mobile label Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants