Introduction

Pioneered by the Open Handset Alliance and Google, Android is a popular, free, open-source mobile platform that has taken the wireless world by storm. This book and Android Wireless Application Development Volume I: Android Essentials provide comprehensive guidance for software development teams on designing, developing, testing, debugging, and distributing professional Android applications. If you’re a veteran mobile developer, you can find tips and tricks to streamline the development process and take advantage of Android’s unique features. If you’re new to mobile development, these books provide everything you need to make a smooth transition from traditional software development to mobile development—specifically, its most promising platform: Android.

Who Should Read This Book?

This book includes tips for successful mobile development based upon our years in the mobile industry and it covers everything you need to know to run a successful Android project from concept to completion. We cover how the mobile software process differs from traditional software development, including tricks to save valuable time and pitfalls to avoid. Regardless of the size of your project, this book is for you.

This book was written for several audiences:

Software developers who want to learn to develop professional Android applications. The bulk of this book is targeted at software developers with Java experience who do not necessarily have mobile development experience. More seasoned developers of mobile applications can learn how to take advantage of Android and how it differs from the other technologies of the mobile development market today.

Quality assurance personnel tasked with testing Android applications. Whether they are black box or white box testing, quality assurance engineers can find this book invaluable. We devote several chapters to mobile QA concerns, including topics such as developing solid test plans and defect tracking systems for mobile applications, how to manage handsets, and how to test applications thoroughly using all the Android tools available.

Project managers planning and managing Android development teams. Managers can use this book to help plan, hire, and execute Android projects from start to finish. We cover project risk management and how to keep Android projects running smoothly.

Other audiences. This book is useful not only to a software developer, but also for the corporation looking at potential vertical market applications, the entrepreneur thinking about a cool phone application, and the hobbyists looking for some fun with their new phones. Businesses seeking to evaluate Android for their specific needs (including feasibility analysis) can also find the information provided valuable. Anyone with an Android handset and a good idea for a mobile application can put the information provided in this book to use for fun and profit.

Why Two Volumes in the Third Edition?

We wrote the first edition of this book before the Android SDK was released. Now, three years and 14 Android SDK releases later, there is so much to talk about that we’ve had to divide the content of the Android wireless application development process into two separate volumes for this, the third edition.

Android Wireless Application Development Volume I: Android Essentials focuses on Android essentials, including setting up your development environment, understanding the application lifecycle and the user interface design, developing for different types of devices, and understanding the mobile software process from design and development to testing and publication of commercial-grade applications.

Android Wireless Application Development Volume II: Advanced Topics focuses on advanced Android topics, including leveraging various Android APIs for threading, networking, location-based services, hardware sensors, animation, graphics, and more. Coverage of advanced Android application components, such as services, application databases, content providers, and intents, is also included. Developers learn to design advanced user interface components and integrate their applications deeply into the platform. Finally, developers learn how to extend their applications beyond traditional boundaries using optional features of the Android platform, including the Android Native Development Kit (NDK), Cloud-To-Device Messaging service (C2DM), Android Market In-Application Billing APIs, Google Analytics APIs, and more.

Android Wireless Application Development Volume II: Advanced Topics is divided into seven parts. Here is an overview of the various parts in this book:

Part I: Advanced Android Application Design Principles

Part I picks up where Android Wireless Application Development Volume I: Android Essentials leaves off in terms of application design techniques. We begin by talking about asynchronous processing. We then move on to some of the more complex Android application components, such as services, application databases (SQLite), content providers, and intents and notifications.

Part II: Advanced Android User Interface Design Principles

Part II dives deeper into some of the more advanced user interface tools and techniques available as part of the Android SDK, including working with action bars and menus, gathering input through nonstandard methods such as gestures and voice recognition, and much more. You also learn more about how to develop applications that are accessible to different types of users with impairments.

Part III: Leveraging Common Android APIs

Part III dives deeper into some of the more advanced and specialty APIs available as part of the Android SDK, including networking, location-based services, multimedia (including the camera), telephony, and hardware sensors.

Part IV: Drawing, Animations, and Graphics Programming with Android

Part IV is for those developers incorporating graphics of any kind into their applications. We cover both 2D and 3D graphics (OpenGL ES and RenderScript), animation, and the Android NDK.

Part V: Maximizing Android’s Unique Features

Part V discusses some of the many ways the Android platform is different from other mobile platforms and how your applications can leverage its unique features. Here you learn how to extend your application features beyond the traditional borders of mobile applications, integrating them with the Android operating system. App Widgets, enabling searches, leveraging cloud-based services, and backups are just some of the topics discussed.

