Author Topic: Keyboard issues on Android 5.0  (Read 8190 times)

rtumelty

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Keyboard issues on Android 5.0
« on: January 19, 2015, 02:00:46 PM »
Hi,

A project I am working on is built using NGUI for its interface. We have been experiencing an issue with the Native keyboard on devices running Lollipop (Android 5.0), specifically the Nexus 5 and 6.

When interacting with a text field all devices (Android or iOS), the native keyboard appears as intended. However on the Nexus devices, when the user tries to type on the keyboard, the events seem to pass through the keyboard to Unity. This causes the keyboard to close, making user input impossible. 

I have searched for others with this issue, and hopefully a solution,  but all I could find was a post on the Unity Answers forum. The poster received no response, but is also using NGUI and having the same issue with Android 5.0.

I hope you can help me resolve this issue. I am running Unity 4.6.0b20 and using NGUI version 3.7.7.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #1 on: January 20, 2015, 09:40:02 PM »
Update NGUI to the latest and turn off keyboard events on the UICamera.

rtumelty

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #2 on: January 27, 2015, 01:41:00 PM »
Thanks for the reply, unfortunately the solution provided does not solve my issue.

The issue is that the native keyboard does not receive user input. Whenever the user taps on the keyboard, the event passes through the native keyboard and registers with the game engine. Oddly, if the user touches a part of the screen that is not occupied by the keyboard, the keyboard remains open. This is the opposite of the expected behaviour, observed on other Android and iOS devices.

I have included a link to an example APK demonstrating the issue, if you have access to a test device running Android 5.0. As mentioned previously, this bug  has been produced on the Nexus 5 and 6 - I am unaware if other Android devices running 5.0 also experience this.

https://drive.google.com/open?id=0B8YcVqmsn74XME1sTnNMQlFJdGc&authuser=0
« Last Edit: January 27, 2015, 01:49:38 PM by rtumelty »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #3 on: January 28, 2015, 01:54:45 AM »
Unfortunately I don't have anything with Android 5 on it right now. I ditched most of my Android devices when that ridiculous Google Play services battery drain bug was introduced. I still have a tablet, but it has 4.2 on it and everything works as expected on it. Tapping on keyboard doesn't go to the rest of the app, and tapping on the screen closes the keyboard. Did you try a simple test app that just opens the touch screen keyboard via TouchScreenKeyboard.Open?

rtumelty

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #4 on: January 28, 2015, 06:05:28 AM »
I'll give that a shot and let you know what happens. Cheers!

rtumelty

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #5 on: February 03, 2015, 07:18:02 AM »
Hi, so TouchScreenKeyboard.Open works exactly as one would expect. I disabled the UIInput script in the scene and implemented a new solution using TouchScreenKeyboard. If you get a chance though that bug is worth looking into - I'd love to know if it's a recurring issue on those devices!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #6 on: February 03, 2015, 11:03:04 AM »
UIInput uses TouchScreenKeyboard.Open as well.

jovianminds

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #7 on: February 27, 2015, 11:39:47 PM »
I'm also having this happen on multiple projects, and it doesn't have to be Android 5, when running in landscape.  I'm currently seeing it on Nexus 4 and Nexus 5 with OS 4.4.3.

It looks like that something is inverting the calculation for whatever is detecting a screen click vs a keyboard click.  When this is happening, if I tap anywhere on the screen above the keyboard (that normally should hide it) - nothing happens... but if I tap on the bottom part of the screen where the keyboard is to tap a key, it dismisses the keyboard.

Any thoughts?

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #8 on: March 01, 2015, 04:52:34 PM »
NGUI doesn't do that kind of logic. It simply opens the touch-screen keyboard then reacts to TouchScreenKeyboard's text value changing. The actual event filtering is done by Unity, so if there is an issue then it's within Unity. What version of Unity are you using?

jovianminds

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #9 on: March 01, 2015, 07:27:12 PM »
It has happened at least as far back as 4.5, I'm currently on 4.6.3p1.  I've seen it now on 2 projects in a row, the first one I had to just turn off hideInput - I'd rather avoid that on this one if possible.

I'm surprised more people aren't seeing it - unless I'm doing something specific each time?  The projects are both landscape, using fixed constraint on the UIRoot, nothing else really special.

It only happens on some phones - I've seen it now on Nexus4, Nexus5 and Droid Mini.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #10 on: March 03, 2015, 05:22:55 PM »
If it only happens on specific phones then it's 100% a Unity issue. You should report it.

jovianminds

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: Keyboard issues on Android 5.0
« Reply #11 on: March 03, 2015, 06:59:51 PM »
I searched and found a bug already entered.  I added a comment with details and up voted it: http://issuetracker.unity3d.com/issues/ui-inputfield-lollipop-inputfield-doesnt-work-properly-when-turned-to-landscape

Thanks for the help!