Quick and Dirty Android Devel, Dude…

Well some dudes asked  me how to start developing apps in Android platform, what is the very first step, and what are next…

So, my simple answer is just do HTML5, since now many android devices support HTML5 smoothly, not to mention iOS. HTML5 itself supports WebSQL or sqlite for local storage. This feature alone is a great key feature to develop offline apps. What apps actually is: a form to fetch user inputs, javascript to process them, and storage to save them. All this process nicely done with only HTML5, and if you want an easier SQL access, just grab some libs out there, eg, jquery.sql.08a.js and html5sql.js, google them around.

Developing HTML5 for android is easy, even we don’t need emulator or a real device, what we need only a compatible browser and a cool editor. I used google chromium and sublime text for a test drive. Don’t use Firefox, because it doesn’t support WebSQL/sqlite for local  storage. If you live on Windows (not cool, anyway), you can use Safari web browser for better/more complete HTML5 supports.

One problem though, we must host the HTML files in a web server, and I found it: ServDroid, or if you really want a truly offline webapp, no need that ServDroid, but you must use Opera Mobile or Dolphin Browser for local browsing. Internal HTML Viewer/Browser cannot open local HTML file due to permission and or security, YMMV though…

One more problem, if we use HTML5, we would see the ugly space eater: address bar! How to make it lost?? Some lines of script will do, but we must have a scrollable (long) content, otherwise use Dolphin Browser, because it can be set fullscreen. Unfortunately, Opera Mobile fullscreen mode still displays its own big address bar.

I myself prefer making launcher for it, and Phonegap is the answer. Here are my un-details steps:

  1. Install android-sdk and its friend (for archer: sudo packer -S eclipse-android, damn slow and big files, beware)
  2. Download phonegap
  3. Create new android project using eclipse, while reading phonegap tutorial (just 5 minutes, copy-paste, run)
  4. Success on emulator, install to actual device, must be success too.

What I tried here was a simple Hello World typical program (but it loads jquery and jqm), but that’s the idea. If a simple HTML5, and its jquery and CSS3 are works great, next is editing apk contents to suit our needs.

Editing APK files? But why?

Phonegap and all CSS and JS and HTML live in /assets/www, so if we need to modify some logic or add some features, easiest way is to edit its contents, right?

So here we need apktool, go install it (arch: sudo packer -S android-apktool), and do these:

  1. apktool decode com.test.phonegap.apk test
  2. modify what you want in test/assets/www
  3. cd test && apktool build
  4. look for the new apk in test/dist
  5. apk is ready, but we still need to sign it first so we can install it. Eclipse build automatically made it signed anyway.

And for APK signing, do these:

  1. keytool -genkey -v -keystore key.q -alias <your_name> -keyalg RSA -keysize 2048 -validity 10000
  2. jarsigner -verbose -keystore key.q <new_apk> <your_name>
  3. now the new apk is signed, last step is installing it to a real device, I used adb and adb wireless to install it.

Here is a screenshot of my modified APK to run jqmphp generated example:


I modified this webapp so it would run in fullscreen and hide android default status bar (and of course browser address bar). It’s very convenient and a lot more easier than to develop in pure android java/native C. Unless you want to develop a high speed app, you’ll safe with just webapp…

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a Reply


Skip to toolbar