Cross platform native mobile development

For some years ago, the mobile development paradigm has shifted from a single platform model to a multi platform one.

Nowadays we can find so different platforms like iOS, Android or Windows Phone fighting for the marketshare in the smartphone arena.
This is great from a consumer point of view. Lot of options to choose means better devices, better software and lower prices, that’s awesome!

But from a developer point of view, this situation is a nightmare. Basically you have three options:

1.  Choose one platform and stick to it, do the best you can to make awesome apps.

2. Be a “jack of tools” and learn all three main platforms languages so you can develop for any of them.

3. Go cross platform with tools like Cordova or Xamarin.

 

For sure you can achieve a great level of success developing for one platform, but whatever you do, your are going to loose potential users.

Learn Java, .NET and Objective C enough to master them, keeping at the top your skills and recycling your knowledge could be an impossible mission, even if you are lucky enough to be able to devote full time to it. If you are only an indie or hobbiest developer with a day job, this could be totally impossible.


So, what about going cross platform with Cordova or Xamarin?

Well this tools allows you to build apps for multiple platforms, with a variant level of customization for each one, and using a single set of tools/skills.


Cordova

If you are a web developer or have any kind of html, css, javascript skills, Cordova allows you to build applications using this knowledge.
The cons of cordova are serious: although you can use html/css/js for application code, interface and logic, some operations requiring native integration are made using native code in every platform. This means you need to know how to write code in C#, Java and Objective-C, or relay in the community to find plugins working on every platform to perform the exact task you need. Also, your application is going to have the same exact look & feel in each platform, so you are going to be outside of platform guidelines for UI and UX. This isn’t a problem itself with publishing, but can make user’s feel uncomfortable with your app.

Xamarin

Xamarin is a company founded by Nat Friedman and Miguel de Icaza. Miguel was the original developer of mono, an adaptation of .NET framework for Linux and Mac. Based on Mono, Miguel develop Mono.Touch and Mono.Droid. These tools allowed .NET developers to create applications for iOS and Android using C# code in Visual Studio. That way you can recycle all your .NET C# skills to develop a shared application logic core. After Mono.Touch and Mono.Droid, Miguel founded Xamarin with Nat Friedman to push forward the technology. Today you can use Xamarin Android and Xamarin iOS to develop for this platform in two ways: classic and forms.

Xamarin Classic

With Xamarin Classic, you can write all the logic of your applications, in a shared portable class library, using MVVMCross. Xamarin doesn’t have a version for Windows Phone, but as MVVMCross is supported in Windows Phone and the code uses .NET and C#, you can use it within a native Windows Phone application.

But not every part of an application could be shared in Xamarin Classic, you need to create the user interface for every platform:

  • Windows Phone: You can use the native Visual Studio XAML designer.
  • Android: Xamarin includes a designer in Visual Studio for android layouts.
  • iOS: Xamarin doesn’t include a designer, for iOS you can create the user interface using C# code.

So, at the end of the day, Xamarin allows you to share up to 75% of your application code and enforces you to make a unique UI for each platform. This way you have the best of each world.

Xamarin Forms

Some months ago, Xamarin launched a new framework called Xamarin.Forms. The main feature of Xamarin.Forms is the ability to use XAML to create the whole application interface, for all platforms (Windows Phone, iOS and Android) getting the shared code up to a 95%. When this XAML is compiled for each platform, Xamarin transform every control and page you have created to the platform specific representation so in the end, you have a native user interface, writing it only once.
For example, writing this XAML, who declares a ContentPage and three controls: Slider, label and button:

 

You can achieve this kind of customization for each platform:

In each of the platforms, the controls are rendered in their native look & feel.

So, if you feel comfortable with XAML and C#, Xamarin.Forms allows you to reuse all your skills to build awesome cross platform application, without compromising the final native look and feel in any of the platofrms.

In Bravent, we are experts in .NET, C#, XAML and the new mobility paradigm, so Xamarin is the path we choose to make awesome cross platform experiences for the users.

Thank you for reading and sharing! And Merry Christmas!

Josué Yeray Julián Ferreiro, MVP by Microsoft and expert in Windows Phone & Windows 8