Chapter 1
Introduction to Android, Mobile Devices, and the Marketplace
What's in This Chapter?
- A short history of Mono and its relationship to the .NET Framework
- How Mono for Android opens the Android platform to .NET developers
- Why Mono for Android is so attractive to developers
- The history of Android and its mind share
- Exploring cross-platform alternatives
The past several years have seen an amazing growth in the use of smartphones. USA Today recently reported on how smartphones have become an indispensable part of people's lives. With growth and popularity comes competition, and, unlike desktop computers, no single vendor or platform dominates the mobile device marketplace; devices based on Symbian, Research in Motion (Blackberry), Windows Mobile, Android, and other platforms are available. In addition, devices may run the same operating system and be presented to the user in separate form factors. This fracture in the marketplace is problematic for developers: How can they take a development framework or tool that they already know and use that knowledge in a device that has a large and growing market share?
This chapter looks at how the largest segment of developers (.NET/C# developers) can target the smartphone that has the highest mind share (Android). It also looks at how the smartphone is growing faster in market share than any other device.
Product Comparison
This section takes a quick look at the .NET Framework, Mono, and Mono for Android. These products have allowed the largest segment of developers to target the Android family of mobile devicesthe fastest-growing mobile platform currently on the market.
The .NET Framework
Over the past decade, the popularity of the .NET Framework has grown. In the late 1990s, Microsoft began working on the .NET Framework. The first version shipped in 2002. Microsoft recently introduced .NET Framework 4. The .NET Framework comes in various versions, including 32-bit, 64-bit, a version for the Xbox gaming platform, and a version for Microsoft's mobile devices called the Compact Framework (CF). Here are a few key facts about the .NET Framework to keep in mind as you begin to look at the Mono framework:
- Microsoft released a development tool, Visual Studio . NET , with this framework. This tool is the integrated development environment for .NET.
- This framework is based on a virtual machine that executes software written for the framework. This virtual-machine environment is called the Common Language Runtime (CLR), and it is responsible for security, memory management, program execution, and exception handling.
- Applications written in the .NET Framework are initially compiled from source code, such as Visual Basic or C#, to an intermediate language, called MSIL. The initial compilation is performed by calling the language-specific command-line compiler, Visual Studio, or some other build tool. A second compilation is typically performed when an application is executed. This second compilation takes the intermediate language and compiles it into executable code that can be run on the operating system. This second compilation is called just - in - time (JIT) compilation .
- This framework is language-independent, and numerous languages are available for it. In Visual Studio, Microsoft has shipped various languages, including Visual Basic, F#, C++, and C#.
- This framework has a series of libraries that provide consistent functionality across the various languages. These libraries are called the base class libraries .
- Microsoft has submitted various parts of the .NET Framework to various standards organizations, including those for the C# language, the Common Language Infrastructure, Common Type System (CTS), Common Language Specification (CLS), and Virtual Execution System (VES).
- This framework has the largest number of developers of any development framework. As a result, more developers are familiar with the .NET Framework than any other development framework.
- A disadvantage of the .NET Framework is that it is unavailable for non-Microsoft platforms.
The significance of all this is that Microsoft has created a standards-based environment for the .NET Framework. Though most developers working on the Microsoft platform are not worried about the standards compliance of the .NET Framework, the significance of this aspect of the .NET Framework cannot be understated. By defining these standards and submitting these standards to compliance committees, Microsoft has created a group of developers that can integrate at fairly low levels into the .NET Framework. In this environment, Miguel de Icaza had a vision and stepped up to create the Mono framework discussed next.
Mono
Mono is an open source project that provides a C# compiler and CLR on non-Windows operating systems. Mono is currently licensed under GPL version 2, LGPL version 2, the MIT, and dual licenses. Mono runs on Mac, Linux, BSD, and other operating systems. Along with the C# compiler, additional languages run on Mono, including F#, Java, Scala, Basic, and others.
Mono, the brainchild of Miguel de Icaza, was officially announced in 2001. Version 1.0 shipped in 2004, and currently Mono is at version 2.10, though it is continually being upgraded and will most likely be at a later version by the time you read this. Currently, Mono has parity with many of the features in .NET 4. Mono continues to be directly led by de Icaza. Recently, the stewardship of Mono has passed to Xamarin. Xamarin leads the direction of Mono. Mono started as an open source implementation of a C# compiler. It grew from this initial design into the current open source implementation of .NET. It is now Xamarin's responsibility to nurture Mono. Xamarin is responsible for the development of Mono for Android, MonoTouch, and the software that makes these products work for the developer. Given that Xamarin is laser-focused on Mono in the mobile area, I think these products are in good hands.
As much as there is a desire to match the .NET Framework's features, this is not possible because Microsoft has more resources and a head start on the development of those features. At the same time, the Mono project has parity with a large number of .NET Framework features. The best that Xamarin will most likely accomplish is to be shortly behind the .NET Framework for most of the APIs that are possible.
Along with Mono is the open source IDE called MonoDevelop , which started as a port of the SharpDevelop IDE. MonoDevelop began as a project to allow for Mono development on Linux, but with the release of MonoDevelop 2.2, the ability to develop with Mono expanded to the Mac, Windows, and several other non-Linux UNIX platforms.
Although the .NET Framework is very popular, two issues make it unsuitable for running on Android:
- At some level Google and Microsoft are competitors and are probably not too excited to work together. Microsoft has had Windows Mobile devices for years, which compete directly with Google's Android operating system.
- The .NET Framework fundamentally is a major competitor for the Java Virtual Machine that is at the heart of an Android device. This Java VM is called Dalvik. The .NET Framework and Java have been competitors since the initial announcements of the .NET Framework.
A disadvantage of .NET/Mono and Android is that .NET/Mono developers cannot take their .NET/Mono/C# knowledge and apply it to the Android platform. shows this concept..NET/Mono developers can't target Android because they're two separate entities.