From UWP/Xamarin Forms to Xamarin Android building an MVP ( Release Build) [Part 3]

Delaire Damien
4 min readFeb 5, 2020
Xamarin Android

In these articles I will go over my journey of building an application that runs on multiple platforms. My original application was a classic UWP application, next I built the same application but with Xamarin Forms XAML which you can find here.

The aim of these articles is to go over the different steps that were needed for my application to work. The application needed to have a horizontal listview , database/caching, audio and tracking.

This audio application was built using Xamarin.Android and will release it to the Google Play Store. We already have all of the C# code in a .Net Standard library which allows us to already have the API call, the caching mechanisms, our ViewModels and our Models.

We will finish the application by adding a splash screen, error tracking, tracking of views and lastly releasing it to the Google Play Store.

This article is broken into 3 parts:

This article is part of a part of a bigger series of articles that walk through the different steps that I went through to migrate an Audio application. You can find the articles here.

Creating a Splash screen as an Activity

Adding a Splash screen was a bit harder then on an UWP application, however it does give you a lot more control on how you wish your splash screen to look like. Microsoft did a great tutorial on how to implement a splash screen here :

I followed the Microsoft documentation above a which gave me this, my MVP had 3 UI elements that were located in Layout folder as follows:

Resources
/drawable
/drawable-XXXX
- splashscreen.png

My splashscreen.xml file looking as follows:

<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<!--<color android:color="@color/splash_background"/>-->
<shape android:shape="rectangle">
<solid android:color="@color/splash_background" />
</shape>
</item>
<item >
<bitmap
android:src="@drawable/splashscreen"
android:tileMode="disabled"
android:gravity="center"/>
</item>
</layer-list>

My splash screen is linked to an Activity that is set as the main launcher, once the splash screen is shown we will load our main Activity

Tracking and Error handling

On any application it is usually important to know what is happening on your application and being able to track errors happening.

First, I added Microsoft AppCenter for error handling calling

AppCenter.Start("63e4821b-3fe3-45eb-810c-8cb044f5f96e", typeof(Analytics), typeof(Crashes));

in my SplashActivity class in the OnCreate.

Now to report error we will just need to using Crashes.TrackError(exception);

To track view we can now use:

Analytics.TrackEvent(pageName);

Building for Release

The main advantage of using Xamarin.Android is that the build package size is reduced compared to the package sizes I got for Xamarin.Froms.

Here is the build specification that worked perfectly for me:

This created a 61.2 MB package size. Next, I created an Archive of my solution and manually uploaded my application the store.

All in all

After having use both Xamarin.Forms and Xamarin.Android briefly, I can definitively say that that the look and feel from using Xamarin.Android does make you feel that you are using native components which feel more natural. The learning curve for a UWP developer is a bit harder as you need to understand how the Android UI works, understanding how it works improved the look and feel of my application.

Having never worked with Form and Xamarin.Android before I had my reservation about these frameworks. After building this application and being able to reuse some of my UWP code in my Xamarin.Android application I can clearly see the advantage of sharing code and also keeping native specific components. My Xamarin.Android application had a faster startup time and better UI responses then the Forms app, and both applications look 90% the sane and have implement the exact same features.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Delaire Damien
Delaire Damien

Written by Delaire Damien

Technical Lead on (Windows & Smart TV apps) @Dailymotion, Windows Mobile/ Xbox/ Desktop Lover. Entrepreneur in spirit, I love working on side projects

No responses yet

Write a response