atxgeek 


just one more geek in a sea of austin techies

May 28, 2011

Android programming with Google AppInventor

This year I finally got around to joining the ranks of proud Android device owners (so long, Windows Mobile 6.5!) It was therefore only a matter of time before I dipped a toe into Android app development...

One of the nicer surprises I've run across is Google's own AppInventor development platform. This platform features a browser-based IDE and simple plug-in logic pieces. You build apps by dropping buttons, labels, images and the like onto a visual representation of an Android screen and then add logic via drag-and-drop "puzzle pieces". You've got to think like a programmer but there's no real coding involved (disregarding any RegEx expressions you might care to add). Thanks to this, the platform is an excellent tool to help introduce basic programming constructs to non-programmers.

The Upside
I "wrote" and deployed my first Android app to my phone in under an hour -- a feat I could repeat in about 15 minutes now that I'm familiar with the process. The app is my version of "Hello World" in that it simply displays a logo, launches websites or calls phone numbers based on the buttons pushed. Still, though, I was impressed by the ease at which I could build and deploy a working app to a platform that was completely new to me. Even better, because projects are stored in the cloud I can walk away from my AppInventor projects on one computer and pick back up using a completely different computer without need to manually synch project files and assets.

The Downside
My "Hello World" app provided four buttons to launch four websites and nine buttons to call nine phone numbers. It also displayed an 11-kilobyte logo and employed a 5-kilobyte custom icon. How big would you guess the app to be? Over the past week I've posed this question to a number of Android fanatics as well as a few software developers with no Android development experience. I've had guesses between 8-kilobytes and 400-kilobytes. The actual size? A whopping 4.3-megabytes of Google-generated code. I was stunned. After all, the app is really only performing two functions (shell out a call to the web browser or shell out a call to the phone dialer). At this point I have no definitive reason for the program's size -- my best guess is that AppInventor is bundling a number of libraries into the package whether they are needed or not. The most surprising aspect to me is that Google doesn't manage to optimize the code any better considering the code is generated by a Google-provided IDE and is targeted for a Google-provided platform. AppInventor started as a university project so the answer probably lies somewherre in the IDE's back story.

And in case you were wondering: Google doesn't yet provide a means to publish AppInventor apps to the Android Market *but* a number of people have posted instructions on how you can package your AppInventor-generated APK and manually submit the app to the Market.

Also also: Android APK files are basically ZIP files. You can peruse the file contents via WinZip, 7-Zip, WinRAR, etc. Included in each APK is an XML-based manifest which means I can very likely answer my own "why is this APK so big?" question via a little ZIP spelunking.

No comments:

Post a Comment