Book Image

Xamarin Essentials

By : Mark Reynolds
Book Image

Xamarin Essentials

By: Mark Reynolds

Overview of this book

<p>Xamarin is a Mono-based suite of products that allows developers to create iOS and Android apps using C# and .NET.</p> <p>This learning guide is your first port of call to quickly learn Xamarin. Starting with the foundations by understanding the architecture behind Xamarin.iOS and Xamarin.Android, you will be guided through creating your first Xamarin.iOS and Xamarin.Android applications. In addition, you will learn how to utilize frameworks such as MvvmCross and Xamarin.Forms to increase the amount of code reuse. To conclude your journey, you will be shown how to develop your own Xamarin apps for distribution.</p> <p>Xamarin Essentials is the guide to use in order to quickly gain practical working knowledge of developing robust commercial mobile apps using C# and sharing large portions of your code base across iOS and Android apps.</p>
Table of Contents (17 chapters)
Xamarin Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Mono CLR and Dalvik VM – working side by side


Android apps run within the Dalvik Virtual Machine (Dalvik VM), which is somewhat similar to a Java VM, but optimized for devices with limited resources. As we discussed in Chapter 1, Xamarin and Mono – a Pathway to the Unnatural, Xamarin products are based on the Mono platform that has its own VM called the Common Language Runtime (CLR). The key question to ask here is, "In which environment does a Xamarin.Android app run?" The answer is both. If you take a look at the next diagram, you will see for yourself how these two runtimes coexist:

Both environments seem quite different from each other, so how does an app run in both? Xamarin.Android's power is achieved through a concept called peer objects and a Java framework called Java Native Interface (JNI).

Introducing the Java Native Interface

Let's start with JNI. This is a framework that allows non-Java code with languages such as C++ or C#, as an example, to call or be called by Java code running...