Blog

Build Cross Platform Mobile App-Xamarin

Xamarin1

Launched in 2011, Xamarin is a platform used to develop cross-platform mobile apps. It works with the Mono framework to connect with the Application Program Interface (API) of common mobile device functions including camera, contacts and geo-location for Android, iOS and Windows operating systems. It helps the developers to build robust applications using the C# encoding language that runs on the .NET Common Language Infrastructure (CLI). Considered as a “write once, run everywhere” podium, Xamarin as mobile application framework has its negatives and positives.

How Does Xamarin Work?

Xamarin has two commercial products: Xamarin.Android and Xamarin.iOS. They both are built on top of Mono, an open-source variant of the .NET Framework based on the accessible .NET ECMA principles. Mono has been around almost as long as the .NET framework itself, and runs on nearly all possible platforms including Linux, FreeBSD, Unix, and Mac OS X.

On Android, Xamarin’s compiler assembles down to Intermediate Language (IL), which is then Just-in-Time (JIT) gathered to native assembly when the application takes-off. On iOS, Xamarin’s Ahead-of-Time (AOT) Compiler assembles Xamarin.iOS applications straight to native ARM assembly code.

In both frameworks, Xamarin applications utilize a runtime that inevitably handles things such as garbage collection, underlying platform interop, memory allocation, etc.

Mono.Android.dll and MonoTouch.dll

Xamarin applications are constructed against a subsection of the .NET BCL known as the Xamarin Mobile Profile. This profile has been created explicitly for mobile applications and packed in the Mono.Android.dll and MonoTouch.dll (for Android and iOS respectively). This is much like the way Silverlight (and Moonlight) applications are built averse the Silverlight/Moonlight .NET Profile. In actual fact, the Xamarin Mobile profile is same as the Silverlight 4.0 profile with a group of BCL classes added back.

In addition to the BCL, these .dlls include wrappings for almost the entire Android SDK and iOS SDK that permits you to raise the essential SDK APIs straight from C#.

Application Output

When Xamarin applications are assembled, the result is an Application Package, either .apk file in Android or an .app file in iOS. These files are identical from application packages built with the platform’s defaulting IDEs and are deployable in the exact same way.

Pros:
  • A single language is used to code for all platforms.
  • Performance: Xamarin performs speed. It is much faster to the existing cross-platforms.
  • It allows customization for users to create native look and feel for each platform.
  • It also provides full support to the hardware features like GPS, Camera, Accelerometer.
  • Coding for any platform can be done on one IDE: Xamarin IDE or Visual Studio.
Cons:
  • It is a costly affair, a few hundred dollars per platform/ per developer.
  • There is a learning bent involved in using Xamarin. The developer needs to know C# and .net and also the platform framework / UI / Lifecycles that they are developing for. Also they need to learn the Xamarin Framework/ IDE.
  • It does not create Windows xp+ (desktop application). Though the desktop app can still be coded in .Net / C# normally.
  • Xamarin cannot use open source libraries that are prevalent on Android/ iOS. Though .Net has its stake of open source support
  • Since it is a paid product, it is hard to find support issues in a smaller ecosystem. Xamarin support can be relied on if developer issues/ bugs could come up with their tools.
The Predecessors:

PhoneGap is a framework which allows cross platform mobile development by using web technologies, HTML5, JavaScript, and CSS, as a substitute of native languages such as Objective-C and Java. The resultant applications are hybrid.

These cross-platform apps run inside a “container” (WebView on Android and UIWebView on iOS) and influence the device’s browser to reduce the HTML and process the JavaScript in the vicinity. Webkit is the browser engine that is used on Android, iOS and BlackBerry.

There were two constituents to PhoneGap:

  • A JavaScript API which is the interface between the HTML5/CSS code and the native functionality, such as camera, contacts and gps.
  • Native code which is entreated by the JavaScript APIs.
Compared Performances:

Native Performance: PhoneGap is a slow and value performing framework that works well on older Android devices and iPhone4. While Xamarin performs steadily on Android, iOS and Win phone devices.

Native UI: The PhoneGap platform has a general UI and does not have innate look for dissimilar platforms. Xamarin on the other hand offers the ability to create individual UI for different platforms.

Data Amount: In PhoneGap, it is challenging to display big amounts of data in the lists while in Xamarin, any amount of data can be displayed.

Launch Time: PhoneGap usually takes longer time to launch an app on a device whereas Xamarin provides option of high speed induction.

Subscribe to a hand-picked round up of the best development/design/mobile blog posts every week.

Curated by Seasia Infotech and published every week. Free!

100 % privacy. We will never spam you!

AUTHOR :

Seasia Infotech is a CMMi5 certified company providing Software Development, Mobile Application Development and Digital Marketing services to businesses worldwide. We embrace the latest technologies to deliver solutions that address our clients’ business challenges. We focus on resolving the IT conundrum for our clients thereby enabling them to focus on their core business strengths.

Leave a Reply

Your email address will not be published. Required fields are marked *

Top Request Free Consultation