Titanium Apps and the Blackberry Playbook

In Feburary 2012, Blackberry updated the OS for their 7″ Playbook tablet to v2.0. This introduced compatailbity with Android-based applications whereby developers can simply repackage, code sign, and submit their Android apps into BlackBerry App World. It also means you can take any Android app (that hasn’t gone through this process) and sideload the app yourself.

Since I develop mobile apps for iOS and Android using the Titanium platform, I was interested in how much effort it would be to get my existing apps working on the Playbook. There are plenty of posts on how to take an APK and sign it correctly for App World, but what took me a while to figure out, was which version on Titanium was compatible with the Playbook.

After some experimentation, I’ve found that if you package your app against Titanium SDK 1.7.5, it’ll work nicely on the Playbook. Version 1.8.x won’t work (hmm, maybe it’s V8 vs Rhino.. V8 definitely doesn’t work…). Certain pieces of code may also cause the app to crash (whereas it won’t crash on a proper Android device). The one thing I hit, was passing url:null, into Titanium.UI.createWindow will crash the app, whereas that’s absoutely fine on iOS and Android.

The other small advantage of using the 1.7.5 SDK is that the resulting APK is a lot smaller, although since the current Playbook only has Wifi this is less of an issue than it is on a mobile phone.

Now we have the APK, you just have to go through the app packaging/signing process as detailed elsewhere on the web, or in Blackberry’s official documentation. This new GUI-based tool looks like a good place to start if you don’t like working from the command line.

iPhone and Android development with Titanium

Over the past few months I’ve worked on a couple of mobile applications for the iPhone and Android platforms. I’d looked at Phonegap some time before that, but determined that it wasn’t up to the job, but more recently I stumbled across Titanium from Appcelerator. The idea is that you code up your apps using HTML and Javascript. The Javascript calls the Titanium API to create things like lists, dialog boxes, and phone features such as geolocation.

Some of the advantages of using Titanium are:

– No need to learn Objective-C (iPhone) or Java (Android)
– Leverage existing HTML + Javascript skills
– Write one version of the code that can be deployed to both platforms
– Code is compiled up into native applications which are accepted in the App Store
– Potential to deploy to other platforms in the future (e.g. Blackberry, Symbian)

The level of support provided by the Appcelerator staff on the official forums is brilliant, and the tutorial videos are good for those who want to get an overview of creating apps without wading through documentation.

You’ll still need a Mac if you want to develop for the iPhone, because Titanium makes use of the iPhone SDK. But if you just want to do Android development then you can use Window or Linux as well.

Although you’ll be developing 1 set of code for both the iPhone and Android, you’ll probably want to customise the UI slightly differently for each platform. For example, Android apps often hide away items such as ‘Settings’ and ‘Help’ under the Menu button. It’s simple to code this kind of thing up:

	if (Titanium.Platform.name == 'android') {
		var menu = Titanium.UI.createMenu();
		menu.addItem("Help/About", function() {
			displayWindow('Help / About', 'window_about.html');
		}, Titanium.UI.Android.SystemIcon.HELP);
		Titanium.UI.setMenu(menu);
	} else {
		data.push({title:'Help / About',image:'tabicon_help.png', color:'#ffffff'});
	}

That code will create the Help/About option under a menu on Android, and add it to the home screen’s list on the iPhone. Simple.

Titanium is an awesome framework so if you’re considering developing for the iPhone and/or Android then I’d highly recommend you take a look.