Building a non-trivial cross platform app using Xamarin

Over the past year or two we’ve been using Xamarin to build a moderately complex mobile application. On Key Work Manager is a mobile work order management solution that enables your field service staff to manage their work assignments and forms part of the On Key Enterprise Asset Management system.

To illustrate why I say this is as a moderately complex app, here are some of the features:

  • Location tracking
  • Maps integration
  • Electronic PDF form filling and generation
  • Electronic signatures to support signing off job cards
  • Barcode scanning of assets
  • Document attachments including photos, in-app voice recordings etc.
  • Local notifications
  • Background services to synchronise data whilst the app is not running
  • Full offline support - i.e. app functionality works in offline environments and only requires peridic connectivity to synchronise changes to server

Based on local market demands, we targeted Android first and published the Android version of the application mid 2016. Last week we published the iOS version of the application.

I’ve had one or two enquiries from people on what tools/libaries/frameworks we used to build the app. This post will give a rundown of what we use.

Frameworks

One of the principles we followed from the word go, was to try and maximize the re-use of shared logic across the different platforms. The team had experience using the MVVM pattern so we decided on using a framework that would supprt the MVVM pattern. Xamarin Forms was still in its infancy at that stage so we decided to look for a framework that would allow us to build directly on top of the native platform thus giving us full access to the native platform performance, native iOS and Android controls, native navigation mechanisms etc.

We ended up using a blend of the excellent MvvmCross and our own small homegrown framework that covered aspects like navigation and bootstrapping a bit differently as to how MvvmCross prescribes. This is a big shout out to the community members behind MvvmCross like Tomasz and Martijn00. The fact that we were able to replace aspects of MvvmCross is also a compliment to the overall design of the framework. MvvmCross v5 is shaping up to be an awesome release as well.

Using the MVVM pattern we are able to share up to 70-75% of the code base between the different platforms in a PCL library.

Testing

We have an extensive set of NUnit unit tests covering the shared logic contained in our PCL library that we execute on our TeamCity CI server. We are also in the early phases of using Xamarin.UITest to do automated UI testing.

Plugins/3rd Party Components

We use the following plugins/components to support the app features:

NuGet Packages/Libraries

Besides the frameworks/plugins/controls, we use the following NuGet packages:

Testing/Analytics/Crash Reporting

For ALPHA, BETA testing, crash reporting and application insights we use HockeyApp

I think that’s about it! Since we started using Xamarin, the whole ecosystem around Xamarin including the plugins, components have evolved quite nicely. This allows us to focus on building the features of our app instead of having to re-invent the wheel. Overall we are quite happy with how our code base has turned out and we are looking forward to building more apps using Xamarin.

Comments