Original URL: http://www.theregister.co.uk/2008/10/06/dziuba_android/
Sergey Brin descends from Mount Sinai with Android API
The Ten Commandments or a waste of time?
Fail and You If there's one thing that's never affected by economic downturn, it's the mobile handset market. This phenomenon is most evident at the underground parties and dive bars in San Francisco, where it is a well known yet unspoken tradition that in any given group of hipsters, the one with the cheapest phone must always buy the first pitcher of Pabst Blue Ribbon.
We're in the middle of a recession. And Google Android is about to enter a market that's quickly being dominated by a company whose expertise is making cool shit that you think you need. But I'm still absolutely certain I didn't just waste the last six days of my life learning Google's API and writing an Android application.
You Have An API, Now What?
Google released version 1.0 of the Android SDK late last month, and nobody really cared. Someone has to give this thing a little love, though. It's an open API, free documentation, and Google won't hold an iron grip on the application market's balls like Apple does. The main draw, though, is that Google is trying to smooth over a lot of the friction for a developer who wants to get started.
One of the many reasons that programmers love to make APIs is that they get to write code that doesn't actually do anything useful and still feel like they've handed the commandments down to Moses. That is to say, it's easier to draw shit on a white board than it is to write a program that people actually want to use.
With the Android phone, you get all sorts of neat doodads: a GPS locater service, an accelerometer, WiFi, 3D graphics, and a system for playing audio and video. Pretty cool, but what do you do with all that? Sergey Brin wrote a game changing, disruptive application that detects how long the phone stays in the air when you throw it. Fascinating.
Identifying the target market for my application as hipsters who live in San Francisco, I came up with an idea. People in San Francisco have a problem: When they venture outside the city - to Napa for a wine tasting, for example, or to Lake Tahoe for snowboarding - they run a pretty good probability of entering a town where there is a Republican majority. Now, running into someone with an opposing world view is either a blessing or a curse for a San Franciscan, depending on who you ask, but in either case, it would be great if something could notify you when you step into red territory.
Google's phone will have a GPS, and California provides statistics on voter registration, so this is a match made in Mountain View.
Ten Points For Gryffindor
All Android development is in Java, and Google has fortunately provided an Eclipse plugin for their SDK. The integration is very clean, save for some standard issue bullshit you'll need to go through to get JUnit to work with your Android project. If you're going to attempt an Android application without Eclipse, enjoy your bookkeeping: There's manifest files that need to be written, Python scripts that need to be run to generate some boilerplate code, bytecode that needs to be reinterpreted, and a bunch of other shit that you just don't want to deal with.
Google also provides an emulator for the device. As emulators do, this one runs balls slow, taking more than two minutes to start up on my 1.5GHz Athlon. Thankfully, you can keep the emulator running and load new code into it.
The API itself is decent. I only played a couple of rounds of how do I find the objects I need to instantiate this fucking thing, clicking around the Javadocs. I used the geocoder interface along with the location API to figure out what town the phone is in, then cross referenced that with my voter registration data to figure out the probability that any given person you see on the street was a Republican.
Developing the GUI in Android will bring back some horrific memories of Swing programming at first. You can make the whole UI programmatically if you're into that sort of thing, but Android encourages you to use XML to design the interface. It makes for cleaner code and is easier for someone who has had their soul gradually worn down to a nub by web programming for the past several years.
Morph The Screen Into Something Cool
What I had originally set out to do was write an application that runs in the background and constantly monitors your GPS coordinates, reacting when it needs to. Using Google's examples, I wrote a program that can poll the GPS and check your location every time it's run, but the run-in-the-background thing eluded me. I know that it can be done, I just didn't really feel like taking the time to learn Android's whole programming model. Why? Because I'm a hobbyist with a short attention span.
Google's hoping to attract a lot of developers by having an open platform, but I don't think they realize that a lot of developers have better shit to do than tinker around with a cell phone, especially if the tutorial is as much fun as a tax return. Developers are users, too. We need a good interface.
The first part of the tutorial is a Hello, World. Once I get beyond that, I want to do something neat. The second part of the tutorial is a notepad application. Notepad? It's a cell phone with all sorts of gizmos. Show me how to make it beep and shit. The documentation's goal is to remind me why I'm spending my free time squirreled away in the computer room and not sitting on the couch drinking a beer.
In any event, Google's if-you-build-it-they-will-come approach is probably no match for a slowing economy. The phone will be priced at $179, but Google and T-Mobile will likely be able to flood the market and start eating Apple's lunch if they accept collateralized debt objects in lieu of cash. ®
Ted Dziuba is a co-founder at Milo.com You can read his regular Reg column, Fail and You, every other Monday.