usb-serial-for-android v0.1.0 Release Notes
Release Date: 2014-03-04 // about 10 years ago-
Version : 0.1.0
๐ Release date: November 13, 2012
Notes : First public release of usb-serial-for-android.Quick Start
1. Download usb-serial-for-android-v010.jar
2. Copy the jar to your Android project's
libs/
directory. (See Android's FAQ for help).3. Copy device_filter.xml to your project's
res/xml/
directory.4. Configure your
AndroidManifest.xml
to notify your app when a device is attached (see Android USB Host documentation for help).\<activityandroid:name="..." ...\> \<intent-filter\> \<action android:name="android.hardware.usb.action.USB\_DEVICE\_ATTACHED" /\> \</intent-filter\> \<meta-dataandroid:name="android.hardware.usb.action.USB\_DEVICE\_ATTACHED"android:resource="@xml/device\_filter" /\> \</activity\>
5. Use it! Example code snippet:
// Get UsbManager from Android.UsbManager manager = (UsbManager) getSystemService(Context.USB\_SERVICE);// Find the first available driver.UsbSerialDriver driver = UsbSerialProber.acquire(manager);if (driver != null) { driver.open(); try { driver.setBaudRate(115200); byte buffer[] = new byte[16]; int numBytesRead = driver.read(buffer, 1000); Log.d(TAG, "Read " + numBytesRead + " bytes."); } catch (IOException e) { // Deal with error. } finally { driver.close(); } }
๐ For a more complete example, see the
UsbSerialExamples/
project, which is a simple application for reading and showing serial data.โ A simple Arduino application is also available (in
arduino/
), which can be used for testing.Author, License, and Copyright
usb-serial-for-android is written and maintained by mike wakerly.
This library is licensed under LGPL Version 2.1. Please see LICENSE.txt for the complete license.
Copyright 2011-2012, Google Inc. All Rights Reserved.
๐ Portions of this library are based on libftdi (http://www.intra2net.com/en/developer/libftdi). Please see FtdiSerialDriver.java for more information.
Help & Discussion
๐ For common problems, see the Troubleshooting wiki page.
For other help and discussion, please join our Google Group, usb-serial-for-android.