Advanced Android Application Development

Advanced Android Application Development

NOOK Book(eBook)

$44.99 $47.99 Save 6% Current price is $44.99, Original price is $47.99. You Save 6%.
View All Available Formats & Editions

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Product Details

ISBN-13: 9780133892451
Publisher: Pearson Education
Publication date: 11/11/2014
Series: Developer's Library
Sold by: Barnes & Noble
Format: NOOK Book
Pages: 624
File size: 25 MB
Note: This product may take a few minutes to download.

About the Author

Joseph Annuzzi, Jr., is a freelance software architect, graphic artist, writer, and technical reviewer. He usually can be found mastering the Android platform; implementing cutting-edge HTML5 capabilities; leveraging various cloud technologies; speaking in different programming languages; working with diverse frameworks; integrating with various social APIs; tinkering with peer-to-peer, cryptography, and computer vision algorithms; or creating stunningly realistic 3D renders. He is always on the lookout for disruptive Internet and mobile technologies and has multiple patent applications in process. He graduated from the University of California, Davis, with a B.S. in managerial economics and a minor in computer science, and he lives where much of the action is, Silicon Valley.


Lauren Darcey is responsible for the technical leadership and direction of a small software company specializing in mobile technologies, including Android, iOS, BlackBerry, Palm Pre, BREW, and J2ME, and consulting services. With more than two decades of experience in professional software production, Lauren is a recognized authority in application architecture and the development of commercial-grade mobile applications. Lauren received a B.S. in computer science from the University of California, Santa Cruz.


Shane Conder has extensive development experience and has focused his attention on mobile and embedded development for the past decade. He has designed and developed many commercial applications for Android, iOS, BREW, BlackBerry, J2ME, Palm, and Windows Mobile—some of which have been installed on millions of phones worldwide. Shane has written extensively about the mobile industry and evaluated mobile development platforms on his tech blogs and is well known within the blogosphere. Shane received a B.S. in computer science from the University of California.

Table of Contents

Acknowledgments xxxiii

About the Authors xxxv


Introduction 1

Who Should Read This Book? 1

How This Book Is Structured 1

Key Questions Answered in This Book 3

An Overview of Changes in This Edition 4

The Development Environment Used in This Book 5

Supplementary Materials Available 6

Where to Find More Information 6

Conventions Used in This Book 7

Contacting the Authors 8


Part I: Advanced Android Application Design Principles 9


Chapter 1: Threading and Asynchronous Processing 11

The Importance of Processing Asynchronously 11

Working with the AsyncTask Class 12

Working with the Thread Class 15

Working with Loaders 16

Understanding StrictMode 17

Summary 17

Quiz Questions 17

Exercises 18

References and More Information 18


Chapter 2: Working with Services 19

Determining When to Use Services 19

Understanding the Service Lifecycle 20

Creating a Service 20

Controlling a Service 25

Implementing a Remote Interface 26

Implementing a Parcelable Class 28

Using the IntentService Class 30

Summary 33

Quiz Questions 34

Exercises 34

References and More Information 34


Chapter 3: Leveraging SQLite Application Databases 35

Storing Structured Data Using SQLite Databases 35

Querying SQLite Databases 40

Closing and Deleting a SQLite Database 45

Designing Persistent Databases 46

Binding Data to the Application User Interface 48

Summary 53

Quiz Questions 54

Exercises 54

References and More Information 54


Chapter 4: Building Android Content Providers 55

Acting as a Content Provider 55

Enhancing Applications Using Content Providers 62

Summary 65

Quiz Questions 65

Exercises 65

References and More Information 65


Chapter 5: Broadcasting and Receiving Intents 67

Sending Broadcasts 67

Receiving Broadcasts 69

Securing Application Broadcasts 73

Summary 74

Quiz Questions 74

Exercises 75

References and More Information 75


Chapter 6: Working with Notifications 77

Notifying the User 77

A Word on Compatibility 78

Notifying with the Status Bar 78

Vibrating the Phone 84

Blinking the Lights 84

Making Noise 86

Customizing the Notification 86

Expandable and Contractible Notifications 88

Notification Priority 90

Introducing the Notification Listener 91

Designing Useful Notifications 91

Summary 92

Quiz Questions 92

Exercises 92

References and More Information 92


Part II: Advanced Android User Interface Design Principles 95


Chapter 7: Designing Powerful User Interfaces 97

Following Android User Interface Guidelines 97

Enabling Action Bars 98

Working with Styles 106

Working with Themes 111

Summary 113

Quiz Questions 113

Exercises 113

References and More Information 114


Chapter 8: Handling Advanced User Input 115

Working with Textual Input Methods 115

Handling User Events 119

