How to create mobile apps with PhoneGap

Making a “hello word” application for my android mobile phone was in my Todo-list for ages, and last night (the flu blocked me home) I spent a couple of courses challenging myself to develop a mobile application starting from scratch (including downloading and setting up the needed tools).

I decided to use PhoneGap, at which I had a look last spring and it soon looked great: using CSS and JavaScript to develop cross-platform (Android, iPhone, windows mobile).


I timeboxed my hack-night and I kept things super simple, opting for the PhoneGap desktop app to run the server (the mobile phone connects to it, downloads and execute the code in real-time, in beta version and sometimes not refreshing as expected) and for the  online compiling tools (free up to one application, a bit slow but they do the job).


The only problem I had was the layout. The PhoneGap CSS layout didn’t suit my needs and I started with a new one, ending up spending most of the time with font size and media queries to render the application properly on different devices (the app executed via the desktop app rendered differently from the compiled APK one on my Nexus 4).

Coding !

This was my “hello world” application so I kept it simple, without any complicated phone API interaction, just a calculator for runners (insert distance and time, calculate velocity).

running tools android appApart from understanding where to load the events (I had two different ways to do that, and none of them worked as expected, I think due to a non-back-compatible old event system), the JavaScript code worked like a charm on my local browser as on the mobile phone.

Download & repo

If you want to give at try, download the APK. Source code on Github. It asks for lots of permissions, but don’t worry, I just haven’t had the time to take out the one I didn’t need from the default settings.

The app compiled in a 480Kbsize APK file, that is good considering the app wasn’t written in the native Java language, and I haven’t even spent a second trying to strip out the unnecessary stuff (nobody cares about size, do you ? ;-))


Nice, uh? take a coffee and impement your own !