In this post, we examine the pros and cons of the popular frameworks for cross-platform mobile development. We evaluate some of the popular frameworks you might use for cross-platform mobile app development, helping you find what is best suited for your project.
PhoneGap, Xamarin, Unity, Qt and Appcelerator Titanium are the frameworks that currently account for 80% of all cross-platform development for mobile.
PhoneGap makes it possible to develop mobile applications using industry standard web technologies (HTML5, JavaScript and CSS3). As a result it has risen quickly to become the most popular cross-platform framework, as it avoids the need to use native programming languages (Java for Android, Objective-C for iOS and C# for Windows Phone).
An app developed using PhoneGap is structured as a fully native app into which HTML and JavaScript components are embedded as one or more WebViews. These WebViews are just thin containers, which can render a simple user interface using web technologies, and handle communication with the underlying device - to send a message, open the camera etc.
Additional functionality can be written as a plugin and then called from the WebView. PhoneGap provides a cloud-based service (called Build) to compile the application for each platform, avoiding the need to install the software development kit (SDK) for each platform.
PhoneGap can be used to build two types of applications.
Xamarin is the second most popular cross-platform framework. Designed for the enterprise, apps are developed using a single, shared C# codebase. This is then compiled down into true native applications on Android, iOS and Windows Phone.
When using Xamarin, the code for the application is split by the developer into two parts: the ‘core’ and the ‘user interface’.
The ‘core’ part is made up of data storage, business logic code and the rest of the code that isn’t part of the user interface. A developer would write this code once and reuse across all platforms.
With the ‘user interface’ part, the developer would write the underlying code in C# and use native UI design tools to provide a different user interface layer specific to each platform.
Unity is a cross-platform game engine, popular among developers in the creation of mobile games and is one of the best tools for showcasing 3D content.
The developer uses C#, Boo or Unity Script, which is similar to JavaScript just with type annotations, to write the generic code for all platforms. Platform-specific code, such as native UI, is added as native code libraries.
Using plugins, Unity enables the native libraries to be wrapped into C#, creating a code bridge. By maintaining this wrapper, it opens up access to a wide variety of APIs, allowing communication with native, platform-specific code.
The next cross-platform framework on the list is Qt. With Qt, you write your code once, maintaining one codebase, and deploy across all screens and platforms, without the need for separate implementations on each device.
In Qt Creator, you can build applications for all compatible platforms. With Qt, the backend is developed using C++ and UI is developed on QML, which is a Qt-specific declarative language.
When it comes to platform-specific code, such as UI, the developer adds libraries for each language’s corresponding platform: Java for Android, Objective-C for iOS etc. Next, the library is wrapped in C++, giving the application access to the library API.
The final cross-platform framework we are looking at is Appcelerator Titanium, which can be used to develop cross-platform applications with native UI elements for all supported platforms using only JavaScript.
With Titanium, the developer does not create web pages with HTML and CSS, but instead, builds UI using JavaScript code. The developer compiles the application for a specific platform in Titanium Studio, and can benefit from installing third-party, platform-specific SDKs beforehand.
At runtime, the JavaScript interpreter runs JavaScript code in an environment with proxies for the native objects, such as input controls and windows. The JavaScript command ‘create text field’ creates a native ‘UITextView’ for iOS and Android.
There is no perfect solution – as all frameworks have their pros and cons. For very simple apps it is possible to get away with using PhoneGap as long as responsiveness is not a key criteria. For more serious development we recommend using Xamarin and even then, consider combining Xamarin with native development for all user interface elements.
Tell us what you would do with a precise digital strategy, improved digital presence, and accelerated growth.