jump to navigation

Restlet available on Android phones May 6, 2009

Posted by Jerome Louvel in Android, GWT, Restlet, Restlet General.

Our vision is that the Web is becoming ubiquitous and that REST, as the architecture style of the Web, helps you leverage all HTTP features. Restlet, our open source REST framework, is already available on regular computers based on Java SE/EE, in Web browers with our GWT edition and even in the cloud with a new Google AppEngine edition. But, we are still missing the Mobile Web!

With the commodification of smartphones started by the Palm Treo and pushed further by the Apple iPhone, more and more mobile users will have a usable access to the Web from their phone. So far, developers have been stuck with proprietary platforms and where lacking the productivity and portability common in the Java world. But here comes Android!


Android is an open source mobile operating system initiated by Google but now managed by the Open Handset Alliance. This consortium includes prestigious constructors such as HTC, Motorola, Samsung or Sony Ericsson and larger carriers such as Sprint, T-Mobile or Vodaphone. Needless to say that Android has gained a lot of traction recently.

Technically speaking, Android is built on a customized Linux kernel, libraries such as WebKit for the Web browser  and an extensible Application Framework developed in the Java language but running on a special Dalvik virtual machine (see a complete overview here). All the built-in applications are written in Java and can accessed or customized via an Android API.


Preparing for an imminent launch of the Android-powered HTC Magic phone in France (also known as the “G2”), the mobile operator SFR, one of the third largest in France, has announced a contest for the best Android application. We thought it was a perfect opportunity to port the Restlet framework to another exciting environment and applied as a “Restlet+FOAF” project.

With some adjustments (see technical details), we were able to port Restlet on Android, with both the client-side and the server-side HTTP connectors! To show the potential of Restlet on Android, we decided to go further and develop a simple extension to the Contacts applications that would retrieve the FOAF (Friend-Of-A-Friend) profile of your contacts, show their friends and let you add some as new local contacts. The source code of this sample application is available and documented in the Restlet User Guide.


With the help of Manning’s “Unlocking Android” book, we also discovered Android’s Intent/Service design pattern, which is quite similar to Eclipse’s plug-ins. This is a powerful way to extend Android applications and share common features. In our case, we developed a FOAF Service that can be reused by other Android applications, without tight coupling on our code.

Finally, with the growing number of Restlet editions, we felt the need to put in place an automatic porting process to keep the code changes synchronized. This effort is underway but you can already read its specifications in our developers wiki. All those new features are available in recent Restlet snapshots. Enjoy!




1. Gabriel Kastenbaum - May 6, 2009

I do agree with your way to see the future:
* services availables “somewhere” – on a Google App Engine plateform or any other plateform.
* Different types of clients : Android, but also RIA clients – flex, but why not javascript clients written with GWT or with JQuery?
* Communication with REST services. Here we need Restlest. Or – why not – if you are on a php server – using some php script
With that kind of architecture developping available services become easy. Then you just have to convert and integrate the values that you receive – this is not the smallest part in reality, but this part should be improved in the future. If you are interested, you can have an eye on our blog where we published some studies about that kind of architectures and where we related the problems that you can encounter – it’s in french (blog.oxiane.com)

2. Jerome Louvel - May 7, 2009

Hi Gabriel,

Yes, we are on the same page. The idea is to fully leverage REST/HTTP to decouple clients and servers which can end-up being located in various places. A key feature is content negotiation which can be leveraged to adjust representations to the capabilities of the clients (GWT, jQuery, Silverlight, Flex, etc.) on the server-side.

Regarding the serialization of values/objects into representations (and vice versa), we are making significant progress for our next Restlet 2.0 release (due at the end of 2009). See for example the new ConverterService and the new Resource API.

Best regards,

3. Restlet 2.0 M3 released « Noelios Technologies - May 27, 2009

[…] growing number of special Restlet editions (Java SE/EE, Google Web Toolkit, Google App Engine and Android), it seemed appropriate to rename the Restlet 1.2 branch into Restlet […]

4. selem - August 10, 2009

url to the android sample application should be http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/266-restlet/269-restlet.html. the blog post refers to a 404 location.

5. Restlet 2.0 M4 released « Noelios Technologies - August 25, 2009

[…] that we support: Java SE, Java EE (with Servlet support), Google Web Toolkit, Google App Engine and Android. In addition, the porting of the main source code base to each edition is now fully automated, […]

6. harold - August 26, 2009

i have a question about using Restful-Webservice with Android. For example i have a Webservice where i save all my contacts/friends. So in Rest every Friend is a Ressource. For example if i have 20 Friends, then the Client asks for the Friends and gets a List of 20 IDs, and then he must make 20 Request to get Information of every Friend. If im making a URI like “…/clientid/getallfriends” on the Serverside, from which i get directly all 20 friends in the Response, then its a anti-pattern in REST. But how can the first solution be efficient in the mobile evironment, cause the network is slow and unreliable and every request needs batterypower? In the first solution i have 1+20 Requests, in the second i have only 1 Request. I really want to understand. Thank you

7. Jerome Louvel - August 26, 2009

Hi Harold,

It not unRESTful at all. You might want to use query parameter to control the depth of your representations. Having both seem useful.

What also seems important is to be able to access to each friend independently, if necessary.

Best regards,

8. Restlet, a RESTful middleware for GWT, GAE and Android « Noelios Technologies - December 17, 2009

[…] Android for deployment on compatible smartphones […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s