Detecting if Android is running on a Chromebook

Hi all,

I wonder if there is a way to detect if a user is running our app on a Chromebook as an Android app? We want to test for this and then allow use of the keyboard if they are… is there something like the below that I can do (don’t have a Chromebook to test on at present and only want to buy one if what we want to do is possible)…

if (system.getInfo("platform") == "Android") and (system.getInfo("model") == "chromebook") then     -- do some stuff end

Does anyone know if we can then detect input from the keyboard in the same way we can for Mac OSX or Windows?

Thanks in advance.

Ian

I wasn’t aware that you could run a Corona app on a Chromebook.

Have you successfully done this?

Also, consider examining the many system.getInfo() choices: https://docs.coronalabs.com/api/library/system/getInfo.html

One of them will probably give you the info you need.

We don’t formally support chromebooks. @Roaminggamer, apparently modern chromebooks can run standard Android apk’s. Thought here is some questions around what’s needed to enable/disable touch support (something needed in the AndroidManifest.xml file).

The keyboard should generate regular key events. The best thing to do is test it. Just turn on the key event handler and see what happens when you type on the keyboard.

Rob

Thanks for the quick replies. I can’t test it as I don’t own a Chromebook and I’d prefer not to spend the money on one unless I can be sure it’s going to be able to handle keyboard events in the way OSX does etc. Spending £250 on a Chromebook just to find out it doesn’t work wouldn’t be ideal, so if anyone out there knows definitely one way or the other that would be fantastic info to have.

It’s come about as a customer appears to be running the app on a Chromebook fine and touch events are working perfectly (according to him) - it’s just that we haven’t enabled key events on Android builds at present.

I suppose it wouldn’t do any harm just to enable the same code we use on OSX builds to add keyboard functionality in and see if it works for people. If it doesn’t we’re no worse off, but ideally I’d like to know for sure if it’s something that will / won’t work.

There isn’t a reason to not just enable the keyboard handling like you do in macOS. If it doesn’t work, it simply won’t do anything.

Rob

Thanks Rob - that’s what I’ll do. Will report back on whether it works or not once I’ve got the update submitted and with the customer.

I wasn’t aware that you could run a Corona app on a Chromebook.

Have you successfully done this?

Also, consider examining the many system.getInfo() choices: https://docs.coronalabs.com/api/library/system/getInfo.html

One of them will probably give you the info you need.

We don’t formally support chromebooks. @Roaminggamer, apparently modern chromebooks can run standard Android apk’s. Thought here is some questions around what’s needed to enable/disable touch support (something needed in the AndroidManifest.xml file).

The keyboard should generate regular key events. The best thing to do is test it. Just turn on the key event handler and see what happens when you type on the keyboard.

Rob

Thanks for the quick replies. I can’t test it as I don’t own a Chromebook and I’d prefer not to spend the money on one unless I can be sure it’s going to be able to handle keyboard events in the way OSX does etc. Spending £250 on a Chromebook just to find out it doesn’t work wouldn’t be ideal, so if anyone out there knows definitely one way or the other that would be fantastic info to have.

It’s come about as a customer appears to be running the app on a Chromebook fine and touch events are working perfectly (according to him) - it’s just that we haven’t enabled key events on Android builds at present.

I suppose it wouldn’t do any harm just to enable the same code we use on OSX builds to add keyboard functionality in and see if it works for people. If it doesn’t we’re no worse off, but ideally I’d like to know for sure if it’s something that will / won’t work.

There isn’t a reason to not just enable the keyboard handling like you do in macOS. If it doesn’t work, it simply won’t do anything.

Rob

Thanks Rob - that’s what I’ll do. Will report back on whether it works or not once I’ve got the update submitted and with the customer.