32

Is there a strategy or at least best practice to write an app that runs on iPhone, BlackBerry and Android?

I'm ignorant about the development environments for BB and Android, but I assume they both support Java apps.

I know that the iPhone would require an ObjectiveC portion (as well as a whole new UI).

Has anyone done this?

Michael Pryor
  • 25,046
  • 18
  • 72
  • 90
  • Can/should you include iPad and Android-based tablets in the mix? – ripper234 Nov 05 '10 at 18:57
  • Low level too? Then here: http://stackoverflow.com/questions/5393844/common-ide-to-develop-mobile-applications-and-deploy-it-to-iphone-android-black/6986237#6986237 –  Aug 08 '11 at 17:54
  • duplicate of http://stackoverflow.com/questions/51988/what-work-has-been-done-on-cross-platform-mobile-development/ – Gabor Oct 20 '11 at 11:00
  • I have done it, what you will find out is that even the best (I will not say names), have limitations. They are good for simple apps, but if you want some flashy really native apps then you still have to develop a good portion of the code for each platform, and then reuse the rest of the code. – Oscar Gomez Feb 10 '12 at 14:05

12 Answers12

21

You might want to check out http://phonegap.com/

cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59
  • 1
    I've used it a few times. While it's obviously as not full-featured as writing a native app, its excellent for small, cross-device apps – cpjolicoeur May 04 '09 at 17:42
  • Just watched the movie. Perfect. Thank you! – Michael Pryor May 04 '09 at 21:22
  • 1
    Just so you know, the phonegap framework, as of this writing, does not offer a unified persistent storage mechanism between the platforms. This has been a major source of pain for those of us trying to write-cross platform apps. There are also many other differences between the platforms, so, as you start your project, you'll want to make a concerted effort to establish which techniques are available to you. – JJ Rohrer Jun 19 '09 at 15:18
  • Is this answer also applicable to iPad? – ripper234 Nov 05 '10 at 18:57
8

One technique, that works suitably for certain kinds of apps such as reference applications: Use HTML/CSS/JavaScript and write compact clients that uses the platform's HTML viewer object to read locally embedded web content.

One technique to write cross-platform application that ran on both BlackBerry and Windows Mobile, was to write it all in HTML. I had to use a subset of HTML and CSS that worked on both BlackBerry Browser and Pocket Internet Explorer. I used a small amount of JavaScript as well.

I wrote very small viewers that ran it off internally-stored HTML and images using jar:// (BlackBerry) and res:// (Windows Mobile) URL's. I was able to embed all the HTML and images files as part of the BlackBerry application, by using a custom version of the browser field and . Same for Windows Mobile, I was able to use Pocket Internet Explorer as an embedded ActiveX in my Windows Mobile application.

Note -- for BlackBerry, I had to support legacy devices running OS 4.2. To do so, I recycled a lot of RIM code samples, such as SecondaryResourceFetchThread.java to pull images embedded in the application, and deliver it to through a custom connection object that implemented HttpConnection that I designed to handle jar:// URL's for internally embedded HTML/images in my BlackBerry application. It was a little tricky to figure out. For Windows Mobile, it was more intuitive.

There are other ways to do what I needed, but it worked perfectly for a medical reference application, and I was able to design separate CSS files for BlackBerry and for Windows Mobile to reformat the content slightly differently for the two mobile devices. (It was kind of like testing Netscape versus Internet Explorer compatibility in the old days.)

This may not work for your situation, but if your application is a web-style 'reference' application, and you know how to do HTML well, this approach may work.

Mark Rejhon
  • 869
  • 7
  • 14
5

We are currently looking into this also and we found:

Titanium

Kony Solutions

These products have good reviews. The Titanium is free for the community edition.

Rahul Sharma
  • 2,867
  • 2
  • 27
  • 40
nigel
  • 51
  • 1
  • 1
4

Another option to look at is Rhodes, which is a Ruby framework.

Brian Deterling
  • 13,556
  • 4
  • 55
  • 59
1

also if you're writing games, check out my cross-platform (iPhone, Android, etc.) solution called the Cuttlefish Engine, at http://www.cuttlefishengine.com.

1

Also, you could give a try to Mobile Community Framework (MCF). This is a crossplatform framework running natively on iPhone, Android, WinMobile, Symbian and BlackBerry. MCF handles network, location and proximity operations for you, in a Wi-Fi Ad-Hoc network or through dedicated proxy server if no direct connection is possible. It has simple API, and it's free to use. This way you can develop your app interface and logic separately on each platform, and use MCF to connect instances of your application in a way you like.

More info at http://uvamobiltec.com

Haspemulator
  • 11,050
  • 9
  • 49
  • 76
1

You can always write a javascript app on the web, and it should work on all three. Of course that doesn't get installed on the phone.

Android has a webview that runs Javascript. I'm sure the other platforms do also. If you wrote most of your logic in javascript, you could may be able to reuse that javascript across platforms.

Jay Askren
  • 10,282
  • 14
  • 53
  • 75
1

Yet another framework is http://www.mosync.com/

It seems to support all major platforms.

joepal
  • 319
  • 1
  • 3
  • 4
1

If you want to write cross-platform web app, SenchaTouch or Phonegap is a good choice.

If you prefer native app, the best cross-platform solution is Titanium. Using Titanium, you can write you app in Javascript, and it compiles JS to native code (Objective-C, Java...)

Rahul Sharma
  • 2,867
  • 2
  • 27
  • 40
anticafe
  • 6,816
  • 9
  • 43
  • 74
1

Adobe Flex and Flash Builder looks promising too. Still you should consider its proprietary, but with the video on their developer center website seems like it worths it. By the way, the latest release Currently supports Android. The support for iOS is supposed to be out in June 2011 through an update.

Max.Mirkia
  • 579
  • 6
  • 6
1

When writing multiplatform apps, you need to decide how much of the code to share. The 2 options are

  • Everything. You use (write) cross platform gui libraries and system routines
  • The logic is cross platform but the presentation layer is platform specific

The 2nd approach tends to give better apps but it is a more work (assuming you don't need to write the cross platform libraries).

The tricky thing with the mobile world is picking a language. Right now you have

  • Java: Android, Blackberry, Java ME phones
  • Objective C/C: iPhone, windows Mobile
  • Javascript: Palm Pre

You can cross compile java to javascript and vice versa. You can also compile java to C or use a javascript engine that you can call from C. I don't think you can run C on a java/javascript phone. That leads me to suggest writing your code in Java/Javascript. Cross compiles (and mixing languages in general) have the downside of making debugging a bit harder.

Mike Spross
  • 7,999
  • 6
  • 49
  • 75
hacken
  • 2,135
  • 11
  • 11
1

http://j2mepolish.org could be good choice, however, iphone is only in the roadmap. But android and BB are already supported as well as all other j2me phones.

  • 1
    Now if only J2ME itself didn't suck so horribly, that might be a useful solution. – davr May 04 '09 at 21:40