Fast introduction to Android development and Xamarin.Android


Published on: 2022-02-02

Table of contents:

If you ever thought if you can make dedicated Android applications without need to learn Java or Kotlin languages, then the anwser is yes. This introductory article explains basics of Android platform and development (long with some unfortunate pitfalls), then introduce Xamarin framework for buidling Android applications using .NET technologies.

This series will cover how to begin with Xamarin.Android development, deploy your apps to Android devices, how to implement common views and features, and show some good practices and tricks. For some fundamentals, I’ll link to Android developer documentation instead as they are more comprehensive. Provided footnotes may also contain more inforation on topic.

Note: There are a few things I wont write about, like making games for Android or using GMS services, as they are out of my scope.

Developing apps for Android is not an easy task as it seems to be at first. Before starting, you should know tasks like debugging weird behavior, implementing hacks for specific platforms, frequent API changes are going to be a thing. Making your app work on many different platforms and ensuring it’s long life requires a lot of commitment. Be ready to browse Stack Overflow for every tiny nitpick.

Note: Certain elements I write might be no longer valid due to Google deprecating features year later. Let's hope for the best and begin with introduction to Android development.

Explaining Android platform

The beating heart of Android is a modified Linux kernel, which contains all drivers, manages power and memory. One could say Android is a Linux distribution, which would make it the most popular distribution, but the matter is disputable.1

Every Android OS release has an API level provided to use for developers. Each may introduce new features, changes to existing features, or deprecate them. They are consistent for the most part, but be sure to read release notes, because some changes may catch you by suprise like removed support for custom view in Toasts in API level 31, or mentioned earlier scoped storage. For the most part, APIs are backwards compatible so unless new API breaks your app, there’s no reason not to upgrade to newer API level.2

Note: If you wish to distribute your application via Google Play, you will need to keep up with official release of new API level. There is a grace period for developers to update their apps, but after the period Google Play will no longer accept applications build with previous API level.

Android apps are internally Java applications, running isolated from system and every other app. 3 If you heard of “3 billion” devices run Java", then Android certainly adds to that number of devices. Operating system has a heavy hand in terms of control of applications. If apps dont follow certain rules, they will be killed without a warning, for example if app tries to use restricted feature without asking for permission like accessing camera, microphone or phone. Other example is when application is not responsive, because it’s using main thread for background work. On devices with aggressive memory management, app may be killed just like that.4

Unlike programming applications for PCs, Android environment is rich with many platforms, screen sizes, different features (GPS, accelerometer, external storage, etc.), system version, flavor and behavior.5 Even between brands, Android mostly looks different and works differently, even if they are same product type like smartphone. That’s because every vendor before releasing their devices can introduce their own software like drivers, apps, launchers, etc., and modify system behaviour to their needs.6

If your goal is to have your application work on every device, this task is nearly impossible. There are reasons behind it:

If you want to create an Android app, you need to plan which versions of Android you want to support, which devices to target, how to distribute your finished app, and you need to follow every Android update as they may bring major changes.

Those are just a few examples of difficulties you may encounter. Google tries to limit fragmentation of Android ecosystem, like introducing Project Treble10 or Android One program11, but the damage is already done12. Big programming teams, which can afford time and different devices to test on, are capable to catch up with changes as they arrive, while others may be not so lucky. Things dont look so bad when you start making your first application, but the deeper you go into the forest, the more branches and roots are going to be in your way.

Google Mobile Services

It’s true that Google plays a major part in Android ecosystem, since they are a driving force of Android OS.13 You will see it when using their apps and services like Google Play, the most important application distribution service for Android.14 The collection of Google’s apps and servcies are called Google Mobile Services, or GMS in short. GMS adds many apps and features to Android, including:

You can integrate your own Android app using APIs provided by Google, once you have Google Developer account and generated access token for your app.

However not every Android device will have GMS installed. If device has a non-GMS Android installed, features mentioned before wont be available out of the box. You may try to install Google apps manually (but wont be as integrated as factory installed GMS) or have to resort to alternative solutions.16 Currently if vendor wants to include GMS in their device, it has to go through certification process.17

Xamarin enters the ring

Cross-platform nature of .NET, like Java, has allowed to create Android apps using .NET technologies. The platform for making Android apps with .NET is called Xamarin. It made making Android apps easier for developers knowledgeable with C# language. Xamarin doesnt only support Android, but also iOS and (formely) Windows Phone, but I will focus on Android.18

Xamarin allows you to use two different frameworks to build apps: Xamarin.Android framework for dedicated Android application or .NET MAUI framework, an evolution of Xamarin.Forms, which is cross-platform. There are advantages and disadvantages for both.

Having a dedicated application means you have easier access to Android specific, which may not be available on other platforms, also development process and elements of Andoid application is as close to Java counterparts as possible. Dedicated application unfortunately wont work on other platforms like iOS.

NET MAUI framework is a different can of worms, as it allows you to make share one code-base to make applications for Android, iOS, Mac and Windows. However, if you wish to use platform specific features, you have to use platform’s APIs. The framework boasts a lot of different features too.19

This series will focus on Xamarin.Android framework. If you are still up for the task and want to make your own dedicated Android application using .NET, then that’s great news. Next article will mention on how to prepare your developer environment and make your own first Android application.


  1. https://www.androidauthority.com/android-linux-784964/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  2. https://medium.com/android-news/android-api-level-backward-and-forward-compatibility-10e6d31cb848
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  3. https://medium.com/programming-lite/android-core-jvm-dvm-art-jit-aot-855039a9a8fa
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  4. https://9to5google.com/2021/02/18/samsung-background-apps-android-11/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  5. https://www.androidauthority.com/android-skins-945375/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  6. https://source.android.com/setup/intro
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  7. https://www.computerworld.com/article/3175067/android-upgrade-problem.html
    Accessed: 2022-02-02 , [Archive]
     ↩︎

  8. https://dontkillmyapp.com/problem
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  9. https://medium.com/microsoft-mobile-engineering/scoped-storage-in-android-10-android-11-28d58d989f3c
    Accessed: 2022-02-02 , [Archive]
     ↩︎

  10. https://gdgbaroda.com/technical%20knowledge/stock-android-project-treble-article/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  11. https://www.pocket-lint.com/phones/news/google/129577-what-is-android-one
    Accessed: 2022-02-02 , [Archive]
     ↩︎

  12. https://www.hongkiat.com/blog/android-fragmentation/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  13. https://www.androidauthority.com/google-android-acquisition-884194/
    Accessed: 2022-09-29
     ↩︎

  14. https://blog.techliance.com/google-play/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  15. https://www.androidauthority.com/google-mobile-services-gms-3025963/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  16. https://www.androidpolice.com/install-google-play-store-any-android-device/
    Accessed: 2022-09-29
     ↩︎

  17. https://blog.esper.io/gms-vs-non-gms-for-android/
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  18. https://docs.microsoft.com/en-us/xamarin/get-started/what-is-xamarin
    Accessed: 2022-02-05 , [Archive]
     ↩︎

  19. https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui
    Accessed: 2022-02-05 , [Archive]
     ↩︎


Copyright 2022. Licensed under Creative Commons Attribution 4.0 International License.