Can i transfer data between a Cordova Android app & an embedded device (chess board)?

649 Views Asked by At

I am trying to transfer data between a chess board (see attached pic) and a cordova based Android chess game(lichess). Both the devices will be connected via USB cable. Is it possible that a cordova app for android can have access to the USB controller APIs of the android device and communicate via it with the microcontroller?

p.s - i am new to cordova apps so my confusion can an app build with cordova interact with device hardware/sensors.

enter image description here

1

There are 1 best solutions below

3
On BEST ANSWER

To do what you're trying to do you will have to use a plugin to provide the USB communication capability. Either you can build your own plugin and code your functions in java (for that I suggest you have a look at how existing plugins are made and read some online tutorials like this one for example)

Or you can find an existing plugin that would allow to do what you need.

I found for example two projects about usb communication:

  • cordova-plugin-usbserial seems unfinished, not sure it's usable or not, more details on this page.
  • cordovarduino more specific about communication between an android device and a arduino board via USB, maybe that's what you need if your chessboard is based on an arduino.