Android: trouble with SwiftKey

Discuss any general programming issues here

Android: trouble with SwiftKey

Postby zylesea » Mon Dec 19, 2016 1:02 am

This is an Android related issue.
I tried my App with Swiftkey on a Samsung phone today. And with Swiftkey the text input does not work. I use an event driven input like this:
Code: Select all
Function p_HandlerFunc(msg)
  Switch (msg.action)
   Case "OnKeyDown":
     If kbd$=1 Then p_enter_text(msg.key)   ;kbd$ gets set to 1 if the keyboard gets shown
    Case "OnMouseDown":
        HideKeyboard()     
        kbd$=0           
endswitch

With Android's standard keyboard this works as expected, as well as it does with the standard Samsung one, but with Swiftkey the keyboard gets hidden once the finger touches the keyboard. I.e. it seems to me that with Swift key not the event key down, but onMouseDown gets triggered.
Anyone experience with Swift key? I heard it's a pretty wide spread keyboard.
zylesea
 
Posts: 152
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany

Re: Android: trouble with SwiftKey

Postby airsoftsoftwair » Wed Dec 21, 2016 11:11 pm

Works fine here on on my Nexus 5X running Android 7. Here's my test script:

Code: Select all
ShowKeyboard

InstallEventHandler({OnKeyDown = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   OnKeyUp = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   HideKeyboard = Function(msg) DebugPrint(msg.action) EndFunction})
 
Repeat
   WaitEvent
Forever   


Which Android version are you on?
User avatar
airsoftsoftwair
 
Posts: 2202
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Android: trouble with SwiftKey

Postby zylesea » Sat Dec 31, 2016 3:05 am

airsoftsoftwair wrote:Works fine here on on my Nexus 5X running Android 7. Here's my test script:

Code: Select all
ShowKeyboard

InstallEventHandler({OnKeyDown = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   OnKeyUp = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   HideKeyboard = Function(msg) DebugPrint(msg.action) EndFunction})
 
Repeat
   WaitEvent
Forever   


Which Android version are you on?



Cannot say anything about the devic I was talking in my original post as it isn't mine. But I installed Swiftkey on my Nexus7 Android 5.1.1 now and the problem I wrote above happens there, too. If the keyboard is shown a touch outside the keyboard area does not get recognized at all. But a touch on the keyboard gets an OnMouseDown message, but no OnKeyDown message.
I thought it may be an issue of the very first touch when Swiftkey gets showns, but when I remove the hideKeyboard routine I still get _only_ OnMouseDown events and _no_ OnKeyDown or OnKeyUp events.

With the google keyboard everything is fine.
zylesea
 
Posts: 152
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany

Re: Android: trouble with SwiftKey

Postby airsoftsoftwair » Tue Jan 03, 2017 11:24 pm

I've tested it again, this time also on Android 4 and 6. Unfortunately, I don't have an Android 5 device. I modified the script to also log "OnMouseDown" events. Here is the test script:

Code: Select all
@DISPLAY {Color = #RED, ScaleMode = #SCALEMODE_AUTO, FitScale = True}

ShowKeyboard

InstallEventHandler({OnKeyDown = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   OnKeyUp = Function(msg) DebugPrint(msg.action, msg.key) EndFunction,
   HideKeyboard = Function(msg) DebugPrint(msg.action) EndFunction,
   OnMouseDown = Function(msg) DebugPrint(msg.action) EndFunction})
 
Repeat
   WaitEvent
Forever   


It works correctly on Android 4, 6, and 7. Tapping outside the keyboard area correctly reports "OnMouseDown" and tapping the keyboard only reports key events, but not "OnMouseDown". Can you test exactly the script I posted above? Maybe the problem is somewhere else.
User avatar
airsoftsoftwair
 
Posts: 2202
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Android: trouble with SwiftKey

Postby zylesea » Sat Jan 07, 2017 12:02 am

I tested with your script. With the standard keyboard it works as expected, but with SwiftKey as reported above.
Here's a logcat:
Code: Select all
I/threaded_app(13181): New input event: type=2
I/threaded_app(13181): New input event: type=2
I/LogTag  (13181): OnMouseDown
I/LogTag  (13181):
I/threaded_app(13181): New input event: type=2
I/threaded_app(13181): New input event: type=2
I/LogTag  (13181): OnMouseDown       

Taping on a key gives an OnMouseDown event, tapping outside the keyboard area (the red area) gives no event at all (hence no debug output). Weird.
zylesea
 
Posts: 152
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany

Re: Android: trouble with SwiftKey

Postby airsoftsoftwair » Sun Jan 15, 2017 10:51 pm

Hmm, I'm afraid there's not much I can do here without having a test device. Remote debugging is also not really possible because I wouldn't know where to start. But as I said, I've tested it on 3 different devices here (4, 6, and 7) and they all work fine. So let's hope that not too many devices are affected. Of course, if you want to send in your device I can debug this but I guess that's probably not a viable option for you. Maybe it's really just a bug in Android 5.
User avatar
airsoftsoftwair
 
Posts: 2202
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany

Re: Android: trouble with SwiftKey

Postby zylesea » Wed Jan 18, 2017 2:08 am

Thanks for having looked into it. Seems weird, but probably not too important. It's good to know that it is only an Android 5 issue. As long as I can assume Swiftkey and Hollywood is compatible on other Android versions that's okay, for Android 5 users I add a note.
For _my_ taste Swiftkey is too much a spy-ware anyway...
zylesea
 
Posts: 152
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany


Return to General programming

Who is online

Users browsing this forum: No registered users and 1 guest