Part VI: Advanced Topics in Application Publication and Distribution

Part VI covers some more specialized topics in the realm of application publication and distribution, including how to internationalize your applications, enable In-App billing with the Android Market, track application usage patterns with Google Analytics, and take measures to protect your intellectual property from software pirates.

Part VII: Appendixes

Part VII includes a helpful quick start guide for the Android Debug Bridge tool and a refresher course on using SQLite.

Key Questions Answered in Volume II

This volume of the book answers the following questions:

1. How can developers write responsive applications?

2. How are Android applications structured? How are background operations handled with services? What are broadcast intents and how can applications use them effectively?

3. How do applications store data persistently using SQLite? How can applications act as content providers and why would they want to do so?

4. How do applications interact with the Android operating system? How do applications trigger system notifications, access underlying device hardware, and monitor device sensors?

5. How can developers design the best user interfaces for the devices of today and tomorrow? How can developers work with 2D and 3D graphics and leverage animation opportunities on Android?

6. How can developers write high-performance, computationally intensive applications using native code or RenderScript?

7. What are some of the most commonly used APIs for networking, location-based services, multimedia, telephony, and Internet access?

8. What do managers, developers, and testers need to look for when planning, developing, and testing a mobile development application?

9. How do mobile teams design bulletproof Android applications for publication?

10. How can developers make their applications leverage everything Android has to offer in the form of App Widgets, live wallpapers, and other system perks?

11. How can applications take advantage of some of the optional third-party APIs available for use, such as the Android Market’s In-App billing and license verification libraries, Google’s Analytics, and Cloud-to-Device Messaging (C2DM) services?

An Overview of Changes in This Edition

When we began writing the first edition of this book, there were no Android devices on the market. One Android device became available shortly after we started writing, and it was available only in the United States. Today there are hundreds of devices shipping all over the world—smartphones, tablets, e-book readers, wrist watches, and specialty devices such as the Google TV. The Android platform has gone through extensive changes since the first edition of this book was published. The Android SDK has many new features and the development tools have received much-needed upgrades. Android, as a technology, is now on solid footing in the mobile marketplace.

In this new edition, we took the opportunity to do a serious overhaul on book content—but don’t worry, it’s still the book readers loved the first (and second!) time, just bigger, better, and more comprehensive. To cover more of the exciting topics available to Android developers, we had to divide the book into two volumes. In addition to adding tons of new content, we’ve retested and upgraded all existing content (text and sample code) for use with the latest Android SDKs available while still remaining backwards compatible. The Android development community is diverse, and we aim to support all developers, regardless of which devices they are developing for. This includes developers who need to target nearly all platforms, so coverage in some key areas of older SDKs continues to be included as it’s often the most reasonable option for compatibility.

Here are some of the highlights of the additions and enhancements we’ve made to this edition:

• Coverage of the latest and greatest Android tools and utilities.

• Updates to all existing chapters, often with entirely new sections.

• New chapters, which cover new SDK features or expand upon those covered in previous editions.

• Updated sample code and applications, conveniently organized by chapter.

• Topics such as threading and asynchronous processing, creating content providers, broadcast intents, and animation frameworks now have their own chapters.

• Coverage of hot topics such as tablet and TV design, best practices, Renderscript, in-app billing, and Google Analytics.

• Even more tips and tricks from the trenches to help you design, develop, and test applications for different device targets, including an all-new chapter on tackling compatibility issues.

As you can see, we cover many of the hottest and most exciting features that Android has to offer. We didn’t take this review lightly; we touched every existing chapter, updated content, and added many new chapters. Finally, we included many additions, clarifications, and, yes, even a few fixes based upon the feedback from our fantastic (and meticulous) readers. Thank you!

The Development Environment Used in This Book

The Android code in this book was written using the following development environments:

Windows 7 and Mac OS X 10.7.x

• Eclipse Java IDE Version 3.7 (Indigo)

• Eclipse JDT plug-in and Web Tools Platform (WTP)

• Java SE Development Kit (JDK) 6 Update 26

• Android SDK Version 2.3.4, API Level 10 (Gingerbread MR1), Android SDK Version 3.2, API Level 13 (Honeycomb MR2), Android SDK Version 4.0.3, API Level 15 (Ice Cream Sandwich MR1)

1. ADT plug-in for Eclipse 16.0.1

2. SDK Tools Revision 16

3. Android Support Package r4

