Extending Android XML-RPC to support regular Java serialization

For my current Android project I wanted to have some communication with a server component. After spending some time on finding a decent solution I arrived at XML-RPC.

A client would use this code to ask the server the sum of two numbers:

int sum = (Integer) client.call(“Calculator.add”, 2, 4);

The server side would have a class “Calculator” with a method “add”, like so:

public int add(int i1, int i2) { 
    return i1 + i2; 
}

Nice and clean!

For the client (Android) I use Android XML-RPC and for the server side I use use Apache WS XML-RPC. It is not possible to use Apache WS XML-RPC on Android out of the box, as there are some issues relating to the core Java classes that are supported on Android. I am sure you could get it running with some effort, but then you still will add hundreds of kilobytes to your app because of the jar files that need to be included. Android XML RPC is around 50 kilobytes, which is much nicer from an end-user perspective.

By default there is a limited set of “data types” that can be used and I want to use my own “data types” (like “User”, “Project”, etc.). Apache XML RPC has a special mode “enabledForExtensions”, if you check that option it will give you access to the use of longs, shorts, bytes, floats, DOM nodes, instances of java.io.Serializable, or JAXB objects. This is only handy in a use case that has Apache XML RPC on both client and server. So not in my case!

Luckily, it is easy to extend Android XML RPC to allow other data types. You just have to add some code to the XMLRPCSerializer class. As I only wanted support for deserializing objects I added an extra if clause to the deserialize method:

} else if (typeNodeName.equals(“ex:serializable”)) { 
    obj = null; 
    String value = parser.nextText(); 
    BufferedReader reader = new BufferedReader(new StringReader(value)); 
    String line; 
    StringBuffer sb = new StringBuffer(); 
    while ((line = reader.readLine()) != null) { 
        sb.append(line); 
    }

    ByteArrayInputStream bais = new ByteArrayInputStream(Base64Coder.decode(sb.toString())); 
    ObjectInputStream ois = new ObjectInputStream(bais); 
    obj = ois.readObject(); 
    parser.nextTag(); 
    // parser.require(XmlPullParser.END_TAG, null, ..

    return obj;

} else {

Pregnancy Ticker has been downloaded over 100.000 times!

Well, I never saw this coming. Originally made for following the progress on our baby Tristan, who now is 1.5 years old. After releasing it in the market many nice comments were added and requests for features were mailed. So I added some extra stuff and within 2 years it passed the 100.000 downloads barrier. It is very difficult to imagine 100.000 persons using Pregnancy Ticker – it means that the progress of thousands of pregnancies has been followed with it – unbelievable.

I am planning to add more features to celebrate this moment and am actually working on one right now. It is a bit of a technical challenge, but more about that later.

Thanks for all the nice comments and best wishes!

Approaching 50,000 downloads for free Pregnancy Ticker

Today I saw that the download counter for the free version of my Android application “Pregnancy Ticker” is approaching the 50,000 mark. My estimate is that it will pas this milestone before the end of the month. It’s difficult to believe that such a huge number of expecting parents are consulting my application regularly, it’s an honor!

Pregnancy Ticker has been downloaded over 20,000 times!

It started as a simple tool to keep track of how far along my wife was. I put it on the market thinking that that at least a few other persons could enjoy it. So when the downloads counter passed the 20,000 mark it was a rather strange experience!

Never did I expect it to be so popular and loved. People write the nicest comments.

Because of the high demand I also get a lot of mails and request which I enjoy answering, it is not that much work. Also I decided to put out a paid version of the application as an answer to some of the most popular requests. One of the requests is to have week by week images of the baby its progress. For this I hired an artist who is working on the images right now.

Installed Android 1.5 (cupcake) on the dev phone

After reading the Android blog entry about releasing 1.5 for the dev phone I could not resist installing it. By following the instructions on the HTC site all went well. I used the ADB method (image recovery) No problems whatsoever!

To get a connection with the phone network operator I had to reboot a third time (1st time: radio firmware, 2nd time OS 1.5).

My first impression of the GUI is that it is a bit sleeker, but sometimes feels slower.

Video recording and automatic screen rotation both work well. The touch keyboard and voice command options are welcome new features.

Progress on GPS parking pilot Amsterdam

After more testing and developing the GPS parking beta seems more viable than ever. Currently all major zones have been added and only the 10 cent and limited time parking areas have to be added.

This is the new main screen. As you can see there is an extra button that allows for selecting a zone by map.

This is the map screen. The screen is in ‘manual mode’ because the GPS is not turned on or available (e.g. indoors). The user can tap on the zone where he is parked and the application will retrieve the zone information.

In GPS mode this is done automatically.