Long-time readers may recall my 2008 article entitled How to write an iPhone App in 14 Days. In it, I detailed my experiences during a long Christmas break when I, as a neophyte iOS developer, wrote an iPhone app from scratch and got it into the Apple App store in 14 days flat.
If you read through the article closely you might remember that I had some problems following the rules and playing in the Apple-approved sandbox. So I ended-up uh, "straying" a bit (my Kindergarten teacher would not be surprised). I got by with this for awhile, but eventually the app-approval gnomes caught on to me and I was expelled. Oh, the shame of it all...
In reality, I couldn't have written my app using the Apple-approved interfaces. My app used a screen-saver type display that needed access to all camera images simultaneously and the only Apple API available allowed selecting one photo at a time.
The app-store approval followed by the later rejection, coupled with the lack of an API to get the images my app needed, soured me a bit on developing for the Apple iOS ecosystem. Maybe it was time to pack my bags and go. I eventually let my Apple Developer Account lapse, picked up a new Android phone and crossed the DMZ into the Android camp where I have a brother firmly entrenched at Google.
In this article, I'll describe how I changed allegiances and ported my original iOS app to Android. I'll give you some basic pointers to get you started and add an overview of my real-world experiences.
When I ported my app to Android, I also changed development languages and added a lot of new online-type features. So in many senses, it was a brand-new effort just loosely based on the original. I had new considerations and additional design tradeoffs, so I'll cover those too. And along the way, I'll compare and contrast my Android experiences to what I found under Apple's iOS process.
Setting Up For Development
This won't be an Android App development-tutorial, as there are plenty of those around. But if you're interested in trying the platform yourself, this section will be a basic overview.
The first thing you'll need to do is get the appropriate development tools installed. A benefit for Android developers is multi-platform support. When developing for iOS, your one-and-only choice for a development platform is Mac OS. That wasn't a problem for me, because I've been on the Mac platform for years. But Linux and Windows developers are left out in the cold. With Android however, Linux, Mac OS and Windows developers are all welcome.
iOS apps are also developed almost exclusively using Objective C, which is a language that few outside the Mac world use. In contrast, Android apps are typically written using Java, which has a much wider developer base, which means more utility libraries, documentation and online code examples.
As far as tools, you can build Android apps using the command-line (yep, some people still do that), but typically you'll be using the Eclipse Integrated Development Environment (IDE) coupled with Google-provided add-ons for Android development. (Figure 1).
Figure 1: Android Development Using Eclipse
Basically, you'll start with a valid Eclipse installation and then add the Google tools on top. This environment is easy to set up and includes an Android emulator (Figure 2), so you can start your development without having physical hardware.
Figure 2: Android Emulator
The standard emulator looks fairly boring. If you want to get fancy, you can skin the emulator to look like various devices, but that's really just eye-candy. The main benefit for the emulator is allowing you to try your app on different variations of hardware including screen resolution, OS version, available memory, etc.
How does the emulator perform? My development platform is a fairly beefy dual-core MacBook Pro and the emulator is a bit slow to start. But once it's going, it runs OK for normal use. Unfortunately for me, my new app, like the original iOS version, isn't quite "normal".
It's OpenGL-based, which really needs direct hardware access and is not well suited for emulation. I would only get a few frame-per-second out of my app when running. And even with non-OpenGL based apps you'll likely be much happier installing onto a device rather than using the emulator.
If you've got a Android phone handy, it's quick, easy and free. Contrast this to iOS development where you'll have to pony-up $100 before you're allowed to install an app on a physical device. With Android, you can install your app right off the bat and pass it out to whoever you like. Nice.
Once you have the Android tools installed with your Eclipse installation, you're ready to go. Figure 3 shows a typical Eclipse window for editing, compiling, debugging and running your app.
Figure 3: Monitoring a running Android app using Eclipse
For me, Eclipse is a familiar environment that feels much more modern and full-featured than the Xcode that is used for iOS development. The refactoring, autocomplete, continuous compilation and subversion integration made me feel right at home.
But one area where the Eclipse/Android development area lags behind is in user-interface development. The Xcode suite has nice tools that allow you to interactively create user-interfaces and automatically tie them to your code. For me, this was of little use since I wasn't planning much in the way of a user-interface. My main functionality would be at the OpenGL level with just some simple preference interfaces.