Client Application - KeithWilliamsGMIT/4th-Year-Mobile-Application-Development-Project GitHub Wiki
Overview
The development and features of the client, or frontend, that will interact with the web service will be documented on this page. Note that this project was developed using Visual Studio 2015.
Xamarin Native vs Xamarin.Forms
This client will be developed using the Xamarin framework to create a cross-platform mobile application. There are two types of Xamarin projects. They are Xamarin.Forms and Xamarin Native, each of which have several pros and cons which make them suited to different situations. The key difference is that Xamarin.Forms allow for more code sharing and the same UI can be used for all platforms. However, this comes at the expense of a less customisable UI. According to the Xamarin website:
Xamarin.Forms is best for:
- Apps that require little platform-specific functionality.
- Apps where code sharing is more important than custom UI.
- Developers comfortable with XAML.
Xamarin Native is best for:
- Apps with interactions that require native behaviour.
- Apps that use many platform-specific APIs.
- Apps where custom UI is more important than code sharing.
Since this application will primarily be used to send and receive data from the web service the UI will relatively simple. The only native API that is needed is the camera.
Getting Started with Xamarin.Forms
When creating a new Xamarin.Forms project there are two code sharing strategies to choose from. They are Shared Project and Portable Class Library (PCL). Shared Project is the default and uses compile time directives for platform specific code. Portable Class Library use separate classes for platform specific code which is then injected into the project via dependency injection. The below table shows the advantages of each strategy.
Shared Project | Portable Class Library |
---|---|
Full Access to .Net Framework | No directives (readable and maintainable) |
The general consensus is to use Portable Class Library as it leads to more readable and maintainable code.