使用USB发送文件到计算机系统计算机系统、文件、USB

2023-09-06 23:05:54 作者:10.为爱讨好

我有这样的要求,在我所要传递的计算机系统中的文件,让我们考虑的Windows PC。

I have such requirement in which i have to transfer file on computer system, lets consider windows PC.

我想要做的就是我有一个屏幕,具体的细节,我写在一个文本文件中的值,现在如果用户点击按钮后,该文件必须复制到电脑上使用USB特定的位置。

What i want to do is i have one screen with specific details,i am writing that values in one text file, now if user clicks on button then that file must be copied to computer at specific location using USB.

我试图寻找有关这一点,但没有得到任何useful.I've也请参阅以下链接

I have tried to search about this but didn't get anything useful.I've also refer below link

http://developer.android.com/guide/topics/连接/ USB / host.html

是否有可能在Android中,我如何与Windows系统进行通信?

Is it possible in Android, how do i communicate with windows system ?

问候

更新:

我能够sopy文件到电脑使用亚洲开发银行

I am able sopy files to Computer using adb

./adb -s emulator-5554 pull /sdcard/juned.jpg /root/juned/android_usb/

但我可以做到从Android应用程序是一回事吗?

but can i do same thing from android application ?

推荐答案

USB可能不是很适合你想要做什么。

USB is probably not very suitable for what you want to do.

USB是不对称的,也就是,USB连接有一台主机在一端和在另一端的外围设备。 (例如,当你插入一个U盘插入电脑时,电脑主机和棍子的外围设备。)主机启动和控制数据传输。

USB is asymmetrical, that is, a USB connection has a host at one end and a peripheral device at the other end. (For example, when you plug a USB stick into a PC, the PC is the host and the stick is the peripheral.) The host initiates and controls data transfers.

这是Android手机通常作为外围设备。由于安卓3.1的手机也可以作为USB主机,虽然不是所有的手机都支持这一点。

An Android phone generally acts as a peripheral device. As of Android 3.1, the phone can also act as a USB host, though not all phones support this.

为了实现你心目中,电脑需要运行的软件,改变它的主机模式外设模式,并公开某种存储的Andr​​oid设备便可以写的。

In order to accomplish what you have in mind, the PC would need to run a piece of software that changes it from host mode to peripheral mode, and exposes some kind of storage that the Android device could then write to.

也许蓝牙对你是一个更好的选择。你可以只启动了蓝牙文件传输,一旦文件更改。廉价的USB蓝牙适配器可用于个人电脑没有蓝牙的支持。如果要自动接受PC上的文件传输请求,你可能还需要在PC上的一些软件。

Maybe Bluetooth is a better option for you. You could just initiate a file transfer over Bluetooth as soon as the file changes. Inexpensive USB Bluetooth dongles are available for PCs without Bluetooth support. You might still need some software on your PC if you want to automatically accept the file transfer request on the PC.