Introducing DesktopDroid: my “Hello, World!” app for Android
March 7th, 20111. Intro
Plunging into Android development was something that I hadn’t done before. The closest thing to it was playing around with Java Micro Edition to target good-old Nokia hardware back in the day.
Making myself familiar with the development of Android applications was definitely an overdue task. Especially after the recent events. I’m back at Warp Networks, an open source consultancy company that, among other awesome things, kicks ass at developing software for mobile platforms.
I needed to write my first app but didn’t want it to be yet another tasteless, void of practical use “Hello, World” thingy. It occurred to me that it could serve a real purpose.
I tend to turn off my mobile phone’s ringtone most of the time – it’s just I hate to annoy people around me with it. The side effect is I also tend to miss calls. However, whenever that happens, chances are I’ll be in front of a computer screen.
I can easily make a case that having a piece of software that notifies me of phone events on my desktop computer would be useful for me.
It didn’t take much to convince myself of it, and decided that DesktopDroid would be my first Android app. Note that I didn’t check if there was something similar as the point was to start getting my hands dirty with Android.
It’s not just only one app but a set of three different apps. To ease the deployment and speed up the set up process, both the android and desktop app will use a server to talk to each other.
2. Android app
desktop-droid-mobile is the Android app. This is the software that you need to install on your phone. It takes care of capturing phone events and sending them to the server.
2.1. Service
An Android service is a component that represents a piece of code that is meant to be run for a long time. As in opposed to activities which are, roughly speaking, meant to be run to interact with users.
This app’s service is used to listening on phone state changes. Whenever an incoming call is detected, it will then contact the server via HTTP to notify of such an event.
2.1. Activity
Our activity is the app’s UI. It takes care of configuring the service:
- Server to contact
- Identifier
Note that Identifier is just a way of binding your mobile app and your desktop app. It should use a user and password authentication mechanism instead. However, for the sake of clarity and testing purposes it is just a random string that is created automatically.
This UI also allows the user to start and stop the service.
2.3. Installing the app
You can download the package from https://github.com/downloads/foolano/desktop-droid-mobile/desktop-droid.apk or use the following QR code:
3. Desktop App
desktop-droid is a PyQt4 application that needs to be installed on your desktop to display notifications.
When it comes to GUI toolkits, I must confess my bias towards this fantastic framework. If doing some Qt work on C++ is a nice experience, having a dynamic language as Python makes the task of prototyping very pleasurable. Let alone the multi-platform aspect, which only comes down to packaging.
This app will create a system tray icon that will display the incoming calls on your desktop.
3.1. Installing the app
I packaged the desktop app for Debian and Ubuntu. The package can be download and installed from:
https://launchpad.net/~juruen/+archive/desktop-droid
4. Server app
desktop-droid-server is a web app coded in Perl that makes use of another awesome framework: Mojolicious. It uses Mojolicious::Lite. It is ridiculously easy to use. It supports WebSockets, has literally no dependencies, making its deployment a piece of cake.
Note that you don’t need to deploy a server. You can use a default one that is already available on the Internet. But feel free to grab the code and deploy your own.
5. Conclusions
The documentation and development environment of Android are a big win. You can start to run stuff on the emulator in a few minutes after downloading the relevant Eclipse plug-ins. Although I’m not a big fan of Java myself, Eclipse does a great job in writing boilerplate code for you.
It’s a lot fun to split a little task like this into three pieces and using three different languages depending on what suits best: Java, Python and Perl.
I have in mind a bunch of features that I would like to add to this project. Hopefully, I’ll find some spare time during the next few weeks.


