Now is an exciting time for mobile developers. Mobile phones have never been more popular, and powerful smartphones are now a regular choice for consumers. Stylish and versatile phones packing hard-ware features like GPS, accelerometers, and touch screens are an enticing platform upon which to create innovative mobile applications.
Android hardware will be designed to tempt consumers, but the real win is for developers. With existing mobile development built on proprietary operating systems that restrict third-party applica-tions, Android offers an open and equal alternative. Without artificial barriers, Android developers are free to write applications that take full advantage of increasingly powerful mobile hardware. As a result, developer interest in Android devices has made their 2008 release a hugely anticipated mobile technology event.
Built on an open source framework, and featuring powerful SDK libraries and an open philosophy, Android has opened mobile phone development to thousands of developers who haven’t had access to tools for building mobile applications. Experienced mobile developers can now expand into the Android platform, leveraging the unique features to enhance existing products or create innovative new ones.
This book is a hands-on guide to building mobile applications using version 1.0 of the Android soft-ware development kit. Chapter by chapter, it takes you through a series of sample projects, each intro-ducing new features and techniques to get the most out of Android. It covers all the basic functionality as well as exploring the advanced features through concise and useful examples.
Since Android is a brand-new, version 1 product, there are only a small number of handsets currently available that support it. As with any early release, there are likely to be regular changes and improve-ments to the software and development libraries. The explanations and examples included in this book will give the grounding and knowledge you need to write compelling mobile applications using the current SDK, along with the flexibility to quickly adapt to future enhancements.
Whom This Article Is For
This article is for anyone interested in creating applications for the Android mobile phone platform. It includes information that will be valuable, whether you’re an experienced mobile developer or making your first foray, via Android, into writing mobile applications.
It will help if readers have used mobile phones (particularly phones running Android), but it’s not nec-essary, nor is prior experience in mobile phone development. It’s expected that you’ll have some experi-ence in software development and be familiar with basic development practices. While knowledge of Java is helpful, it’s not a necessity.
Chapters 1 and 2 introduce mobile development and contain instructions to get you started in Android. Beyond that, there’s no requirement to read the chapters in order, although a good understanding of the core components described in Chapters 3 through 6 is What This post Covers
Chapter 1 introduces Android, including what it is and how it fits into existing mobile development. What Android offers as a development platform and why it’s an exciting opportunity for creating mobile phone applications are then examined in greater detail.
Chapter 2 covers some best practices for mobile development and explains how to download the Android SDK and start developing applications. It also introduces the Android developer tools and demonstrates how to create new applications from scratch.
Chapters 3 through 6 take an in-depth look at the fundamental Android application components. Starting with examining the pieces that make up an Android application and its life cycle, you’ll quickly move on to the application manifest and external resources before learning about “Activities,” their life-times, and their life cycles.
You’ll then learn how to create User Interfaces with layouts and Views, before being introduced to the Intent mechanism used to perform actions and send messages between application components. Internet resources are then covered before a detailed look at data storage, retrieval, and sharing. You’ll start with the preference-saving mechanism before moving on to file handling and databases. This sec-tion finishes with a look at sharing application data using Content Providers.
Chapters 7 to 10 look at more advanced topics. Starting with maps and location-based services, you’ll move on to Services, background Threads, and using Notifications.
Android’s communication abilities are next, including sending and receiving messages through instant messaging and SMS. Hardware is then covered, starting with media recording and playback, before introducing the camera, accelerometers, and compass sensors. Chapter 10 concludes with a look at phone and networking hardware, starting with telephony APIs and going on to Bluetooth and network management (both Wi-Fi and mobile data connections).
Chapter 11 includes several advanced development topics, among them security, IPC, advanced graph-ics techniques, and user–hardware interactions.
How This Article Is Structured
This Article is structured in a logical sequence to help readers of different development backgrounds learn how to write advanced Android applications.
There’s no requirement to read each chapter sequentially, but several of the sample projects are developed over the course of several chapters, adding new functionality and other enhancements at each stage.
Experienced mobile developers with a working Android development environment can skim the first two chapters — which are an introduction to mobile development and instructions for creating your development environment — and dive in at Chapters 3 to 6. These cover the fundamentals of Android development, so it’s important to have a solid understanding of the concepts they describe. With this
before you venture into the remaining chapters. Chapters 7 through 11 cover a variety of optional and advanced functionality and can be read in whatever order interest or need dictates.
covered, you can move on to the remaining chapters, which look at maps, location-based Services, back-ground applications, and more advanced topics such as hardware interaction and netwoking.
What You Need to Use This content
To use the code samples in this post, you will need to create an Android development environment by downloading the Android SDK libraries and developer tools and the Java development kit. You may also wish to download and install Eclipse and the Android Developer Tool plug-in to ease your devel-opment, but neither is a requirement.
Android development is supported in Windows, MacOS, and Linux, with the SDK available from the Android web site.
You do not need an Android device to use this book or develop Android applications.
Chapter 2 outlines these requirements in more detail as well as describing where to download and how to install each component.
To help you get the most from the text and keep track of what’s happening, I’ve used various conven-tions throughout this lesson.
Notes, tips, hints, tricks, and asides to the current discussion are offset and placed in italics like this.
As for styles in the text:
❑ I show URLs and code within the text like so: persistence.properties. ❑ I present code in two different ways:
I use a monofont type with no highlighting for most code examples.
I use gray highlighting to emphasize code that’s particularly important in the present context.
❑In some code samples, you’ll see lines marked as follows: [… previous code goes here …]
[… implement something here …]
This represents an instruction to replace the entire line (including the square brackets) with actual code, either from a previous code snippet in the former case, or your own implementa-tion in the latter.