Tuesday, November 30, 2010

State of GWT for mobile

I've been playing around with developing mobile apps using GWT. Using Java to output cross platform mobile apps seems like a no brainer. So I expected to find tons of examples, but that is not the case. I made a HTML5 offline web application demo for a recent talk on GWT. But this time I was up to create a real mobile app, something that could be published in an app store.

There are a variety of JavaScript frameworks (PhoneGap, jqtouch, Sencha Touch, titanium-mobile and others) tailored to mobile apps. But I could only find a GWT-wrapper project called gwt-phonegap for PhoneGap. PhoneGap has a very neat approach. It consists of two parts, one part is the actual JavaScript framework which provides access to mobile phone features including location data, accelerometer, camera, sound and more. The other part takes care of the integration of our HTML/CSS/JS code into a native mobile phone application. It sets up some type of WebKit view wrapped for all kinds of mobile platforms. Alas I could not get it to work properly. A new version of PhoneGap has been release just lately and gwt-phonegap did not play well with it (at least not in the Android emulator).

So I went back to the HTML5 route. There the a GWT third party library gwt-mobile-webkit which provides access to the HTML5 features of WebKit. That includes the W3C specifications W3C Web Database, W3C Web Storage, W3C Geolocation API and Application Cache API. I've only made a small test application using the location API. I've then used WebKit wrapper part of PhoneGap to make a native app for Android and one for the iPhone. That worked fine so far.

But I have to say, everything is kind of clunky, lot's of back and forth between the different project. And testing on the emulators is no joy either. I definitely want to go back to gwt-phonegap, having only one framework for everything could make things easier.

Anybody out there with a better approach?