There are many differences between the two types of application. I’ll highlight what I think are the most important ones, and point out areas where there isn’t really a difference.
CLDC Applications have more flexibility in their lifecycle than MIDlets do – at least on BlackBerry. Specifically, a CLDC app can start when the BlackBerry starts (or reboots) and it’s easier to get it to run in the background to do listening, processing, etc. For many apps, this means CLDC is your only choice
This is the big one. RIM has developed a rich UI library (in Java) for the BlackBerry. It’s designed to take full advantage of the BlackBerry input (keyboard, trackball and touchscreen on the Storm), and provides a lot of pre-built components. I’ve written about it extensively. The MIDP UI library just doesn’t give you the same power. To approach the complexity of a ‘native’ BlackBerry UI requires you to re-do a lot of the work that RIM has already done, and even then there are things you can’t do.
Some specific advantages of the BlackBerry UI library over MIDP (all in context of running on a BlackBerry of course):
- Rich set of components, managers, screens
- Access to trackwheel events
- Easy access to all the BlackBerry keys (including ALT, escape, the softkeys)
- Ability to provide the appropriate menu depending if the trackball or menu key was pressed
- Integration of BlackBerry components (the browser, BlackBerry Maps) into a screen in your application
- Built-in support for localization
- Accelerometer support for Storm
- Touch-screen events for Storm
- Ability to change the homescreen icon
Let me know if there are some I’ve missed.
Things that can be used by a MIDlet or CLDC application
Contrary to what I’ve heard in some places, you can use a lot of the BlackBerry specific APIs in a MIDlet. These include cryptography, invoking other applications (but not embedding their UIs), extended SMS and location based services.
But – the MIDlet you build using any BlackBerry APIs will be a BlackBerry specific MIDlet. It will rely on BlackBerry APIs and so will only be able to run on a BlackBerry. If you’ve already taken that step – I’d ask why not go all the way and get a nicer UI while you’re at it?
A special note – you can, it seems, build a MIDlet for submission to the BlackBerry Application Storefront. However, you’ll have to compile it into a COD file, using the JDE (or Eclipse Plugin).
Possible advantages of going with a MIDlet
The biggest reason organizations want to go with a MIDlet rather than a CLDC application is obvious – you really write once, run anywhere. Now, this is true (barring implementation quirks with MIDP devices to be sure, but for many apps they’re not an issue) – but, you limit yourself to the MIDP lowest common denominator. This means your application doesn’t look or behave quite as nicely as a BlackBerry CLDC application. Think about what a Swing (or any pre-SWT) application looks like vs. a native Windows application and you’ll have some idea.
Maybe for your application it’s not an issue – and if so, more power to you – but from experience if you’re going to target the BlackBerry as the initial platform for your brand-new mobile application (and it’s a very good choice, maybe only iPhone would be better, but with the BlackBerry Application Storefront up and coming, the game will change again) then it’s in your interest to do everything you can to succeed on that platform. If you don’t succeed, supporting MIDP – or any other platform for that matter – might become a moot point.
There’s a way to mitigate cross platform headaches somewhat. MIDP and BlackBerry CLDC do share a lot in common. Enough so that business logic, and most networking code at least can be almost identical between the two platforms. Smart division of your app and supporting libraries can definitely save work if you want to support MIDP deviced and BlackBerry handhelds.
In the end…
With the BlackBerry Application Storefront launching soon, it’s never been a better time to get into the BlackBerry application market. Hopefully I’ve convinced you to go the CLDC Application route – you’ll save a lot of headache, and end up with a much better application.