Skip to Navigation

What Titanium Appcelerator REALLY is and How it Works!

Titanium is a cross-platform JavaScript runtime and API framework used to do mobile development on iOS, Android, and, most recently, the mobile web, with possible future support for Blackberry and Windows. It is only similar to other popular frameworks such as Rhodes and PhoneGap in that they all attempt to offer a cross-platform approach using web technologies. That’s where the similarities end. When writing an app using Titanium framework, you are essentially writing a native application using JavaScript. The key word here is “native.”

If the applications you are writing are native, then how does Titanium work behind the scenes? The Titanium framework uses a unified JavaScript API, with platform-specific features and native performance combined. When using Titanium as a framework, you should understand two major concepts. First, core features in mobile development can have the same experience across platforms, and you can and should utilize code reuse. Second, with more platform-specific APIs, user Interfaces, and features, developers should use specific platform-targeted code. For this reason, it is not a “write once, run everywhere” approach. This allows Titanium to offer a great user experience by offering access to native UI and native features to achieve a higher level of performance than most “hybrid” approaches.

A Deeper Look

Titanium takes code written in JavaScript, combines this code with the Titanium API (which is in written in the targeted device’s native language), and evaluates your code at runtime with a JavaScript interpreter that runs on the device’s operating systems. When you launch your app, a JavaScript execution is created in the native code and the JavaScript is injected as an inline object paired with native objects within the runtime environment. The pairing is strictly one-to-one in a way such as running inline JavaScript within HTML. This allows the Titanium API to act as a bridge to expose direct access to the native experience, through actual native features and APIs.

Many misconceptions over the years have developed about Titanium, which can easily be debunked with a clear understanding about the framework. The major one is that Titanium does not use the web view component approach used with other JavaScript toolkits and PhoneGap. JavaScript written in Titanium framework is not cross-compiled into the respective native languages. The JavaScript code is evaluated at runtime. Titanium offers native UI controls and animations, instead of replicating this through CSS or JavaScript toolkits.

Strengths and Downsides

The strengths of Titanium are access to a wider and higher level of APIs, native UI, and device-specific features out of the box. Titanium offers the same UI interface and components that are available to both Android and iOS developers, which is not offered using any other hybrid approach. In other words to visual emulation via CSS, OpenGL, or Flash, you are using the platform’s backend UI controllers, behaviors, and animations, which offers the native experience that most users expect. You can also extend on these visual aspects and other core features by extending the Titanium API to fit the needs of your applications. Another major benefit is that Titanium offers an approach to developing native apps with knowledge of JavaScript, instead of having to learn platform-specific languages. Finally, once you have completed an application, Titanium offers an automated way to package and distribute your applications to the platform’s respective app stores through an IDE called Titanium Studio.

One of the major downsides of using Titanium as a framework is that it still doesn’t offer as wide of support as most hope for today. This is mainly due to the fact that Titanium API connects directly to the native platform, and taking up a new platform is a lot of work. For this reason, Titanium only supports the larger platforms in Android, iOS, and some level of mobile web browser support. Also, some user interface components do not perform as well as their native counterparts. The Titanium team stresses that they are committed to spending a great amount of time working on this issue. Titanium can never support all native APIs and device functionality, which continue to grow and develop on the native platforms per each new release and update to the native operating systems. Titanium strives to offer at least 90 percent of these APIs and native functionality on its supported platforms.

Once you have an understanding of the unique way that Titanium works as a platform, you can understand the power of what is being offered:

  • A solution to create mobile applications currently on Android or iOS without having to learn to program code individually for each respective platform.
  • A platform that is able to access native controls and device functionality directly and offers a better user experience by offering behavior and animations a user expects.
  • Most of all a free platform for mobile development offered under the GNU General Public License.

This framework, even with its drawbacks, is offering more than other competitors and will most likely be further adopted.

Jason Powell is a Titanium Certified Mobile and App Developer.