Bi-directional data transfer through USB between an Android device and a PC (Mac or Windows)

筅森魡賤 提交于 2019-12-12 04:48:16

问题


I am new to Android programming. I need to transfer data bi-directionally over USB between an Android tablet and a PC (Mac or Windows). The Android tablet will have Android 4.0 or newer. Mac will have OS X Lion or newer and Windows will have Windows XP or newer.

After reading about Android's support for USB connectivity here: http://developer.android.com/guide/topics/connectivity/usb/index.html

I'm thinking if I get the Android tablet run in USB accessory mode and make the PC the host, bi-directional data transfer over USB can work. Is that thinking correct or I'm way off here?

Thanks.


回答1:


Your best bet is probably ADB push/pull of files (assuming that's what you want to transfer). Your Windows-side application would have adb and AdbWinApi.dll as assets, and the OSX version would have the Mac OS ADB binary... There are obvious downsides such as having to have Developer options enabled on the device, and possible interference from a pre-existing copy of the Android SDK on the host machine (typically very unlikely, but possible!)

More advanced: Depending on the environment, you may even want to look into building your own version of ADB from source with unnecessary features omitted.



来源:https://stackoverflow.com/questions/13637858/bi-directional-data-transfer-through-usb-between-an-android-device-and-a-pc-mac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!