While most of this book will be focused on learning how to develop Android apps using C# and Xamarin.Android, we will start with a more general discussion of Android. What is Android? How does Android facilitate the task of creating great mobile apps? The Anatomy of an Android App will help to answer these questions by providing a base-level understanding of the following topics:
The Android platform has been one of the most successful platforms developed in recent years and provides developers with many services and features required to create rich mobile applications. The following diagram provides a high-level view of how the Android platform is organized, and the subsequent sections provide a brief description of each major component:
Android is a Linux-based operating system designed primarily for mobile devices such as smartphones and tablets. The latest versions of Android are based on Linux kernel Version 3.x (Version 2.6 for versions prior to Android 4.0).
Android is delivered with a set of native libraries written in C/C++, which provide various types of services. These libraries predominantly come from the open source community.
Android apps run within the Dalvik Virtual Machine (Dalvik VM), which is similar to a Java VM but has been optimized for devices with limited memory and processing capacity.
Android apps are initially compiled to the Java byte code using the Java compiler, but they have an additional compilation step that transforms the Java byte code to the Dalvik byte code, suitable to run within the Dalvik VM.
Dalvik is delivered with the Android core libraries. These libraries do not align with a specific Java platform (JSE, JEE, or JME) but rather act as a hybrid platform most closely aligned with JSE, minus the user interface-focused components AWT and Swing. The Android Application Framework (AAF) provides an alternate means of creating user interfaces.
The Application Framework is the part of the Android platform, most familiar to developers. It is delivered as a set of Java libraries and allows you to build user interfaces, interact with device capabilities such as the camera or location services, load and work with various types of application resources, and perform many more useful tasks.
At the top of the stack sits the humble application, the component that actually delivers value to the user. Android comes with a set of applications that provide base functionality such as managing contacts, using the phone, checking email, and browsing the Web. The key to Android's success is the vast array of third-party applications that can be installed, which allow users to do things such as stream live sports' events, edit a movie captured on the phone, interact with friends through their favorite social media site, and much more.
Applications are delivered for installation in an Android package format. An Android package is created as the result of compiling an Android app and is an archive file with a .apk
extension. An Android package contains all of the code and the supporting files required to run a single application including the following:
*.dex
files)Android packages can be installed directly via e-mails, URLs, or memory cards. They can also be installed indirectly through app stores such as Google Play.
All Android applications have a manifest file (AndroidManifest.xml
) that tells the Android platform everything it needs to know to successfully run the application, including the following:
Identifying the version of the Android platform can be somewhat confusing; there is a version number, API level, and nickname, and these are sometimes used interchangeably.
The version number represents a release of the platform. Sometimes, a new release is created to deliver new capabilities, while sometimes it is created to fix bugs.
The API level represents a set of capabilities. As the API level increases, new capabilities are delivered to the developer.
The following table lists the versions of the platform in the reverse chronological order:
Platform version |
API level |
Nickname |
Released |
---|---|---|---|
4.4 |
19 |
KitKat |
10/31/2013 |
4.3 |
18 |
Jelly Bean |
07/24/2013 |
4.2, 4.22 |
17 |
11/13/2012 | |
4.1, 4.11 |
16 |
07/09/2012 | |
4.0.3, 4.0.4 |
15 |
Ice Cream Sandwich |
12/16/2011 |
4.0, 4.01, 4.02 |
14 |
10/19/2011 | |
3.2 |
13 |
Honeycomb |
07/15/2011 |
3.1.x |
12 |
05/10/2011 | |
3.0.x |
11 |
02/22/2011 | |
2.3.3, 2.3.4 |
10 |
Gingerbread |
02/02/2011 |
2.3, 2.3.1, 2.3.2 |
9 |
12/06/2010 | |
2.2.x |
8 |
Froyo |
05/20/2010 |
2.1.x |
7 |
Éclair |
01/12/2010 |
2.0.1 |
6 |
12/03/2009 | |
2.0 |
5 |
10/26/2009 | |
1.6 |
4 |
Donut |
09/15/2009 |
3.141.193.158