The entire world is now surrounded by billions and trillions of mobile Tech which is inevitable. The major share of the development of mobile apps is taken by the Google‘s Android, Apple‘s iOS, and Microsoft‘s Windows. Every new learner or newbie in Mobile Development Domain finds himself in the dilemma of choosing the platform to start with. They are actually looking for a platform to execute or implement the test apps on something different from what it is intended for.
Xamarin is one of the solutions to it which actually is meant for cross-platform mobile app development where you can build Android, iOS, and Windows native application using a single codebase. This single platform is C#. The apps developed using Xamarin performs almost similar to the native Platform applications.
What is Xamarin?
Xamarin is a software company originated in 2011 and was recently acquired by Microsoft in the year,2016. It provides a developer with the whole range of tools which can be used for the development of cross-platform apps. Xamarin tools are easily available to download with Visual Studio. To use Xamarin on Windows, You need to install Visual Studio which could be a free version or a premium license. After it, you need to configure it with Xamarin.
For Installing Xamarin in Visual Studio on Windows, you can check the documentation
The further steps would be creating new ‘Cross Platform app’ and start working on that. You would be asked to choose some settings and Visual Studio might take some time to set up your project.
Working of Xamarin
Xamarin has entirely converted the Android and iOS SDK to C# to make it more familiar to the developers. One can easily use the same codebase for both the platforms without the hassle of remembering the syntax of different languages all the time. Besides, the User Interface(UI) remains almost same. It has to be separately built for both the platforms and then has to be bound by the common codebase.
There are actually two ways for building the User Interface. First one is using the original native methods to build the UI. Another one incorporates the use of Xamarin.Forms. These forms can be used to build UI for different platforms all at once and have almost 100% code sharing if these are chosen over Native UI Technology.
After doing all the UI work comes the most challenging phase which is connecting the UI to the codebase. This connection can again be implemented using two code sharing approaches which are:
2.Portable Class Libraries(PCL)
You can learn more about these at Xamarinhelp.com.
Xamarin provides developers two ways to build a mobile app. Either by using Xamarin.iOS and Xamarin.Android(main approach) or by using Xamarin.Forms which is a framework for simple apps and prototypes. Xamarin.Forms, the Visual Studio Library facilitates for rapid prototyping or building apps with few platform-specific functionalities. This makes Xamarin.Forms, the best fit, for apps considering code sharing more significant than custom UI. The developer need not design for each platform individually. With Xamarin.Forms, a single interface would be shared across platforms. Apps with some parts of the UI created using Xamarin.Forms and rest using native UI Toolkit can also be built using this approach.
Features of Xamarin
- Xamarin supports wearable devices as well such as Android Wear and Apple Watch. The functionalities of these wearable devices in their native applications can be incorporated via downloading simple plugins from the Xamarin Component Store.
- Popular plugins are cross-platform such as Text-to-Speech and
Battery Status. Platform Specific plugins too are available in Xamarin Component store such as the Google Play billing support plugin.
- The Xamarin based cross-platform applications can be easily integrated to most of the popular backend platforms such as Parse, Microsoft Azure etc.
- Application indexing in Xamarin allows those applications to be in the search results which usually gets forgotten after few uses from the Users.
Pros & Cons of Xamarin
- Unlike other interpreted solutions such as Appcelerator Titanium, Xamarin uses a single language(codebase) C# to create apps, which actually makes it a superior option for building high-performance apps with native look and feel.
- Xamarin has two major products: Xamarin.iOS and Xamarin.Android. In case of iOS, the compilation of source code is done using ‘Ahead-of-Time Compilation’ whereas, in Android apps, the former is performed using the Just-in-Time Compilation approach. However, both of the cases are automated and efficiently handles issues regarding memory allocation, garbage collection, and platform interoperability by default.
- As Xamarin uses C# augmented with .Net framework to create apps on all mobile platforms, 96% of the source code can be reused speeding up the development process. One can build all of the apps using Xamarin in Visual Studio which has now completely substituted Xamarin Studio. Besides, Xamarin also doesn’t require swapping between the development environments.
- Performance of a cross-platform app built using Xamarin is close to native.It’s accomplishment metrics can be compared to those of Java for Android and Objective-C or Swift for iOS app development. Moreover, constant refinements are also being made in Xamarin, to let it entirely be a facsimile of the native platform apps. Xamarin Test Cloud coupled with Xamarin Test Recorder tool allows a developer to run automated UI tests and check the performance related issues before the release but with an additional fee.
- There is simplified Maintenance and updates in Xamarin due to its cross-platform application. On applying changes or updates to the source code of the file, modifications would be reflected in both iOS and Android apps. But this works only for the applications using Xamarin.Forms or the business logic, shared code, .updates for Xamrion.iOS and Xamarin.Android apps.
- Xamarin provides slightly delayed support for the latest platform updates. Obviously, it’s impossible for the third party tools to immediately provide support for the latest iOS and Android release. Although Xamarin claims to provide the support for the latest version on the same-day of their release, there might have slight delays.
- It is undoubtful that the Xamarin community is much smaller than those of iOS and Android. So, it would be really hard to find an experienced Xamarin developer.Although, this is growing every day with the support of Microsoft. Considering the stats from various sources, Xamarin community accounts for only 10 percent of the global mobile development society.Even with this number of Engineers, Xamarin provides extensive support to them. The dedicated educational platform, Xamarin University provides resources and practical training to the newbies in this technology.
- Xamarin developers and consumers can use only the components provided by the platform and some .Net open source resources. But native development incorporates extensive use of open source technologies. Though Xamarin components provide thousands of custom UI controls, various charts, graphs, themes and others that can be included in the app with just a few clicks, the number is incomparable to open source libraries of Android and iOS.
- Even if Xamarin uses a single codebase C# for both the platforms, but the developer while using Xamarin.iOS and Xamarin.Android, still need to write some platform-specific layer of code. So, it requires basic knowledge of the native technologies such as Java/Kotlin for Android and Objective-C/Swift for iOS. However, this doesn’t apply to Xamarin.Forms.
- Xamarin is not suitable for Apps with Heavy Graphics as you can only share the logical code, but the UI code would mostly be platform specific which actually makes it worthless to create games, rich custom UI, or complex animations in Xamarin.
- Xamarin apps are comparatively larger than the native ones. Actually, Native apps account only for half of the size of the Xamarin apps. For instance, a simple “hello, world!!” app for Android might take 16 MB of memory. Maximum of the space is utilized by the associated libraries, content, Mono runtime, and Base Class Library(BCL) assemblies.
- There are compatibility issues while integrating third-party Libraries and Tools with the app built on Xamrin platform. Though there is a Xamarin component store, there might be situations when the developer needs a specific capability or integration within his own app that are not provided by the platform.
The Software Company, Xamarin comes with many variants of products. Listed below are some of them.
Xamarin platform: Xamarin 2.0 was released in February 2013. After it, native Android, iOS and Windows app development was made possible with Xamarin.Android and Xamarin.iOS, incorporated either with Visual Studio o Xamarin Studio. The same C# code was shared and re-used by developers across device platforms.
Xamarin.Forms: It was introduced in Xamarin 3 and allowed developers to perform rapid prototyping or building apps with few platform-specific functionalities.
Xamarin Test Cloud: It makes possible for the developers to test their mobile apps written in any language on real, non-breakable devices in the cloud. Simulations of real user interactions are made using Object-based UI Testing.
Xamarin for Visual Studio: Xamarin provides add-ins to Microsoft Visual Studio that makes it possible for the developers to build Android, iOS, and Windows apps within the IDE using code compilation and IntelliSense.
Xamarin Studio: It was released in February 2013 and at that time, it was the only IDE for mobile app development on Windows and Mac OS. as part of Xamarin 2.0 based on the open source project.
Xamarin.Mac: It allows the development of fully native Mac apps using C# and .Net. Xamarin.Mac merged with Xamarin.iOS and Xamarin.Android can allow developers to share up to 90 percent of native code across Android iOS, and Mac OS.
.Net Mobility Scanner: It allows developers to observe how much of their .Net code can run on other operating systems, especially Android, iOS, Windows Phone, and Windows Store.
RoboVM: Xamarin acquired the Swedish RoboVM for Java developer platform. It enables developers to build Java apps for iOS and Android with fully native UI’s,
and native performances.
You can study more about this here.
Xamarin University : If you want to explore more of Xamarin and feel it be your future Tech domain, you can learn more about it at https://university.xamarin.com/. This is an online University which provides online lectures and provides a separate column for student interaction and guidance from Xamarin experts.
- Introduction to Postman for API Development
- Introduction to Web Development and the Holy Trinity of it
- 10 Myths About Software Development
- Top 7 Database You Must Know For Software Development Projects
- Burnout in Software Development: How to Deal With it?
- How to Prepare for Microsoft Software Development Engineering Interview?
- How to Prepare for Amazon Software Development Engineering Interview?
- Mobile Search Engine Optimization (SEO)
- How to detect a mobile device in jQuery?
- Traditional wireless mobile communication
- How to disable zoom on a mobile web page using CSS?
- Send SMS updates to mobile phone using python
- Mobile Crowd Sensing along with Incentive Mechanism
- How to place the image above the slider in mobile view in bootstrap?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.