Xamarin.Android/Forms app communicating with a PC over the usb

Emil Alipiev 306 Reputation points
2021-06-02T21:19:28.973+00:00

Is it possible to send commands over the usb connection between Xamarin.Android app and Pc app?
So basically I would like send some text over the port and PC app is listening the port and reads it and display it? Pc app is not matter, Uwp, Wpf, Xamarin.forms etc. what matters is how to send the message from Android over the usb.
using Bluetooth it is already possible and I have achieved it but I dont know how to achieve this over the usb.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,378 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JarvanZhang 23,966 Reputation points
    2021-06-03T09:04:11.553+00:00

    Hello,​

    Welcome to our Microsoft Q&A platform!

    To make the Xamarin.Android/Forms app communicate with a PC, it's a good choice to use TCP/IP client. You could refer to the links from this comment:
    https://forums.xamarin.com/discussion/comment/393629/#Comment_393629

    If you want to perform the communication via usb, you may need to consume a tool or library.
    Check the links:
    https://stackoverflow.com/questions/49015125/communicating-with-a-website-via-usb-connection-to-a-xamarin-android-app
    https://forums.xamarin.com/discussion/127902/xamarin-forms-android-app-connect-communicate-via-usb-to-pc

    Best Regards,

    Jarvan Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.