A little library to use Serial Port in Android


During my struggles with Bluetooth Low Energy (I have to write a burst of serious posts about this technology still in its infancy of opportunities but pretty promising) I had to deal with Bluetooth low energy modules and dongles made by Bluegiga. Bluegiga has made them pretty easy to use and it is possible to program them as a standalone bluetooth unit totally independent of where it is connected.

The problem arrives when you want to use this technology with Android devices. Android Bluetooth low energy support is relatively new (4.3) but there are a few capable devices of handling this connections. Most of them at this moment qualify as High-End Android phones or tablets.

There is another problem, Bluetooh low energy is a modern cool saving battery piece of engineering but It is not a best bluetooth. A simple example, if you want to stream data Do not use it, or use it at your own. In Android is worse, I compared data rate of Bluegiga modules and Android nexus 7 tablet and data rate was better in Bluegiga dongles. (I guess that is the prize of being far to the metal).

So I needed to connect my BLED112 Bluegiga dongles to Android as a Serial port devices, in order to do that I coded a little library to do it. I added support to CP210x USB to UART device. More devices must be added and some improves too, but I think it is not a bad piece of code and can get the job done.

It is not so asynchronous as I wanted (Read operations are asynchronous but write operations, if performed in a asynchronous way cause an awful bug involving Segmentation faults. This hideous bug was reported but It still there…

If you want to use it, just download the jar file from and added it to libs folder in your android project. Follow instructions to use it.

If you want to add something just let me know. Final device classes still shared code that could be moved to base class so I would rather refactor the code before adding new features.

Enjoy it!