Monday, February 14, 2011

Best way to write an app for both Android and iOS?

There was an interesting thread last week on Hacker News asking for opinions on writing cross-platform mobile apps.  Should you use a commercial framework like Appcelerator or Phone Gap, write core parts in C++ and custom UIs in Objective-C and Java, or just write everything twice?  Lots of opinions and some tips on when a cross-platform framework makes sense.


Kevin said...

Write it twice, do it native each time. Start on the platform where you are most comfortable, write it there, port it when done.

Trying to write it in sync does not work. You quadruple the work. Get it done once, let some people test it a bit and port it.

It looks so much better to have a native app on each device than one app that does not look right on either. Plus if you write it native you can debug it too.

Tools tend to write crappy code that can be nearly impossible to debug.

Donald J Organ IV said...

Check out sencha touch

horoscope(nepali) said...

use Adobe flash / As3 if your app does not require high resource and native calls

Ventrix said...

In that case you should consider developing a mobile web app

Don McCaughey said...

I generally agree with @Kevin, I think you create the best experience for the user when you write a native app for each platform.

I'm not familiar with Sencha, but I feel that neither HTML/JS apps nor Flash apps ever really match the smoothness of native apps, at least on iOS.

Android allows you to code parts of your app in C/C++ using the Android Native Dev Kit, so it's possible to share your non-UI code between iOS and Android if you're willing to write it in C or C++. For some apps, this can be a natural path -- write a self-contained core library in C/C++ and separate native GUIs for iOS and Android.

Another route, mostly for games, is to write in C/C++ for OpenGL. Both iOS and Android have hardware accelerated OpenGL. You'll still have to write some platform specific GUI code to get your app started and handle things like user settings, GameCenter integration, etc, but you can share a large fraction of your app code between platforms this way.