4. Android NDK r7

• Android devices: Samsung Galaxy Nexus, Motorola Droid 3, Samsung Galaxy tab 10.1, Asus Transformer Prime, Motorola Atrix 4G, and Logitech Revue

The Android platform continues to aggressively grow in market share against competing mobile platforms, such as Apple iOS and BlackBerry. New and exciting types of devices reach consumers’ hands at a furious pace, with new editions of the Android platform appearing all the time. Developers can no longer ignore Android as a target platform if they want to reach the smartphone (or smart-device) users of today and tomorrow.

Android’s latest major platform update, Android 4.0, frequently called by its code-name, Ice Cream Sandwich or just ICS, merges the smartphone-centric Android 2.3.x (Gingerbread) and the tablet-centric Android 3.x (Honeycomb) platform editions into a single SDK for all smart-devices, be they phones, tablets, televisions, or toasters. This book features the latest SDK and tools available, but it does not focus on them to the detriment of popular legacy versions of the platform. This book is meant to be an overall reference to help developers support all popular devices on the market today. As of the writing of this book, only a small percentage (less than 5 percent) of users’ devices run Android 3.0 or 4.0. Of course, some devices receive upgrades, and users purchase new devices as they become available, but for now, developers need to straddle this gap and support numerous versions of Android to reach the majority of users in the field.

So what does this mean for this book? It means we provide both legacy API support and discuss some of the newer APIs available only in later versions of the Android SDK. We discuss strategies for supporting all (or at least most) users in terms of compatibility. And we provide screenshots that highlight different versions of the Android SDK, because each major revision has brought with it a change in the look and feel of the overall platform. That said, we are assuming that you are downloading the latest Android tools, so we provide screenshots and steps that support the latest tools available at the time of writing, not legacy tools. Those are the boundaries we set when trying to determine what to include or leave out of this book.

Supplementary Materials Available

The source code that accompanies this book is available for download on the publisher website: http://www.informit.com/title/9780321813848. The source code is also available for download from our book website: http://androidbook.blogspot.com/p/book-code-downloads.html (http://goo.gl/kyAsN). You can also find a variety of Android topics discussed at our book website (http://androidbook.blogspot.com). For example, we present reader feedback, questions, and additional information. You can also find links to our various technical articles on our book website.

Where to Find More Information

There is a vibrant, helpful Android developer community on the Web. Here are a number of useful websites for Android developers and followers of the wireless industry:

Android Developer Website: The Android SDK and developer reference site:

http://developer.android.com/

Stack Overflow: The Android website with great technical information (complete with tags) and an official support forum for developers:

http://stackoverflow.com/questions/tagged/android

Open Handset Alliance: Android manufacturers, operators, and developers:

http://www.openhandsetalliance.com/

Android Market: Buy and sell Android applications:

http://www.android.com/market/

Mobiletuts+: Mobile development tutorials, including Android:

http://mobile.tutsplus.com/category/tutorials/android/

anddev.org: An Android developer forum:

http://www.anddev.org

Google Team Android Apps: Open source Android applications:

http://apps-for-android.googlecode.com/

Android Tools Project Site: The tools team discusses updates and changes:

https://sites.google.com/a/android.com/tools/recent

FierceDeveloper: A weekly newsletter for wireless developers:

http://www.fiercedeveloper.com/

Wireless Developer Network: Daily news on the wireless industry:

http://www.wirelessdevnet.com/

XDA-Developers Android Forum: From general development to ROMs:

http://forum.xda-developers.com/forumdisplay.php?f=564

Developer.com: A developer-oriented site with mobile articles:

http://www.developer.com/

Conventions Used in This Book

This book uses the following conventions:

Image is used to signify to readers that the authors meant for the continued code to appear on the same line. No indenting should be done on the continued line.

• Code or programming terms are set in monospace text.

• Java import statements, exception handling, and error checking are often removed from printed code samples for clarity and to keep the book a reasonable length.

This book also presents information in the following sidebars:


Image Tip

Tips provide useful information or hints related to the current text.



Image Note

Notes provide additional information that might be interesting or relevant.



Image Warning

Warnings provide hints or tips about pitfalls that may be encountered and how to avoid them.


Contacting the Authors

We welcome your comments, questions, and feedback. We invite you to visit our blog at:

http://androidbook.blogspot.com

Or, email us at:

[email protected]

Circle us on Google+:

• Lauren Darcey: http://goo.gl/P3RGo

• Shane Conder: http://goo.gl/BpVJh

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

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