As part of studying for my Xamarin Certification, I wanted some extra practice before sitting the exam. As such, I decided to do a Xamarin iOS and Android version of the same Xamarin.Forms timesheet app I implemented and wrote about before. The added bonus of this is that it could potentially provide a basis of comparison between ‘vanilla’ Xamarin and Xamarin.Forms. So in case it helps anybody, I have made the source code available on GitHub.
Xamarin iOS & Android Implementation:
Original Xamarin.Forms Implementation & Corresponding Blog:
I subsequently passed the exam … I am now
certifiable certified! 🙂 That will most definitely do me for a while in terms of exams and certifications, having notched up my MSCD, PSM I and now Xamarin in the past 6 months. I’ve enjoyed the process and they were all valuable experiences, but for now it is time for me to get my hands ‘dirty’!
For Xamarin developers, getting an Android emulator working is a commonly faced challenge since the standard one provided by Google is unworkably slow. When different operating systems and virtual machines are in the equation as well, the potential for encountering problems obviously increases. It is a common scenario however, and is how I prefer to work. More specifically, where possible I develop in Visual Studio inside a Windows virtual machine using Parallels, with Mac OS as the host providing access to the iOS emulator and build host. This allows me to use the IDE I already use on a daily basis when I am not on a mobile project, while also being able to run iOS, Android and Windows Phone emulators all on the one machine.
There is some information out there describing how to get GenyMotion working in such cross-platform environments, which uses the same Oracle VirtualBox technology as the newly launched Xamarin Android Player (XAP) under the covers. However, it is a little inconsistent and often involves some sort of complicated SSH tunnelling. So my grand plan was to document this entire process from end-to-end specifically for XAP since Xamarin did not document this initially. That is … until I was almost there after doing the crazy SSH tunnelling myself … I discovered a new blog post by Xamarin’s James Montemagno on the subject!
Newer versions of XAP make it easier still. Now all you need to do is to get the IP Address by clicking on the settings cog wheel in your XAP. In my case, it is 10.71.34.101.
Then, all you need to do is open an ‘Android Adb Command Prompt’ from Visual Studio and enter adb connect. You can also enter adb devices to check your connection status if you wish.
Note that however, you will still need to enable ‘USB debugging mode‘ to allow the Visual Studio debugger to do its thing. For those who don’t know the secret Android developer handshake … on your emulated Android device:
1. Go to Settings
2. Go to About phone
3. Click on Build number seven times
Hope that helps! And a big thank you to James and the Xamarin team for saving me from having to do the aforementioned crazy SSH tunnelling! 🙂
Updated: 17 March, 2015