Android: trouble with SwiftKey

Discuss any general programming issues here
Post Reply
zylesea
Posts: 167
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Android: trouble with SwiftKey

Post by 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.

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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?

zylesea
Posts: 167
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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.

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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.

zylesea
Posts: 167
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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.

User avatar
airsoftsoftwair
Posts: 2477
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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.

zylesea
Posts: 167
Joined: Tue Feb 16, 2010 1:50 am
Location: Westfalen/Germany
Contact:

Re: Android: trouble with SwiftKey

Post by 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...

Post Reply