Xamarin Impressions - Part II

Read in 4 minutes ·

It has been a while since my last blog post about Xamarin and I feel this is the time to write something more about it. Although I haven’t been working with Xamarin for some months, I will write here some questions people often asked me when I was full-time working with it:

Have you used any java library directly? How easy is it to use them

First of all, let me say that Xamarin itself created a github account with many samples some of which have Android API wrappers for C# of popular java libraries (ex: ActionBarSherlock) which is worth checking out.

One of the requirements I had concerning the project was its feature of uploading files from the device to the server and I knew it wouldn’t be easy especially due to the Documents API introduced in Android 4.4.

I decided to implement it using the aFileChooser library which could solve this problem with ease. However, there was no port available as a Xamarin component, so I had to implement the wrapper myself following the Xamarin Tutorials.

The process is allegedly automatic and straightforward although we may need to describe some transformations in XML files due to the differences between both languages (Java and C#). As far as I remember, in the whole library I had to describe only two transformations regarding C#’s lack of covariance in method return types.

It was a bit messy in the beginning but it turned out to be easier than what it could actually be. Mostly thanks to the help of the Xamarin community with many similar examples available online. The whole forum works really well and there are many people with a deep knowledge of the platform ready to help anyone.

What about libraries? Do you usually use them

Of course! The Xamarin website provides developers with a lot of small libraries (assemblies) available to download and ready to use. Check them out here!

Any other obstacles you have had so far

I don’t want to go into details here, but there where some problems while adding some external libraries (as well as with web services). I had to add some configurations to the linker options to avoid crashes in release mode. It is a fairly simple process once you know it but it is something I would had preferred not to go through.

However, if you only need to make a simple aplication that communicates with a REST API and stores some data persistently, you can simply use RestSharp together with SQLite.NET (or other reliable alternatives) and you won’t have to go through any of these I mentioned before. It really depends on what type of features and libraries you need to use, so there is no need for panic.

Keep in mind that not all frameworks and projects that are available in C# (outside of the Xamarin platform) can be used in a Xamarin.Android project so I recommend you to check its compability first here: http://scan.xamarin.com/

If you could choose, which language would you chose for development?

It is not an easy decision but once you start “Squarifying” your apps (I mean, using Square’s open source libraries) it’s hard to go back even though C# looks less verbose and sometimes is easier to develop on.

Although it depends on the restrictions of the app (enterprise or personal), keep in mind that Xamarin is paid, which is a big con for indie developers.

The whole Android ecossystem evolves much faster in Java, and Xamarin has been catching it surprisingly fast but I am afraid that a great amount of community libraries that are being released now in Java may never see the daylight in Xamarin.

As a final note, I have to say that some of Xamarin updates can be troublesome with Visual Studio. What is more, I experienced several freezes while loading the project on startup, which is something that frustrated me a lot.

If you like this post, follow me on Twitter or Telegram