A week of impressions of developing for Android using Xamarin & MvvmCross

Occasionally I watch road bicycling and it happens that I started following Vuelta 2013. Of course I downloaded the official application for Android as well - to keep an eye on standings. The poor quality of the Android application bothered me a bit. Both the lack of data and poor UI. Most notably I really found it hard to see where my favorite bicyclists are standing.

This triggered a well known feeling in me - I have to create my own Android application instead. For quite some time I was eying Android development but so far I didn't have a proper motivation.Armed with Xamarin and MvvmCross I dived in. I had almost no experience with Android OS development, very little of Xamarin and none of MvvmCross. The goal was to create a MVVM based application that could leverage the common code along different mobile platforms though the current state is Android only application. I could create a version for iOS and Windows Phone 8 as well, I guess, but I don't have a Mac (required to build for iOS) nor I want to loose a ton of time to enable Windows Phone development environment for a free application (which is a shame because WP8 development doesn't look bad at all). Perhaps sometime.

The application itself is available for free through Google Play. Go, get it, while it is still actual.

About Xamarin

What they have done is simply amazing. Porting Mono (.net) stack to mobile platforms that is. Including the latest crazy useful async/await.This gives a .net developer an option to provide common code base for Windows RT, desktop Windows, Windows Phone, Android and iOS and to unleash the .net on platforms MS didn't want you to. The community is there. But it comes with some quirks. Here are some major ones I found while developing with Visual Studio 2012:

  • debugger is often slow. Sometimes it takes quite a lot of tenths of seconds to be able to inspect variables at a breakpoint
  • async/await debugger breakpoints stop at random lines of code and often "Step Over" or "Step Into" means "Continue running"
  • Portable Class Library support is still a problem (most notably, VS Android projects can't reference PCL assemblies while Xamarin IDE intellisense goes beserk on PCLs)
  • no profilers available (performance, memory) for Android. These are insanely important for mobile devices. Vote here.
  • price for Indie developers (small shops) might be high

I am not exactly sure whether some of these problems might be attributed to VS or Xamarin integration. Anyway, none of these is a showstopper and I am sure they'll be addressed.

About MvvmCross

This framework is an excellent open source MVVM starting point for cross platform .net mobile development. @slodge. the author, has done and is still doing an insane job. Not just by creating the framework but he is all over the Internet answering questions and writing (well, mostly recording) documentation and samples. That said there are some problems with MvvmCross:

  • huge framework, takes time to grasp
  • I miss better fundamentals description (i.e how DataContext is transferred to children)
  • sometimes slow (i.e. startup time, ListView bindings). NOTE: since there is no performance profiler available I couldn't exactly determine why it acts slowly sometimes. Could be Xamarin, could be MvvmCross or Android or my code.
  • some error messages could be better (i.e. suggesting you a solution instead of just reporting errors)

But hey, it is open source and I plan to contribute if time permits.

About Android

It is not hard to learn the basics but it has plenty of small issues and traps one has to be aware of. The fragmentation doesn't help either nor does java stack but overall it isn't that big of an issue.

Then there are Intel Android x86 images which are used if you want to run the emulator. (Forget about ARM ones due to the slowness). Intel Android x86 v17 image has a quirk that logs messages like nuts making log window pretty much useless. Then there is the v18 image that fixed overlogging issue but introduced a new one. It'd throw "can't resolve host" when using HttpClient 99% of the time. This issue might be attributed to Xamarin though as its browser doesn't exhibit same problems.

Google Play store publishing

Straightforward, no issues. Wait, there is a potential problem. If you want to publish an app on Google Play store you have to comply to US laws, most notably they warn you of using encryption. I wonder why (rhetorical).

So, these are my impressions, after a week of development. Note that I mostly listed problems I've encountered not described the (bright points of) products in details.

Feel free to feedback me.

Waiting for a tablet

It has been quite a while since I’ve started thinking about an e-Reader. The primary reason is that I have a bunch of e-books (many of them from Manning). I bought them with an e-reader in mind. However, they are in various formats, PDF among them.

The mainstream e-reader is still a 6” device with a single 9” out there - Kindle DX which is quite expensive and run by Amazon. This could be a worrisome fact – they demonstrated it twice at least: first they removed legally bought books from e-readers just like that (ironically those were Orwell’s) and they denied hosting Wikileaks on their cloud servers because of a single phone call made by a politician. Being at the mercy of such a company isn’t really something good, is it? Anyway, the thing is that 6” devices are suitable for displaying more or less e-books only, not all e-content (think PDF) due to the screen size. And e-readers with bigger screens are not coming yet, are they? During this time iPad happened  which shows that a tablet is a good alternative to e-readers if properly done (plus it can be used for many daily tasks where e-readers simply don+t work). Thanks for that, iPad. Hence I shifted my focus to tablets.

Here are my requirements for a tablet capable of displaying e-books in various formats, reading e-mail, surfing, etc:

  1. Real battery life at least 6hrs
  2. Screen resolution at least 1024x600
  3. Screen size at least 7” (not sure if I rather set it to 9” – have to check them in real world)
  4. Not being at the mercy of anybody for content installation
  5. Applications can be developed on PC (.net is preferred)
  6. A decent chipset (nVidia Tegra 2 looks the best bet right now)
  7. Open architecture with an option to install custom OS (when the manufacturer stops supporting it)

So let’s start with the eliminations.

iPad

I’ll never buy iPad due to the conflict with requirements 4, 5 and 7. My biggest problem with iPad is the Apple politics behind it. If you have it then you are at the mercy of Jobs who decides what are you allowed to run, install, share and read - Apple censors content for no reason, at least they don’t even try to explain it, Wikileaks application was one of them. From the hardware point of view it is a fine device though.

Windows 7 tablets aka slates

There are some and come in various forms and factors. However, none of them makes it over my first requirement. They are slow, too - thanks to Windows 7 not being optimized for tablet format. I could survive slowness but not being able to run over 3hrs straight is a complete showstopper. Imagine, you just boot Windows 7, open Word and your document within it and you have to recharge already. It is beyond me why the manufacturers even bother producing them. The only bright point here is that Microsoft announced support for ARM and SoC with forthcoming Windows 8. I guess I’ll have to re-evaluate Windows based tablets in two years or more.

Chrome

No idea.

Android

Which leaves the Android based tablets as the only alternative. Currently the only decent one is Samsung Galaxy Tab which is heavily overpriced. It is more expensive than iPad even though it features much smaller display (7” compared to iPad’s 9”) and a free open source OS. Furthermore it is running Gingerbread (or is it Froyo) without any upgrade commitment from Samsung (you can’t just use stock Android due to Samsung’s customization).

The real deal are many Tegra 2 based tablets running Honeycomb announced at CES and I guess many more are coming in the near future. I think this spring there will be enough tablets on the market to choose from. I don’t know yet which one I’ll buy but I am skeptic about Motorola and HTC. The first one because of Milestone fiasco .They released the same hardware as Droid in the US which is a Google reference device. Meaning Google support and stock Android. But they released its twin as Milestone in EU as completely closed system with rare and very late updates (requirement 7) as if EU doesn’t deserve and open device. Screw you Motorola. Nor do I trust HTC which, rather than supporting their phones or putting some effort and care into them, releases new and new models almost monthly. Not saying others are better or worse but I just don’t trust these two.

To be honest Samsung is very bad at supporting as well. Just look at their flagship Galaxy S phone which could be much better. Having a top notch hardware is FUBAR slow due to the incredible stupid decision to use RFS as their file system. You have to use one of the lagfixes to see it fly. OS customization bloat named Touch Wiz doesn’t help with upgrades - The OS upgrade speed shown so far is poor – upgrading to Froyo took them around 6 months.

I don’t know about other manufacturers but I assume they can be even worse. Hence I’d really appreciate a tablet running a stock Android or the possibility to install a stock Android. This way updates would be piece of cake. This is valid for phones as well, not just tablets.

I am still optimistic for this spring. Am I too demanding?

Should we get PocketPC/Windows Mobile OS upgrades (for free)?

In the times when HTC rules the Windows Mobile market with an absurd amount of different models nobody is questioning their (and perhaps MS’) tactics of pure greed and “buy new device each couple of months” logic just to get a bunch of issues fixed (and introduce new ones) and of course, to get a new OS version. True, along you’ll get newer hardware as well, but do you really need it?

The logic is simple: HTC shovels tons of good (or bad) hardware into the device, installs whatever Windows Mobile version is actual, includes drivers or not, checks the functionality by doing few tests in a day time span and releases the model. At least this is my impression. If something doesn’t work as expected you are free to purchase an improved version in a month or so. OS upgrades are very very rare and more of an exception than the rule. Missing drivers? No way they will provide any driver that is missing from the beginning even if it is a core driver, such as graphics accelerator.

In other words, upgrades are something they are really reluctant to offer. Why? Simple, more we sell more we profit. Am I spoiled by desktop computers where at least I can buy an upgrade? I don’t think so. And nor does Apple. They are giving iPhone upgrades for free. OK, iPhone isn’t perfect nor is Apple selling policy etc. but, they are providing upgrades for free. Something unthinkable in Windows Mobile world. Somebody might say that newer Windows Mobile requires better hardware and won’t run on existing devices and thus buying a new model is a necessity. Wrong. Take for example my TyTN II. It has almost the same graphics horsepower and a bit slower CPU as iPhone. Should it run WM 6.5? I think so and probably it will through self-cooked ROMs. Will it run an official version of WM 6.5? I very much doubt it.

And then there is Google Android:

Android is the first free, open source, and fully customizable mobile platform.

This approach is unthinkable again, this time for both HTC/MS and Apple. It is too soon to judge it but the idea is great. Is it possible that some day we’ll see new devices come with drivers only and we’ll be able to install whatever OS we’ll want? Just like our desktop machines? It doesn’t looks like a near future but Android is certainly a step in that direction.

Anyway, the most important difference between Apple and HTC/MS (hard to say who is responsible for what) is how they treat their devices. Apple treats them with love and care and they put a lot of effort to make them customer friendly. On the other side, HTC just puts hardware together, installs OS, throws them to customers and forgets about them. I wonder which is the policy you prefer. HTC/MS should learn something from both Apple and Google not just copy Apple’s marketplace thing (forthcoming WM feature) to make more money. It is the attitude! Even the super hyped honeycomb UI won’t make a significant difference (why the heck are people even speaking about it?).

Last but not least, mass producing instead of software upgrading unnecessarily burdens mother earth with enormous amounts of (HTC) waste.

I am currently stuck with HTC TyTN II/WM6.1 and I am waiting for a new gadget to appear. It just might be an Android one, but certainly not powered by HTC. My confidence in Windows Mobile is slowly vaporizing and I’ll most probably jump the wagon. Heck, even ease of development won’t convince me anymore (being a .net developer programming WM is somewhat familiar). It is just not quite the time for me to switch, yet.It is comming though.

Perhaps my impression is wrong, feel free to correct me. Note also that this article is more or less about the OS upgrades, not other problems.