Cross-platform mobile app development

I’m going to set aside a little time each week to blog about my experiences with developing Pintley. This is the first in hopefully a long-running series 🙂

Not long ago, I chose a platform for Pintley Mobile 2.0. I had some specific criteria, and not all of these apply to everyone.

  • Must be a native app-store app
  • Must use native-looking UI controls. An iPhone app needs to look like one, and an Android app needs to not look like an iPhone port. Nobody wants to be using the ported version, and reinventing the UI wheel isn’t for me.
  • Must perform, even last-gen phones
  • Must support at least iPhone & Android, possibly Blackberry, Palm, Win7

I looked into writing the app in HTML, and then just putting a “native” wrapper around it. I took a hard look at other apps that do this, and realized two things. First off, the performance just wasn’t quite there. These things responded like web pages, and that just wasn’t what I was looking for. The second problem I realized was that because it was HTML for multiple platforms, I would be facing the same headaches as HTML on the desktop… browser standards compliance & implementation. There are a couple platforms out there, like jQuery Mobile and Sencha Touch, but both platforms are not quite there yet, and would require heavy CSS trickery to “look” like native apps.

I took a look at Flex 4.5 & AIR Mobile, but the UI controls look like Flex controls, not native. Also, there’s no public info on if or when the iPhone Packager will be updated to support Flex 4.5.

Building both the iPhone and Android apps in their native languages and then maintaining both versions was cost-prohibitive.

I eventually settled on Titanium from Appcelerator. This neat little platform lets me build applications in their javascript-based language, which then gets compiled to a native application. It’s similar to how Flex works, in that you write your MXML, which is converted to Actionscript, and then compiled to a SWF. Titanium compiles the .js files to platform-native code (ObjC or Java), and then uses that platform’s SDK to compile to a native app. Yes, that means that there’s an abstracted framework sitting inbetween your code and the final compiled product. Yes, I’m sure that comes at a performance penalty. However, I really didn’t run into any big performance issues. The abstracted framework is there, but remember that framework is written in the platform’s native language.

Titanium’s SDK has been a breeze to pick up. My knowledge of Actionscript/Javascript really comes in handy, and if you’ve done a decent amount of work with jQuery you’ll feel right at home with Titanium. My main complaint is with the documentation… it’s a little inconsistent at times. For example, there are UI components in the main UI namespace (Titanium.UI) that are iPhone-only. Other iPhone-only UI components are in the iPhone namespace (Titanium.UI.iPhone or Titanium.UI.iOS). The documentation also fails to mention that these components are iPhone only… You don’t find out until you build it for Android and it crashes. The Kitchen Sink example project, however, is kept pretty up-to-date, and provides you with real working samples of how to get things accomplished.

Titanium’s IDE is exactly like whatever you currently use to modify javascript…. Mostly because they don’t have their own IDE. I have chosen to use Aptana Studio with an autocomplete header file. There’s also a bundle for TextMate.

The basic process for development is this:

  1. Install the iOS and/or Android SDK’s, and Titanium
  2. Create a new project, or import their Kitchen Sink Example
  3. Edit the .js code in your IDE of choice
  4. Hit the compile button in the Titanium Desktop application. This compiles the app and installs/runs it on your simulator or device.

The Titanium SDK is free and open-source. I, however, opted for the $200/mo professional option. The main reason is this option gives, among other things, access to their Appcelerator-moderated Helpdesk section, which has a two-business-day turnaround. I’ve easily saved $200 worth of time & headaches with my questions there, and you probably could, too. I don’t know if I’ll maintain the subscription past the launch of Pintley Mobile 2.0, but we’ll see.

So, follow me into my journey into building Pintley Mobile 2.0 for iPhone and Android.