Chapter 1. The Anatomy of an Android App

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
  • Android applications (Building Blocks)

The Android platform

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:

The Android platform

Linux

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).

Native libraries

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.

The Android runtime

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.

The Android runtime

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

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.

Applications

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.

The Android packages (.apk)

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:

  • Dalvik executables (*.dex files)
  • Resources
  • Native libraries
  • The application manifest

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.

The application manifest

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:

  • Minimum API Level required by the application
  • Hardware/software features used or required by the application
  • Permissions required by the application
  • The initial screen (Android activity) to start with when the application is launched
  • Libraries, other than AAF, required by the application
  • And so on

Versions of Android

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

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.193.158