Page 1 of 1

handling raw keys on android

Posted: Wed Oct 17, 2018 12:18 am
by markhinnebusch
I'm trying to port my program to Chromebook by making it an Android app and so far, everything has worked fairly well. One problem that I have is that I need to capture keystrokes so that I can implement shortcuts in the app (for ADA compliance). It appears that the rawkeydown event is not being fired. I added an answer at the top of the handler and it shows the raw key code when i run it on Mac and Windows but not on the Chromebook. I've looked around in the livecode docs and maybe there is something there but if so, I couldn't find it. Any pointers would be very much appreciated.

thanks,
mark

Re: handling raw keys on android

Posted: Wed Oct 17, 2018 1:48 pm
by bogs
The main problem your going to be facing isn't Lc related in this instance, but ChromeOs related.

While Google has recently started letting android apps run on it, they didn't do that by turning Chrome into android, they made a compatibility or virtual layer instead (like your app tester for android on the main desktop).

RawKeyDown works on supported desktops, mobile and server platforms, but how far any android app is going to work on Chrome will depend on how much of andoid's subsystem is supported and correctly implemented.

When I was doing a similar experiment last year (before google implemented all this stuff), I bypassed chrome completely and shoved crouton onto a chromebook I was borrowing for this experiment. Since that was a real 'nix implementation, all of the code more or less worked (after setting up the 'nix with additional libraries and such). The rawKey* statements all worked as you might expect them to in that environment.

I should add here that my testing buddy found that using Wine in that environment worked even better than the straight up 'nix program did. Go figure.

Re: handling raw keys on android

Posted: Wed Oct 17, 2018 6:14 pm
by jacque
RawKeyDown works on supported desktops, mobile and server platforms, but how far any android app is going to work on Chrome will depend on how much of andoid's subsystem is supported and correctly implemented.
That makes sense, I'd expect Chromebooks to support only those things that mobile Android apps can do. There are no modifier keys on the on-screen keyboard so they aren't likely to be supported on the Chromebook.

Re: handling raw keys on android

Posted: Wed Oct 17, 2018 7:30 pm
by FourthWorld
bogs wrote:
Wed Oct 17, 2018 1:48 pm
RawKeyDown works on supported desktops, mobile and server platforms...
What would it do on a server?

I wonder if that's a docs error.

Re: handling raw keys on android

Posted: Wed Oct 17, 2018 10:47 pm
by bogs
Well, much as I hate to admit it, I haven't actually tested much server code :oops: but, if you ever come up with a reason to need to see the rawKey input somehow, like maybe receiving an ultra secret password or whatever, then you can come back and tell us if it actually works there :wink:

Re: handling raw keys on android

Posted: Fri Nov 06, 2020 4:29 pm
by markhinnebusch
I have returned to this issue since ADA support on Chromebook is getting more attention from my user base. I did some research and from the ChromeOS documentation, it appears that (according to Google) ChromeOS fully supports the android keyboard support. I retried intercepting raw key down and up in my LC app running on Chromebook and the events are not fired. Given what Google is saying about their support, I wonder if anyone can verify that rawKeyDown and rawKeyUp work on the Android. I can make a test app, but if anyone already knows, then I won't waste the time.

thanks,
Mark

Re: handling raw keys on android

Posted: Fri Nov 06, 2020 6:13 pm
by FourthWorld
RawKeyDown is for LiveCode fields. On mobile it's strongly recommended to use a mobile-native field.

Re: handling raw keys on android

Posted: Fri Nov 06, 2020 7:46 pm
by richmond62
RawKeyDown is for LiveCode fields. On mobile it's strongly recommended to use a mobile-native field.
Does that mean a mobile-native field cannot receive a virtual rawKeyDown/Up signal from the onboard virtual keyboard?

Re: handling raw keys on android

Posted: Fri Nov 06, 2020 8:12 pm
by FourthWorld
Mobile-native controls have their own mobile-native messages. Some are equivalent to those we use for LC fields, but they are a relatively slim subset of the full nuanced richness of LC field messages.