In-Depth

MonoDroid Tutorial Part 1: Introduction to MonoDroid

In the first part of this tutorial series, Wallace McClure walks you through what MonoDroid is and how .NET developers can use it to create Android apps.

Update: The Mono Project on April 6 released Mono for Android 1.0, including the updated Visual Studio plugin. Download the tooling and files here.


The past year has been amazing for smartphone and mobile device lovers like me. It seems that everywhere I go, people are talking mobile. It's mobile this and mobile that, with good reason. Here are some interesting facts to consider:

  • Opera Software ASA, maker of the popular Opera browser, reports that more of its users are accessing the Internet over mobile devices than desktop systems.
  • According to Gartner Inc., smartphone sales grew 96 percent in the third quarter of 2010 year over year.
  • Market research firm Canalys reports that the Google Android platform is running on 43.6 percent of all smartphones that were shipped in the third quarter of 2010.
  • NPD Group Inc. reports similar results, with Android taking 44 percent of the smartphone market place during the third quarter of 2010.

Android is approaching 300,000 activations per day. Currently, there are more than 100,000 apps in the Android Marketplace. Application developers are clearly targeting the platform.

Steve Wozniak, cofounder of Apple Inc., recently said that he believes Android will be dominant in sales in the smartphone area due to the variety of devices based on Android on the market.

When I look at the growth of mobile and specifically Android, I'm truly amazed by what I see. As a Microsoft .NET Framework developer, I get jealous when I look at Android and iPhone. They're the two platforms currently getting the most attention in the smartphone marketplace. I see their success and think, "How can I get me some of that and leverage my existing knowledge and development tools?"

In this article, we'll look at Android and how MonoDroid will allow .NET developers to target the Android OS.

Introduction to Android and MonoDroid
Android is based on the Linux kernel. Google Inc. and the Open Handset Alliance have created an Android SDK. The SDK includes a set of tools built around a custom Java virtual machine (VM), named Dalvik, and the Eclipse IDE.

.NET developers are a large part of the development marketplace. .NET developers typically use Visual Studio to develop applications. Many of these .NET developers are looking at the Android marketplace with envy. While .NET/C# and Java are similar, they're not the same. They contain different pieces of functionality located in different places. The same is true with Eclipse and Visual Studio. They're conceptually similar, but they use different keystrokes to perform similar operations. .NET developers are asking themselves lots of questions: "How can we get some of this Android goodness with the least amount of pain? Will we be required to learn a new framework? How can we best leverage our knowledge of .NET/C#/Visual Studio? What about the ecosystem built around Visual Studio; will we be required to find plug-ins for Eclipse that mimic the plug-ins we use in Visual Studio?"

Novell, now Attachmate Corp., has stepped into this void. Novell has long supported the Mono Project. Mono is an open source implementation of the .NET Framework. It's not a complete port of .NET, but it provides the vast majority of APIs that developers use from the .NET Framework. Novell introduced MonoTouch in 2009 to allow .NET developers to develop native applications on the iPhone. Novell is doing the same thing with Android. The company is currently in the final stages of creating a product called MonoDroid. MonoDroid is a plug-in to Visual Studio 2010 that allows .NET developers to target Android. One of the key things that developers will need to be aware of is that MonoDroid is not a cross-platform tool. Apps that are built with MonoDroid will run on Android. They won't magically run on Windows, the iPhone or any other OS at this point in time.

MonoDroid contains the following items:

  • Plug-in to Visual Studio 2010: This plug-in allows developers to deploy apps to the Android Emulator running locally, as well as to a physical device connected over a USB cable and Wi-Fi. The plug-in allows MonoDroid to actively work with the rest of the Visual Studio ecosystem and integrate with the tools that developers are already using.
  • A set of project templates for Visual Studio 2010: These templates provide the basic structure for creating several types of MonoDroid projects.
  • The Mono runtime.
  • A set of libraries to allow .NET/Mono to integrate with Android and Java APIs.

MonoTouch creates a native application that contains the Mono runtime embedded within the application. MonoDroid can create two types of applications. The first is a single standalone application, which is similar to a MonoTouch application, with the app and the Mono runtime bound together. Everything that the application needs is embedded within the application. The second type is an application that makes use of a shared runtime that's installed on the device. This is similar to how .NET apps run on Windows. With this type of application, the app, along with other applications written with MonoDroid, can make use of a shared runtime.

In the next part of this series, we will begin work on building a sample MonoDroid application.

About the Author

Wallace B. McClure is a Microsoft MVP, an ASPInsider and a partner in Scalable Development Inc. He's authored books on software architecture, ADO.NET and SQL Server, AJAX, and iPhone programming with Mono and MonoTouch. You can read McClure's blog at morewally.com.

comments powered by Disqus
Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.