Working with Gestures 123

Handling Screen Orientation Changes 134

Summary 137

Quiz Questions 137

Exercises 137

References and More Information 137


Chapter 9: Designing Accessible Applications 139

Exploring the Accessibility Framework 139

Leveraging Speech Recognition Services 141

Leveraging Text-to-Speech Services 145

Testing Application Accessibility 147

Summary 147

Quiz Questions 148

Exercises 148

References and More Information 148


Chapter 10: Development Best Practices for Tablets, TVs, and Wearables 151

Understanding Device Diversity 151

Developing Applications for Tablets 154

Developing Applications for TV 155

Developing Applications for Wearables 158

Summary 159

Quiz Questions 159

Exercises 159

References and More Information 160


Part III: Leveraging Common Android APIs 161


Chapter 11: Using Android Networking APIs 163

Understanding Mobile Networking Fundamentals 163

Understanding StrictMode with Networking 164

Accessing the Internet (HTTP) 164

Summary 173

Quiz Questions 173

Exercises 174

References and More Information 174


Chapter 12: Using Android Web APIs 175

Browsing the Web with WebView 175

Building Web Extensions 182

Debugging WebViews with Chrome DevTools 187

Working with Adobe AIR and Flash 187

Summary 188

Quiz Questions 188

Exercises 189

References and More Information 189


Chapter 13: Using Android Multimedia APIs 191

Working with Multimedia 191

Working with the Camera 192

Working with Video 200

Working with Face Detection 203

Working with Audio 204

Searching for Multimedia 207

Working with Ringtones 208

Introducing the Media Router 209

Summary 209

Quiz Questions 209

Exercises 210

References and More Information 210


Chapter 14: Using Android Telephony APIs 211

Working with Telephony Utilities 211

Using SMS 216

Making and Receiving Phone Calls 220

Working with SIP 222

Summary 223

Quiz Questions 223

Exercises 223

References and More Information 224


Chapter 15: Accessing Android’s Hardware Sensors 225

Interacting with Device Hardware 225

Using the Device Sensors 226

Sensor Event Batching 230

Monitoring the Battery 231

Summary 232

Quiz Questions 233

Exercises 234

References and More Information 234


Chapter 16: Using Android’s Optional Hardware APIs 235

Working with Bluetooth 235

Working with USB 239

Working with Android Beam 241

Working with Wi-Fi 245

Summary 248

Quiz Questions 248

Exercises 249

References and More Information 249


Part IV: Leveraging Google APIs 251


Chapter 17: Using Location and Map APIs 253

Incorporating Android Location APIs 253

Incorporating Google Location Services APIs 260

Incorporating Google Maps Android API v2 262

Summary 268

Quiz Questions 268

Exercises 269

References and More Information 269


Chapter 18: Working with Google Cloud Messaging 271

An Overview of GCM 271

What Alternatives to GCM Exist? 274

Summary 275

Quiz Questions 275

Exercises 275

References and More Information 276


Chapter 19: An Overview of In-App Billing APIs for Android 277

What Is In-App Billing? 277

Using In-App Billing 278

Leveraging Google Play In-App Billing APIs 279

Leveraging Amazon Appstore for Android In-App

Purchasing APIs 280

Leveraging PayPal Billing APIs 280

Leveraging Other Billing APIs 280

Summary 280

Quiz Questions 281

Exercises 281

References and More Information 281


Chapter 20: Enabling Application Statistics with Google Analytics 283

Creating a Google Account for Analytics 283

Adding the Library to Your Android IDE Project 286

Collecting Data from Your Applications 287

Logging Different Events 287

Using the Google Analytics Dashboard 288

Gathering E-commerce Information 290

Tracking Ad and Market Referrals 292

Gathering Statistics 292

Protecting Users’ Privacy 293

Summary 293

Quiz Questions 293

Exercises 294

References and More Information 294


Chapter 21: An Overview of Google Play Game Services 295

Getting Up and Running with Google Play Game Services 295

Incorporating Google Play Game Services into Your Applications 296

Understanding Achievements 297

Understanding Leaderboards 298

Saving Game Data with Cloud Save 299

Introducing Multiplayer Gaming 299

Understanding Antipiracy 299

Summary 300

Quiz Questions 300

Exercises 300

References and More Information 301


Part V: Drawing, Animations, and Graphics Programming with Android 303


Chapter 22: Developing Android 2D Graphics Applications 305

Drawing on the Screen 305

Working with Text 310

Working with Bitmaps 312

Working with Shapes 315

Leveraging Hardware Acceleration Features 324

Summary 326

Quiz Questions 326

Exercises 326

References and More Information 327


Chapter 23: Working with Animation 329

