Search code examples
androidusbraspberry-pi3android-thingsusb-otg

Usb Communication Android Phone to Android Things


I am trying to setup USB communication serially with an Android phone to a Raspberry Pi loaded with Android Things (USB OTG cable).

  • I am using an OTG cable to connect to the Raspberry Pi, making my Android phone the Host
  • I understand how to use the Android USB Host API however it is the other side, that is, the code on the Android Things Raspberry Pi that I do not know what to do.

What does the code on the Android Things Raspberry Pi have to be to receive and react to USB serial communication from the Host Android phone? If possible, can you give a code example of how to react to a read command then provide specific information (say just a simply a string) back to the phone.


Solution

  • Raspberry Pi 3B cannot act as USB slave, only as USB host.

    Some references:

    However, RPi 3B has another capability which you may find of interest but, honestly, I am not sure if Android Things supports it.