Figure 2-1: Some Linux kernel features.
Assembling Your Toolkit
After you know that you’re ready to be an Android developer, grab your computer and get cracking on installing the tools and frameworks necessary to build your first blockbuster application.
Linux 2.6 kernel
Android was created on top of the open source Linux 2.6 kernel. The Android team chose to use this kernel because it provided proven core features on which to develop the Android operating system. The features of the Linux 2.6 kernel include (but aren’t limited to)
Security model: The Linux kernel handles security between the application and the system.
Memory management: The kernel handles memory management, leaving you free to develop your app.
Process management: The Linux kernel manages processes well, allocating resources to processes as they need them.
Network stack: The Linux kernel also handles network communication.
Driver model: The goal of Linux is to ensure that the application works. Hardware manufacturers can build their drivers into the Linux build.
You can see a good sampling of the Linux 2.6 feature set in Figure 2-1.
Figure 2-1: Some Linux kernel features.
Android framework
Atop the Linux 2.6 kernel, the Android framework was developed with various features. These features were pulled from numerous open source projects. The output of these projects resulted in these elements:
The Android runtime: The Android runtime is composed of Java core libraries and the Dalvik virtual machine.
Open GL (graphics library): This cross-language, cross-platform application program interface (API) is used to produce 2D and 3D computer graphics.
WebKit: This open source web browser engine provides the functionality to display web content and to simplify page loading.
SQLite: This open source relational database engine is designed to be embedded in devices.
Media frameworks: These libraries allow you to play and record audio and video.
Secure Sockets Layer (SSL): These libraries are responsible for Internet security.
See Figure 2-2 for a list of common Android libraries.
Figure 2-2: Android and other third-party libraries sit atop the Linux 2.6 kernel.
Application framework
If you’ve read the preceding section, you may say, “Well, that’s all nice and well, but how do these libraries affect me as a developer?” It’s simple: All these open source frameworks are available to you via Android. You don’t have to worry about how Android interacts with SQLite and the surface manager; you use them as tools in your Android tool belt. The Android team has built on a known set of proven libraries, built in the background, and has given them to you, all exposed through Android interfaces. These interfaces wrapped up the various libraries and made them useful to the Android platform and to you as a developer. You benefit from these features because you don’t have to build any of the functionality they provide:
Activity manager: Manages the activity life cycle.
Telephony manager: Provides access to telephony services as well as to certain subscriber information, such as phone numbers.
View system: Handles the views and layouts that make up your user interface (UI).
Location manager: Finds the device’s geographic location.
Take a look at Figure 2-3 to see the libraries that make up the application framework.
Figure 2-3: A glimpse at part of the Android application framework.
From kernel to application, the Android operating system has been developed with proven open source technologies. You, as a developer, can therefore build rich applications that have been fostered in the open source community. See Figure 2-4 for a full picture of how the Android application framework stacks up. The Applications section is where your application sits.
Figure 2-4: How the Android application framework stacks up.
Open Handset Alliance libraries
Huh? You didn’t join an “alliance,” so what’s the Open Handset Alliance about? Don’t worry — you don’t have to use The Force to battle Darth Vader. It’s not that big of a deal, and it’s even kind of cool, like a bunch of smart companies combining their efforts to achieve the same goal.
The Open Handset Alliance (OHA) was announced in November 2007. At the time, the alliance consisted of 34 members, led by Google. With 84 members at the time this book was published, this group of technology and mobile companies (including T-Mobile, Sprint, LG, Motorola, HTC, NVidia, and Texas Instruments) have come together to pursue innovation in the mobile field and make the world a better place. Their goal is to provide users with comprehensive, compelling, and useful handsets. You can read more about the OHA at www.openhandsetalliance.com
.
You should be aware of the OHA because all the libraries that comprise the Android operating system are based on open source code. Every member contributes in its own, special way. Chip manufacturers ensure that chipsets support the platform; hardware manufacturers build devices; and other companies contribute intellectual property (code and documentation, for example). The goal is to make Android a commercial success.
As these members contribute, they also start to innovate on the Android platform. Some of this innovation is incorporated into the Android source code, and some of it remains the intellectual property of the alliance members as decided by the OHA.
Java knowledge
The Java programming language is one of the glorious tools that make programming Android a breeze compared with programming for other mobile platforms. Whereas other languages insist that you manage memory, de-allocate and allocate bytes, and then shift bits around like a game of dominoes, Java’s little buddy, the Java Virtual Machine (JVM), helps take care of that for you. The JVM allows you to focus on writing code to solve a business problem by using a clean, understandable programming language (or to build that next cool first-person shooter game you’ve been dreaming of) instead of focusing on the “plumbing” just to get the screens to show up.