Build Cross-Platform Mobile App-XAMARIN
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#.
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.
- 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.
- 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.
There were two constituents to PhoneGap:
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.