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!
- On May 13, the jury of the SFR-Android contest selected our Restlet project for a special open source prize! Thierry is now the happy owner of a HTC Magic phone 🙂
- New post: Restlet, a RESTful middleware for GWT, GAE and Android