Sunday, 3 September 2017

In order for you to create a mobile cross platform app for the top three platforms, you must understand three OS, know how to code in three languages and understand the UI paradigms on each platform. This tutorial explains how Xamarin solves this dilemma and lets you write mobile apps for each platform with C#.
Mobile cross platform - Xamarin

Choosing the right mobile cross platform apps is not a lighthearted decision. In order for you to create an app for the top three platforms, you must understand three operating systems, know how to code in three languages, and understand the UI paradigms of each platform. To write your mobile code, you need to pick a programming language, and in the mobile development world, that language usually matches the dominant language of the platform. So in Android, the code is Java, in Windows phones, it's C# or Visual Basic, and in iOS, it's Objective-C or Swift.

For the view, you need to define the UI in a platform-specific way. In Android, it's defined in an Android XML file, the AXML file, in Windows Phone, in the Extensible Application Markup Language, or XAML file, and in iOS you use a Xib file or write storyboards. Of course, if you prefer to define your UI in code, you can do that in each platform, too. Xamarin seeks to solve this storm and reduce the number of programming languages needed to build apps in all three systems, and it's been successful. It's a popular cross-platform toolkit.

There are various choices available for mobile development. Xamarin aimed directly at the .NET developer. Instead of learning three languages, you code in the familiar C# language and use familiar concepts like generics, link, and task from the .NET framework. And you can write your code in your favorite IDE, Visual Studio. There are other cross platform mobile tools available, but most of them suffer from performance lags when compared with the apps built with the native languages and tools. Not so with Xamarin. Xamarin apps leverage platform-specific hardware acceleration, and they're compiled for native performance.

This can't be achieved with solutions that interpret code at runtime. Also, the other platforms are programmed with other programming languages, like JavaScript. Not that there's anything wrong with the other languages, but remember, Xamarin is intended for .NET people, so if that's what you know, then you are one step closer to being a mobile developer. Xamarin apps have access to the full range of functionality exposed by the underlying platform and device. That includes platform-specific capabilities like Android Fragments and iOS iBeacons. Xamarin apps are built with standard native user interface controls.

Apps not only look the way end users expect, they behave that way, too. There are three major parts of the Xamarin ecosystem. Xamarin Platform is the main developer part of Xamarin. It provides a set of runtime engines, code APIs, code samples, and virtual machines. The platform targets Android and iOS apps, Mac OS 10 applications, and the Microsoft Windows phones and tablets. Xamarin also has a Test Cloud. It provides an automatic online testing harness that automates your app testing on thousands of real devices in the Cloud.

The third major part of the system is Xamarin Insights. It is an app-monitoring service that tracks app crashes and exceptions and helps the builders know in real time what is happening with app users. Here's what we'll look at in this course. I'll cover each of these in a separate movie in this chapter, but here's the 20 second overview. Xamarin.Android is the way to build Android apps with Xamarin. You work in C#, not Java. You define your UI and activities in the usual Android way. Xamarin provides the runtime and bindings to make it all work. Xamarin.iOS provides the same benefits, except it's for iOS.

You work in C#, not Objective-C or Swift. You define your UI and views in the usual iOS way, and Xamarin does the rest. Xamarin.Forms is my favorite of the three and the one I'll spend the most time exploring. The key benefit of Xamarin.Forms is that it is truly cross platform. You write shared business code for all the platforms, and you define a shared UI with the Microsoft XAML markup language. Without Forms, you needed to find three separate UI layers, one for Android, another for iOS, and yet another for Windows devices.


Let's pause here at the end of the video to consider what we've seen. Xamarin is a way to make mobile apps quickly for all platforms with a single, shared C# code base, build a custom native user interface for each platform, or use Xamarin.Forms to write a single shared user interface across platforms.
Previous Post
Next Post

0 comments: