开发者

How to access usb port with Android 3.0 sdk

I heard that 开发者_Python百科Android 3.0 sdk is having support for USB Host. I want to read / write data on USB port of Android device using android app. This app will send data to a sensor device connected to usb port of android tablet. Is there any sample code or example available for USB read write ?


Try the MissleLauncher example at http://developer.android.com/resources/samples/USB/MissileLauncher/index.html.

Implements very simple async transfer of data. Clear, concise code.


solution:

1) get access to the USB port

http://atechyblog.blogspot.com/2010/09/reboot-persisting-all-user-access-usb.html

2) get programmatic access so that you can use API's from within Java

http://www.anddev.org/ndk-problems-f56/android-serial-port-usb-t52802.html

http://code.google.com/p/android-serialport-api/source/checkout

NOTE: you will need root access to make this happen


If you plan to write commercial apps then forget about rooting. IOIO library allows you to write to USB port (see this link). Although designed to support IOIO board specifically, this lib can be used to send commands through USB.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