Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

About This Book

About This Book

Unlocking Android doesn’t fit nicely into the camp of “introductory text,” nor is it a highly detailed reference manual. The text has something to offer for both the complete Android novice and the experienced developer who is looking to sell his or her application in the Android Market. This book covers important beginner topics such as “What is Android” and installing and using the development environment. The text then advances to practical working examples of core programming topics any developer will be happy to have at the ready on the reference shelf. The final part of the book presents a pair of advanced application topics including a field service application with a web-based server side. The final chapter presents an out-of- the-box Native C application discussion and example.

The book is meant to be read from start to finish—and doing so will be of great value, as the chapters are laid out to build upon one another. However, if you are looking for a collection of practical, working samples, this title will also provide great value to you, particularly in part 2, where major subsystems and topics are broken down with practical examples.

The Audience

Unlocking Android is written for professional programmers and hobbyists alike. Many of the concepts can be absorbed without specific Java language knowledge, though the most value will be found by readers with Java programming skills because Android application programming requires them. A reader with C, C++, or C# programming knowledge will be able to follow the examples.

Prior Eclipse experience is helpful, but not required. There are a number of good resources available on Java and Eclipse to augment the content of this book.


This book is divided into three parts. Part 1 contains introductory material about the platform and development environment. Part 2 takes a close look at the fundamental skills required for building Android applications. Part 3 presents a larger scope application and a Native C Android application.

Part 1: The Essentials

Part 1 introduces the Android platform including the architecture and setting up the development environment.

Chapter 1 delves into the background and positioning of the Android platform, including comparisons to other popular platforms such as BlackBerry, iPhone, and Windows Mobile. After an introduction to the platform, the balance of the first chapter introduces the high-level architecture of Android applications and the operating system environment.

Chapter 2 takes you on a step-by-step development exercise teaching you the ropes of using the Android development environment, including the key tools and concepts for building an application. If you have never used Eclipse or have never written an Android application, this chapter will prepare you for the next part of the book.

Part 2: The Programming Environment

Part 2 includes an extensive survey of key programming topics in the Android environment.

Chapter 3 covers the fundamental Android UI components, including View and Layout. We also review the Activity in further detail. These are the basic building blocks of screens and applications on the Android platform. Along the way we also touch on other basic concepts such as handling external resources, dealing with events, and the lifecycle of an Android application.

Chapter 4 expands on the concepts we learned in chapter 3 and we delve into the Android Intent to demonstrate interaction between screens, activities, and entire applications. Also we introduce and utilize the Service, which brings background processes into the fold.

Chapter 5 incorporates methods and strategies for storing and retrieving data locally. The chapter examines use of the filesystem, databases, the SD card, and Android specific entities such as the SharedPreferences and ContentProvider classes. At this point we begin combining fundamental concepts with more real-world details, such as handling application state, using a database for persistent storage, and working with SQL.

Chapter 6 deals with storing and retrieving data over the network. Here we include a networking primer before delving into using raw networking concepts such as sockets on Android. From there we progress to using HTTP, and even exploring web services (such as REST and SOAP).

Chapter 7 covers telephony on the Android platform. We touch on basics such as originating and receiving phone calls, as well as more involved topics such as working with SMS. Along the way we also cover telephony properties and helper classes.

Chapter 8 looks at how to work with Notifications and Alarms. In this chapter we look at how to notify users of various events such as receiving a SMS message as well as how to manage and set alarms.

Chapter 9 deals with the basics of Androids Graphics API as well as more advanced concepts such as working with the OpenGL ES library for creating sophisticated 2D and 3D graphics. We will also touch upon animation.

Chapter 10 looks at Androids support for multimedia and we will cover both playing multimedia as well as using the camera and microphone to record our own multimedia files.

Chapter 11 introduces Location-based services as we look at an example that combines many of the concepts from the earlier parts of the book in a mapping application. Here we learn about using the mapping APIs on Android, including different location providers and properties that are available, how to build and manipulate map related screens, and how to work with location related concepts within the emulator.

Part 3: Bringing it All Together

Part 3 contains two chapters, both of which build upon knowledge from earlier in the text with a focus on bringing a larger application to fruition.

Chapter 12 demonstrates an end-to-end Field Service Application. The application includes server communications, persistent storage, multiple Activity navigation, menus, and signature capture.

Chapter 13 explores the world of native C language applications. The Android SDK is limited to the Java language although native applications may be written for Android. This chapter walks you through examples of building C language applications for Android including the use of built-in libraries and TCP socket communications as a Java application connects to our C application.

The Appendices

The appendices contain additional information which didn’t fit with the flow of the main text. Appendix A is a step-by-step guide to installing the development environment. This appendix, along with chapter 2, provides all the information needed to build an Android application. Appendix B demonstrates how to create an application for the Android Market—an important topic for anyone looking to sell an application commercially.

Code Conventions

All source code in the book is in a fixed-width font like this, which sets it off from the surrounding text. For most listings, the code is annotated to point out the key concepts, and numbered bullets are sometimes used in the text to provide additional information about the code. We have tried to format the code so that it fits within the available page space in the book by adding line breaks and using indentation carefully. Sometimes, however, very long lines will include line-continuation markers.

Source code for all the working examples is available from or A readme.txt file is provided in the root folder and also in each chapter folder; the files provide details on how to install and run the code. Code examples appear throughout this book. Longer listings will appear under clear listing headers while shorter listings will appear between lines of text. All code is set in a special font to clearly differentiate it.

Software Requirements

Developing applications for Android may be done from the Windows XP/Vista environment, a Mac OS X (Intel only) environment or a Linux environment. Appendix A includes a detailed description of setting up the Eclipse environment along with the Android Developer Tools plug-in for Eclipse.

Author Online

Purchase of Unlocking Android includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and from other users. To access the forum and subscribe to it, point your web browser to or This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialog between individual readers and between readers and the authors can take place. It’s not a commitment to any specific amount of participation on the part of the authors, whose contribution to the AO remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint