Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Xamarin Forms Android App Connect/Communicate via USB to PC

CatimusCatimus USMember ✭✭

I am working on an Android (Xamarin Forms) application, and have a need to communicate with a Windows PC. This communication NEEDS to happen over USB cable. I googled this problem and found a couple of incredibly similar projects anotherlab's UsbSerialForAndroid, and lusovu's XmarinUsbSerial.

I am using anotherlab's project as a starting point on how to get android -> pc usb comms working, but am running into the problem of never being able to find any devices when the tablet is plugged into the PC. I have tried using a regular USB cable as well as an OTG cable without any luck. I just can't figure out why the device list is empty when using the following lines of code:

    usbManager = GetSystemService(Context.UsbService) as UsbManager;
    IDictionary<string, UsbDevice> devices = usbManager.DeviceList;

I'm thinking it might be a problem with the drivers it's using but I have no clue as to how to get the vendor id or the product id of the usb host controller in my laptop (done a quick search). Could it be something else?

I can connect to an Arduino device using the OTG cable and can get the project working with it, but I need it to work with a PC not an Arduino.

If anyone has any ideas I would be grateful,

Best Answer


  • JGoldbergerJGoldberger USMember, Forum Administrator, Xamarin Team, University Xamurai


    I am not sure this applies here, but some Android devices do require you to install their own drivers for USB communications when using the device for debugging for instance. I know with Samsung devices you need to do this. So you might try going to the Android device manufacturer's website and seeing if there are Windows drivers to install.

  • CatimusCatimus USMember ✭✭

    Thank you for your prompt response and your suggestion. I tried downloading the latest Acer drivers which were much older than the ones I already had for Win10, but what the heck they're "official." Running with them now, but still no change in behavior. Still searching for an answer.

  • CatimusCatimus USMember ✭✭

    Thank you for the information. It looks like I going down a path that had a very messy end. I am looking at other methods of transferring the data.

  • MelbourneDeveloperMelbourneDeveloper AUMember ✭✭✭
    edited August 2019

    @Catimus if you are still working on this project, I'd like to point you to Device.Net. There is a specific library for Android USB access, but it is more of a framework for cross platform development so that code can be shared on other platforms.

    Here is a forum post about the latest release:

    It would be great if you could share your existing solution to see if it could help to improve Device.Net.

  • delfinomoralesdelfinomorales Member ✭✭

    @Catimus, lograste resolver tu problema, crees que me puedas apoyar, yo necesito enviar datos a una pc por el puerto serial, he buscado informacion pero no logro entender como hacerlo.


  • delfinomoralesdelfinomorales Member ✭✭
    edited April 2020

    @Catimus, You managed to solve your problem, you think you can help me, I need to send data to a PC through the serial port, it looked for information but I cannot understand how to do it.


Sign In or Register to comment.