rtl_tcp port for Android

Мартин Маринов martintzvetomirov at gmail.com
Wed Jan 30 12:37:53 UTC 2013

I am pleased to announce I have released an RTL2832U driver for android for
the benefit of all of the developers working on SDR.

The app could be found here


And the sources are released under GPL2+ here


So how do you use it in case you want to develop your own Android
application that uses rtl_tcp_andro?

It's quite simple, you need to add just one line of code to your existing
Android app (assuming the user has the driver installed).

Intent(Intent.ACTION_VIEW).setData(Uri.parse("iqsrc://-a -p 123",

Where START_REQ_CODE is a random number you assign. This will start
rtl_tcp_andro on the localhost at port 123. As you see the thing after
iqsrc:// is just the command line arguments you pass to a regular rtl_tcp.

If you want to be more fancy and do error capture, you should override this
method in your Android activity and perform error detection as so:

* protected void onActivityResult(final int requestCode, final int
resultCode, final Intent data) {*
* runOnUiThread(new Runnable() {*
* @Override*
* public void run() {*
* if (requestCode == START_REQ_CODE) {*
* if (resultCode == RESULT_OK) { // rtl_tcp_andro has been started
* else {*
* try {*
* switch (data.getIntExtra("marto.rtl_tcp_andro.RtlTcpExceptionId", -1)) {*
* case 0:*
* // exception - permission denied*
* break;*
* case 1:*
* // exception - root required*
* break;*
* case 2:*
* // exception - no devices found*
* break;*
* case 4:*
* // exception - the user needs to reconnect the device*
* break;*
* default:*
* // unknown exception*
* break;*
* }*
* } catch (Exception e) {}*
* }*
* }*
* }*
* });*
* }*

It is that simple! rtl_tcp_andro will take care of showing different
dialogs to the user for device selection. It will also take care of
non-rooted devices by communicating with rtl_tcp_androi and sending the
appropriate file descriptors, etc. You don't need to worry about all of the
magic that is happening in the background - you only need to monitor the
result of your intent request.

If you get *RESULT_OK* then you are ready to go. Now what remains is to
implement your own TCP client that connects to the appropriate host/port
number and communicates using the *rtl_tcp* protocol. Make sure you send
the additional "exit" command that rtl_tcp_andro has in order not to leave
zombie services behind.

That's all if you have any questions, feel free to contact me! Sorry for
the bad state of the source code of rtl_tcp_andro, I will add comments as
time passes by.

Hope to see great new projects on the Android platform :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/osmocom-sdr/attachments/20130130/3ec0a501/attachment.html>

More information about the osmocom-sdr mailing list