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)

check.png Security model: The Linux kernel handles security between the application and the system.

check.png Memory management: The kernel handles memory management, leaving you free to develop your app.

check.png Process management: The Linux kernel manages processes well, allocating resources to processes as they need them.

check.png Network stack: The Linux kernel also handles network communication.

check.png 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.

9781118417454-fg0201.tif

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:

check.png The Android runtime: The Android runtime is composed of Java core libraries and the Dalvik virtual machine.

check.png Open GL (graphics library): This cross-language, cross-platform application program interface (API) is used to produce 2D and 3D computer graphics.

check.png WebKit: This open source web browser engine provides the functionality to display web content and to simplify page loading.

check.png SQLite: This open source relational database engine is designed to be embedded in devices.

check.png Media frameworks: These libraries allow you to play and record audio and video.

check.png 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.

9781118417454-fg0202.tif

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:

check.png Activity manager: Manages the activity life cycle.

check.png Telephony manager: Provides access to telephony services as well as to certain subscriber information, such as phone numbers.

check.png View system: Handles the views and layouts that make up your user interface (UI).

check.png 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.

9781118417454-fg0203.tif

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.

9781118417454-fg0204.tif

tip.eps Sometimes when you’re developing an Android application, you want to use the same resource as in the core Android system. A good example is an icon for a Settings menu option. By accessing the Android source code, you can browse the various resources and download the resources you need for your project. Having access to the source code also allows you to dig in and see exactly how Android does what it does. Be aware though that you need to follow Google’s branding guidelines when borrowing these resources. Find out more at http://developer.android.com/distribute/googleplay/promote/brand.html .

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.

remember.eps Just because one device has a fancy doohickey on it doesn’t mean that another device will. The only thing you can count on as a developer is the core Android framework. OHA members may have added an extra library to help facilitate something on a device, but you have no guarantee that this library will be available on another device in, say, Turkey or England. An exception occurs if you’re developing for a particular device, and only that device, such as an e-book reader. If that hardware has the sole function of reading books, you can program it for that specific purpose. Such as the Barnes & Noble Nook, which is powered by Android. It has special Forward and Back buttons that other Android devices don’t have. Therefore, you’d program for these buttons because this device is a special case (if you’re developing for the Nook), but you can’t expect these buttons to be used on other devices.

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.

technicalstuff.eps You’re expected to understand the basics of the Java programming language before you write your first Android application. If you’re feeling rusty and need a refresher course on Java, you can visit the Java tutorials site at http://docs.oracle.com/javase/tutorial .

tip.eps Though you find a little Java information in this book, you may want to spend some time with a good book like Java All-in-One For Dummies, by Doug Lowe (John Wiley & Sons, Inc.), if you have no Java experience.

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

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