My Experience with Xamarin Android

Hi folks, I have been working on Xamarin Android for the last 6 months. I normally don’t go for a third party development tools to make Android or iOS apps(I am not talking about Xamarin Mono but Xamarin Android). But the project requirement was to develop in Xamarin. The reason client said was that we can have the service layer for both Android and iOS as same. Ok that’s cool most of the service calls are handled by the service layer which is developed by our back end developer.

Some people had this mind set when it comes to Xamarin, where they compare it with other hybrid platforms like Phonegap. But the reality is Xamarin is a framework designed specially for the people who knows C#, so that they can write the Android code in C# and not have to worry about Java.  And the out put is not a web based solution, it is a native app that Xamarin out puts so it is faster like all native apps. Many C# developer I know have tried to develop apps using Xamarin and ended up complaining that, ‘Hey man its the same android code that we have to write but in C# so whats the point in it’ . So here what I am trying to say is, even though it looks or give a comfortable feel, for the C# people when they start developing they will come to understand that they need at least some basic knowledge on Android.

I tried to give an overview of what people think and what I think of Xamarin. Lets see how it feels when you try to develop and publish and app. So for C# developer its good if they knew some basic Android. Else you can still follow the Xamarin tutorials and figure out things. For Android developers if they have some basic knowledge on C# language it would be enough.

When you create an android project. It creates the file structure exactly like in Eclipse or Android Studio giving you a good first impression. Then you can add Activities and Layouts as usual. Here the layout xmls come with the extension axml. The xml we create as resources are normal xmls. When you start developing you will start to see the differences.
For examples the edit text component has a method called setText

editText.setText("String to Show")

but in Xamarin android, its not a method but a property in that class, so you simply set the value like

editText.Text =  "String to Show";

These kind of changes, you will see a lot. And when it comes to libraries. You have to Go for the Xamarin Components. Where there is only a handful of components to choose from. Most of the very popular ones are being added by the Xamarin people and popular companies. But still, at some times you have to create a component project by looking into a java library project available for normal android. But you have lots of other NuGets to use  for other simple things you find hard to handle in Android.

And one of the important think on updates are, that Google go on updating it’s v4, v7  libraries and Xamarin is slow on updating their system to support it. So When you are using libraries or components, you have to have a good knowledge on the component and their dependencies to manage all of the features you want from them. So in some cases you have to use old versions of components.

I have no problems in building and running a debug apk, but when I had to release a release build I had to face a lot of problems. One of them is the problem with the dependency versions which I have explained above. On one occasion I have to remove all the Google Play Services components and have to find an alternative way to handle Google play services which I manages to do with some http get/post requests.

So what I will always recommend is, if you are an Android developer unless it is a must don’t go for the Xamarin. Else if you are a C# developer, you will get used to the Xamarin and hopefully Microsoft will acquire it and will make it more wonderful in future.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s