Animating Your Applications 329

Working with Different Interpolators 341

Animating Activity Launch 341

State Animations with Scenes and Transitions 342

Summary 342

Quiz Questions 342

Exercises 343

References and More Information 343


Chapter 24: Developing Android 3D Graphics Applications 345

Working with OpenGL ES 345

Using OpenGL ES APIs in the Android SDK 347

Handling OpenGL ES Tasks Manually 347

Drawing 3D Objects 353

Interacting with Android Views and Events 362

Cleaning Up OpenGL ES 365

Using GLSurfaceView (Easy OpenGL ES) 366

Using OpenGL ES 2.0 369

Exploring OpenGL ES 3.0 373

Summary 374

Quiz Questions 374

Exercises 374

References and More Information 375


Chapter 25: Using the Android NDK 377

Determining When to Use the Android NDK 377

Installing the Android NDK 378

Exploring the Android NDK Sample Application 379

Creating Your Own NDK Project 379

Improving Graphics Performance 384

Comparing RenderScript to the NDK 385

Summary 386

Quiz Questions 386

Exercises 386

References and More Information 386


Part VI: Maximizing Android’s Unique Features 389


Chapter 26: Extending Android Application Reach 391

Enhancing Your Applications 391

Working with App Widgets 392

Working with Live Wallpapers 404

Creating a Live Wallpaper 404

Introducing Daydream 408

Acting as a Content Type Handler 410

Determining Intent Actions and MIME Types 411

Summary 413

Quiz Questions 413

Exercises 414

References and More Information 414


Chapter 27: Enabling Application Search 415

Making Application Content Searchable 415

Enabling Searches in Your Application 416

Enabling Global Search 424

Summary 426

Quiz Questions 426

Exercises 426

References and More Information 426


Chapter 28: Managing User Accounts and Synchronizing User Data 427

Managing Accounts with the Account Manager 427

Synchronizing Data with Sync Adapters 429

Using Backup Services 430

Summary 435

Quiz Questions 436

Exercises 436

References and More Information 436


Part VII: Advanced Topics in Application Publication and Distribution 437


Chapter 29: Internationalizing Your Applications 439

Localizing Your Application’s Language 439

Right-to-Left Language Localization 445

Translation Services through Google Play 445

Publishing Applications for Foreign Users 446

Summary 446

Quiz Questions 446

Exercises 447

References and More Information 447


Chapter 30: Protecting Applications from Software Piracy 449

All Applications Are Vulnerable 449

Using Secure Coding Practices 450

Obfuscating with ProGuard 450

Leveraging the License Verification Library 452

Other Antipiracy Tips 453

Summary 454

Quiz Questions 454

Exercises 455

References and More Information 455


Part VIII: Preparing for Future Android Releases 457


Chapter 31: Introducing the L Developer Preview 459

Exploring the L Developer Preview 459

Introducing Android TV 464

Summary 465

Quiz Questions 465

Exercises 466

References and More Information 466


Part IX: Appendixes 467


Appendix A: Quick-Start Guide: Android Debug Bridge 469

Listing Connected Devices and Emulators 469

Directing ADB Commands to Specific Devices 470

Starting and Stopping the ADB Server 470

Listing ADB Commands 470

Issuing Shell Commands 471

Copying Files 472

Installing and Uninstalling Applications 473

Working with LogCat Logging 474

Controlling the Backup Service 476

Generating Bug Reports 477

Using the Shell to Inspect SQLite Databases 478

Using the Shell to Stress Test Applications 478

Installing Custom Binaries via the Shell 481

Summary 482

Quiz Questions 482

Exercises 483

References and More Information 483


Appendix B: Quick-Start Guide: SQLite 485

Exploring Common Tasks with SQLite 485

Using the sqlite3 Command-Line Interface 486

Learning by Example: A Student Grade Database 491

Summary 497

Quiz Questions 498

Exercises 498

References and More Information 498


Appendix C: Java for Android Developers 499

Learning the Java Programming Language 499

Learning the Java Development Tools 499

Familiarizing Yourself with Java Documentation 500

Understanding Java Shorthand 500

Summary 505

Quiz Questions 505

Exercises 505

References and More Information 505


Appendix D: Quick-Start Guide: Android Studio 507

Getting Up and Running with Android Studio 507

Understanding the Android Studio Project Structure 512

Learning about the Gradle Build System 513

Overview of the Android Studio User Interface 513

Introducing the Layout Editor 513

Debugging Your Android Studio Applications 515

Useful Keyboard Shortcuts 517

Summary 517

Quiz Questions 517

Exercises 518

References and More Information 518


Appendix E: Answers to Quiz Questions 519


Index 527

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews