Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin Forms Android App Connect/Communicate via USB to PC

$
0
0

Hello,
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,
Thanks


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>