In the previous article, how to approach mobile development in 2020, we directly compared native vs cross-platform mobile development and highlighted that a hybrid approach can, in some instances, be a solution to provide a seamless mobile experience.
In part two, we are going to evaluate some of the popular frameworks you might use when the need arises for cross-platform 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.
The following table lays out the main characteristics of each tool:
C#, UnityScript, Boo
Android, iOS, Windows Phone, Blackberry, WebOS, Symbian, Bada
iOS, Android, Windows Phone and Windows 8/RT
Android, iOS, Windows Phone, Tizen
Android, iOS, WinRT
iOS, Android, BlackBerry, Windows
PhoneGap Pricing Free Plan: available Paid Plan: from $9.99 p/m Adobe Creative Cloud Membership: available
Xamarin Pricing Xamarin Studio Community: free
Visual Studio Community: free
Visual Studio Professional: available
Visual Studio Enterprise: available
Personal Edition: FREE
Professional Edition: from $75 p/m
Commercial and open source
Indie: $39 p/m
Team: $259 p/seat/m
How PhoneGap works
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.
- Web Hybrid: used when you don’t need native UI elements, this way the whole application will be in one WebView
- Native Hybrid: used when you do need native UI elements, this way the application contains several WebViews in the native container
- Anything already written as a web page can be quickly packaged into a mobile app, making it a useful tool for small applications and prototypes.
- Plugins allow functionality to accesses the native device APIs
- Supports all mobile platforms &endash; no need to install local SDKs as the cloud-based ‘Build’ service takes care of compliation.
- The user interface is rendered using an embedded browser. This gives a poor and slugging response compared to a native application.
- The embedded browser behaves differently on different devies, so the user interface of the app varies.
- Existing PhoneGap plugins are often outdated, so extending your application means writing your own plugins.
- To get the most out of PhoneGap, developers really should know the coding language for each platform.
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.
How Xamarin works
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.
- A C# developer can create apps that look and feel like native Android and iOS apps with native UI elements.
- You don’t need to know Java or Objective-C to create the final version
- As Xamarin is based on ‘Mono’ framework, you can use the .NET stack
- It is connected with a growing community
- Developers can use TestCloud to test their applications automatically.
- When you develop significantly customised UI or interaction, an internal Xamarin error appears citing compatibility issues, missing features etc.
- As access to native platform features is carried out through a specific ‘*.dll’ you don’t have real control of what is being generated as the final code that will be run on the devices
- The process of deploying the Android application to the emulator, or to the real device, is very slow.
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.
How Unity works
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.
- Great option for making mobile games for a range of devices
- Deployment to multiple platforms is easy to manage
- The 3D engine gives high quality results without any complex configuration
- There are a lot of good, free and reasonable priced plugins
- Unity allows the developer to make their own shaders and change the way that Unity renders the game.
- Unfriendly User-Interface and hard to learn for beginners
- Engine source code is not available. This means that, if a developer comes across a bug in the engine, he has to wait for it to be fixed or attempt a work around for the error
- Unity’s compilers are not optimised for ARM processors for some mobile devices.
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.
How Qt works
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.
- Qt has lots of good tools that are helpful for development, such as IDE QT Creator, Qt Designer and code profiling
- It has libraries that contain intuitive APIs for elements like threading, networking, animations and more.
- Qt is difficult for beginners
- For several applications, the developer will have to learn each platform’s APIs
- Much less developers choose this option due to a small, active community.
How Appcelerator Titanium works
- Native API usage gives access to iOS and Android features, meaing higher performance for applications that aren’t too large
- UI is essentially native, Titanium applications feel and look better than apps built on other platforms
- Appcelerator provides real-time analytics and a marketplace for third party components.
- There are delays when the application starts up due to the library loading
- “Appcelerator supports only common across all platform features”
- Developers are required to manage target platform SDKs locally.
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.
Launch your idea
Accelerate your innovation. Let's bring your idea to market.Talk to an expert