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
LibGDX's Android Keyboard input not working with the "Samsung Keyboard" #3896
Comments
I've just run into this issue on the S7. If you tap on the checkmark or one of the other options in the predictive text, the text will be input into the TextField, but otherwise nothing shows up. |
I have this issue aswell. Text appears when using the keyboard on Android Studios emulator but on my Phone, a S6 Edge you have to hit enter for it to show up. |
I also have this issue on my note 5. Please lmk if you guys find a work around or a fix is released. I think this is very important because a large amount of android users are on Samsung devices. |
Yesterday I tried to contact Samsung via twitter about it but I think I confused them...we might get a better response if more people enquire them about it: https://twitter.com/AshleyABurnett/status/716392983986315264 As for a fix through LibGDX:I'm not sure I did this properly but I tried to edit the AndroidInput.java in gdx-backend-android,jar and append this code to the EditText variable called "input":
I got that code from this answer: http://stackoverflow.com/a/16997434 However that did not work. I'm sure I did it incorrectly though because all I did was extract the class using 7-zip, edit it and then re-add it to the .jar using 7-zip. |
As a workaround you can use Reflection to get the libgdx/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidInput.java Line 143 in 92d58c5
than you can get the Line 57 in fde893c
and than you can set the input type on it (also via reflection). |
@intrigus could you give us a code example? I dont understand what you mean by use reflection. Thanks so much! |
The reflection api allows you to manipulate classes in real time. So he
|
Thanks for the advice, at least we know a solution is possible now. I'm new to the reflection API and I can't seem to get it to work properly. The furthest I got was with this error:
Here is my amateur code that I put in the onCreate() method of AndroidLauncher.java
|
My fault, AndroidOnscreenKeyboard isn't used at all. I'm going to post this workaround tomorrow. Anyway, libgdx should update its input mechanism. |
Thanks, looking forward to the fix, might put an end to the 1 star reviews on my game. |
Try adding outAttrs.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_NULL; right after https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/surfaceview/GLSurfaceView20API18.java#L74 if (outAttrs != null) {
outAttrs.imeOptions = outAttrs.imeOptions | EditorInfo.IME_FLAG_NO_EXTRACT_UI;
if(isSamsungKeyboard()){
outAttrs.inputType = InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_NULL;
}
} Do the same here. Have a look at http://stackoverflow.com/a/14371088 to see how you can implement a It may be possible that this also doesn't work. In this case you are currently out of luck. If you don't have access to a Samsung device you can try http://developer.samsung.com/remotetestlab/rtlDeviceList.action |
Thanks for the help again. I tried to implement it. I didn't use an isSamsungKeyboard() method as this is just a test build, but I couldn't get it to work using the S7. I had been using remote test lab previously but thanks for the advice. All I'm doing is extracting the relevant classes out of the gdx-backend-android-1.6.0-sources.jar using 7-zip, editing the code in the classes, and then dragging the files back in. Then I go into my project structure and change the gdx-backend-android-1.6.0-sources.jar on the Android module in IntelliJ to the one I modified. Is this the correct way to edit the source? I'm assuming this isn't, it seems too easy. |
Have a look at the wiki, there should be an article "Working with the source". |
Thanks intrigus I edit two class GLSurfaceView20API18.class, GLSurfaceView20.class at com.badlogic.gdx.backends.android.surfaceview if (outAttrs != null) { } |
congatobu, i'm assuming you worked with the libgdx source? |
@Ash98 |
Is there any news on this being fixed in libgdx itself? Text input is broken on a lot of devices, does this have any priority? If not I can take a crack at it next week. |
A fix for this would be great since it affect most of the newer Samsung phones and getting a 1-star rating because users can not even create an account and login is no good. The best would be if you can set a per TextField input type (android:inputMethod) instead of for all input as the suggestion above. |
So I've hacked around this for my own game but its messy as hell... is there any initiative in the LibGDX team to upgrade the Keyboard support? I feel like its a real thorn in the side of an otherwise excellent set of API. Even if it's just to implement the workaround congatobu highlighted? I dislike working from source as you are then forever out of sync with the core project. |
I'm coming out of the silence for a moment to weigh in here. The problem with Android in general, especially the input backend, is the sheer amount of fragmentation. Like, this doesn't happen with the Google Keyboard, but Samsung has to break things (not much of a surprise here.) It doesn't mean it is acceptable because as you all have pointed out, users don't want to switch their keyboard for a game. The fragmentation, sadly, goes both ways - before we can deploy a fix in the master branch, we need to ensure that we don't break things further or cause other major changes. Breaking input is a big deal. It's a little bit of a Catch-22. (You can argue that input is already broken but that's a different subject matter). I can try to integrate @congatobu 's suggestion in my local testing branch and see what it does but I'd have to borrow my friend's phone since I lack a Samsung phone. However, I've been away from the project for a long time so it would be better if a core member could look into it. In conclusion, we'd love to fix and streamline input, it's just one of those things where you patch one things around and another issue arises. |
Thanks for taking the time to write up such a detailed response, I understand and agree with you completely. In my eyes I would say the current keyboard issue with the auto-complete on Samsung phones should be viewed as a severe input issue as it literally makes the keyboard totally unusable. From my perspective if the submitted workaround in this ticket does what it says on the tin, if that could make it into master I'd be over the moon and happy for this ticket to be closed. As someone earlier in the thread posted, its pretty heartbreaking to have people one star rating your app because they can't create an account >.< I get that a lot of games likely don't have keyboard input so its an easy issue to sideline, but in my case my game is an MMO so communication is a big part of the experience, I have gotten fairly hammered on this issue and its such a silly thing to let the experience down :( This is the only issue I personally have with LibGDX right now that is affecting end users so I am massively biased towards it being addressed, if someone official could find the time to have a look I would give you all the cookies. Liam |
Is there some update regarding fixing this issue with congatobu's workaround? Samsung represents the majority of Android phones, so it is a bit crippling to have all the games using a keyboard that don't work on these phones. |
The solution suggested by @intrigus indeed works well (I added flag TYPE_TEXT_VARIATION_VISIBLE_PASSWORD and re-build LibGDX from sources). Are there workaround for this? |
It's 2020 and I'm getting reports of this issue still happening from my users. Is it a regression? All the comments here ended in 2017! |
This is still a massive issue to be honest, I think I lose a lot of players simply because they can't create an Account. It's on my whiteboard now so I will be looking into fixing it in the coming weeks, if I remember correctly it requires a complete rework of how keyboard input works on Android which should be fun ._. |
Alright, going back over this thread I saw there was a workaround posted that was not implemented due to hesitation around it causing other issues. With that in mind, I have a playerbase of around 50k active users and I figured screw it, so I've put congatobu's fix in to my own fork of 1.9.6 and gave it to my users to test if they wanted. I've had over 500 players test the client with this change and none have had keyboard issues - I appreciate the caution around putting things in but this looks fine, fixes a really problematic issue with the keyboard for a broad range of devices and really should just go in. I'll submit a merge request shortly - commence finger crossing. Edit: I see the issue you have highlighted with the fix being reverted once a language change occurs mitrakov, I'll take a look. |
Yes! The timing couldn't possibly be better for me. Thank you so much!
…On Sat, Apr 18, 2020, 8:28 AM Liam Stewart ***@***.***> wrote:
Alright, going back over this thread I saw there was a workaround posted
that was not implemented due to hesitation around it causing other issues.
With that in mind, I have a playerbase of around 50k active users and I
figured screw it, so I've put congatobu's fix in to my own fork of 1.9.6
and gave it to my users to test if they wanted.
I've had over 500 players test the client with this change and none have
had keyboard issues - I appreciate the caution around putting things in but
this looks fine, fixes a really problematic issue with the keyboard for a
broad range of devices and really should just go in.
I'll submit a merge request shortly - commence finger crossing.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3896 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACM6HBE2AVKJI4C4D3FCI3RNHBKTANCNFSM4B5AAJAQ>
.
|
@carlislefox Any update on the status of this? |
It's year 2020 but it's still there... |
I thought more people were using this game engine tbh |
I just made a decision... using urgly Gdx.input.getText() when detected phone is from Samsung otherwise the normal way. @carlislefox I am waiting for you saving me from this urgly solution😢 |
I've just come across this after encountering the same issue. My app is a word game, so it's kinda important that people can see what they're entering! I've looked into the backend of libgdx and it's all based on using OnKeyListener which intercepts hardware keyboard presses but not necessarily soft keyboard presses. It's down to the individual keyboard app maker to fire this event if they want to. It appears that the Samsung keyboard app doesn't do this. @bitdream what is this Gdx.input.getText() workaround you have? Could you post it? @carlislefox did you get any further with this? I'm trying to understand how AndroidOnscreenKeyboard works as that possibly uses the underlying Android Editable which might be able to detect ALL keyboard presses, but I'm not getting any luck yet with any breakpoints firing |
So I've just added @congatobu fix, and tried changing language and it appears to still work. @mitrakov - any chance you can test it again on latest build of Libgdx (I forked 1.9.10 i think...i have so many diff branches it's hard to keep track). But if this works we can potentially get a PR in. |
Just giving my +1 support for this!
…On Mon, Jul 13, 2020 at 6:41 PM wheelergames ***@***.***> wrote:
So I've just added @congatobu <https://github.com/congatobu> fix, and
tried changing language and it appears to still work. @mitrakov
<https://github.com/mitrakov> - any chance you can test it again on
latest build of Libgdx (I forked 1.9.10 i think...i have so many diff
branches it's hard to keep track). But if this works we can potentially get
a PR in.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3896 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACM6HCGF5OMSZMZVQAHZLLR3OERVANCNFSM4B5AAJAQ>
.
|
When use Gdx.input.getText(), a very ugly and wired android native TextFild dialog will promote. I really don't recommend this if you could fix it. |
Got it. Well I think the original fix works well for me. I tried changing language as @mitrakov said that reset it, but it didn't for me. (I changed language using the keyboard/spacebar, not sure if there is another way that breaks it) |
@wheelergames it will be helpful if you could merge it to master. Someone in this thread said he will do it long before but he didn't 🤦♀️ |
so 2 problems with that
I can make the PR sometime today though, and add the language comment, to see if more people can test it. Or if you want to help yourself you can try and run it from source yourself (if you know how?) |
@bitdream @Emperorlou - maybe you can pull my fork and test it for yourselves? or at least comment on the PR to help try and bump it up the list and get some attention. EDIT - had to redo the PR, it's now #6104 below |
I can learn to do it although I haven't done this before. How can I refer your fork in my project? Or should I download your code and make a test project to test it? |
I would, clone my fork to your local machine. Then go through and change the version number from 1.9.11-SNAPSHOT to 1.9.11-bitdream-SNAPSHOT or something else unique (just because using the same version number can get cached a little on maven in my experience). Once you've changed that in all the places, go to a terminal, navigate to the folder and run This should add the library to your local maven, and then in your project just add the bitdream version instead and make sure you have |
|
In every place. Do a find replace all. I think it's 28 places |
I have leaved with the default 1.9.11-SNAPSHOT and tested on my Galaxy s10. It worked well. From the ponit view of users, it just turned off the auto compelte feature. I will test it on more phones later. I also tried switch between languages and found no problems. |
You mean the text entered and was visible as typing, and in addition the auto complete went away. My own goal is not to have auto complete go away, but just to get the keyboard working. I dont know if that would be a blocker to it getting merged? Thanks for testing the language swap though, at least that bit no longer appears to be broken. Once tested, could you comment on the PR itself, and hopefully it'll get noticed. There's allegedly going to be a release of 1.9.11 this weekend, so it would be great if this could get merged before that! |
Text is always visible in my S10 but the auto complete feature makes the input messy. All the first auto complete clue are input in textfield even I didn't choose it and what's more, the backspace didn't work correctly. |
For me the issue has always been, you type characters, and they don't appear until you close the keyboard, so people can't tell what they're entering. I've never attempted to use or hide the auto complete stuff. Are you saying that on your S10 you have never had this issue (before applying the fix?) Also are you saying backspace doesn't work NOW, or it didn't work in the PAST? How are you changing focus? By tapping somewhere else? Or doing something else? So you would say add a |
I have just tested on another not-Samsung phone and it worked OK as before. So I released an update for my APP with your fix. |
Ok, thanks. So the fix fixes something I have never seen, for you, and something you have never seen, for me! Sounds like it's getting better all the time! |
Thank you too I also learned how to use the source code and maybe in future I could do some contribution for this project😁 |
Closed by #6104 |
Issue details
On Samsung's keyboard, there is a glitch where it does not process the command InputType.NULL sent by the Android App and therefore shows predictive text above the keyboard, which breaks LibGDX's keyboard input.
I think this may be temporarily fixed if we can modify the InputType of the on screen keyboard. This would allow us to set the keyboard's input type as a visible password, which would prevent predictive text appearing.
I know this is not necessarily an issue with LibGDX, it is more Samsung's issue. It was reported to Samsung a while ago but I don't think they will be fixing it anytime soon.
Reproduction steps/code
Create a game that uses an InputProcessor to receive keyboard input.
Load the game on a Samsung Galaxy S5, S6, S6 Edge or Note 5 that uses the Samsung Keyboard app. Make sure predictive text is enabled on the keyboard settings.
Try to type something and no input will be registered.
Version of LibGDX and/or relevant dependencies
Please provide the version(s) affected.
I have only tested with 1.6 and 1.9.3
Please select the affected platforms
The text was updated successfully, but these errors were encountered: