如何通过USB线将数据从Android应用程序传输到c#app? [英] How can I do data transfer from android app to c# app via USB cable?

查看:186
本文介绍了如何通过USB线将数据从Android应用程序传输到c#app?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;

我正在用android和c#开发一个项目。我需要从Android应用程序到c#app的数据传输使用USB电缆。我搜索互联网结果;通常服务器clint在tcp / ip或web服务上使用。但我想用usb电缆。我怎样才能从android到c#进行数据传输。

Hi guys;
i am developing a project with android and c#. I need data transfer from android app to c# app use usb cable. i search on internet result; generally server clint on tcp/ip or web services use. But i want use usb cable. How can i do data transfer from android to c#.

推荐答案

几个月来我没有听说过类似的东西。当然,您可以使用USB共享数据,还可以确定套接字何时连接到C#中的USB端口。例如,像开发Windows应用程序的Windows运行时API USB [ ^ ]。您将获得编程连接到USB端口的应用程序所需的资源,并从我现在共享的文档进行通信(,如访问数据)。



但是在Android方面除了USB调试之外没有任何你可以使用的东西。如果您仍然有兴趣这样做,我建议您了解有关 USB调试 [ ^ ]及其工作原理等.USB调试会允许您从PC获得系统级别清除,以便在只有系统有权限的Android设备上执行不同的操作。



如果您只是忽略USB术语,那么从Android设备向基于C#的应用程序发送数据可以有许多其他解决方案。我可以帮你数几个:



1.创建一个USB监听器

- 连接你的Android然后使用USB端口进行通信将其作为USB设备,而不是Android客户端。

2.创建TCP服务器并允许Android作为TCP客户端与其通信。

3.创建一个Web服务并使用它。

- 可能很复杂。

4.创建一个ASP.NET Web API并在Android设备的浏览器中使用它。

5。使用蓝牙或其他技术传输数据。



如果只能跳过USB术语,可以使用这些方法,因为USB可以共享设备中的内容,但应用程序数据共享不是直到现在我才听到的一些东西。 :-)我很想知道这种机制,如果存在的话。但是会很难!
I haven't heard of anything like that in months. Of course you can share the data using USB and you can also determine when a socket is connected to the USB port in C#. For example like this Windows Runtime API for "developing Windows applications for USB[^]". You will get the resources required to program an application that connects to USB ports and communicates (like accessing data) from that document that I have shared right now.

But on the Android side there have not been anything that you can use, apart from that USB debugging thing. If you are still interested in doing so, I suggest you learn more about USB debugging[^] and how it works etc. USB debugging would allow you to get system-level clearance from a PC to perform different actions on Android devices that only system has permissions to.

Sending data from an Android device to a C# based application can have many other solutions if you simply ignore the USB term. I can help you count a few:

1. Creating a USB listener
- Connect your Android and then use the USB port to communicate to it as a USB device, not as Android client.
2. Create a TCP server and allow Android to communicate to it as a TCP client.
3. Create a web service and use it.
- Can be complicated.
4. Create an ASP.NET Web API and use it from the browser in Android device.
5. Use Bluetooth or other technologies for transmitting the data.

These methods can be used if only you can skip the USB term, because USB can share the contents from the device to device, but application to application data sharing is not something that I have heard until now. :-) I would love to know of such a mechanism, if exists. But would be a tough!


我建​​议使用usblib: http://www.libusb.org [ ^ ]。



我个人还没有使用它,但我的同事最近学会了如何使用它并获得了非常好的和有用的结果。它可用于许多操作系统。



对于Android,另请参阅:

https://github.com/libusb [ ^ ],

https://github.com/libusb/libusb/tree/master/ android [ ^ ]。



-SA
I would suggest using usblib: http://www.libusb.org[^].

I personally did not use it yet, but my colleague recently learned how to use it and got amazingly good and useful results. It can be used for many OS.

For Android, see also:
https://github.com/libusb[^],
https://github.com/libusb/libusb/tree/master/android[^].

—SA


这篇关于如何通过USB线将数据从Android应用程序传输到c#app?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