Android Concurrency

Android Concurrency

By: G. Blake Meike (author)Paperback

In Stock

£21.24 RRP £24.99  You save £3.75 (15%) & FREE Saver Delivery on orders over £25

Description

Mastering concurrency is critical to developing software with the performance and responsiveness you and your users expect - and this is especially true in Android mobile development. On Android, interruptions are more frequent and abrupt, and concurrency involves ordering user-visible events and synchronizing with component and process lifecycles, not just ensuring "thread safety." You need a deeper Android-specific understanding of concurrency - and Android Concurrency delivers it. Top Android developer and consultant Blake Meike has created a complete cookbook of best-practice solutions for fully leveraging the multi-core processors and heavily cached architectures now widespread on Android devices, and for taking advantage of significant improvements in the new Android 5 (Lollipop) release. You'll find intensely practical solutions for everything from inter-thread communication to network communication to debugging complex concurrency issues. More than this, Meike introduces a simple but powerful architectural framework you can use to address new concurrency issues whenever they arise. Android Concurrency combines in-depth knowledge, proven patterns and idioms, and expert guidance on avoiding problems: for serious Android developers, it's an indispensable resource.

Create a review

About Author

Blake Meike is a passionate engineer, code poet and a founding member of Twitter University. Before coming to Twitter, as an Android Evangelist for Open Source trainers, Marakana, Blake taught nearly a thousand people the art of writing Android apps that aren't toys. He has more than 20 years of coding experience, most of it with Java, building systems as large as Amazon's massively scalable AutoScaling service and as small as a pre-Android OSS/Linux and Java based platform for cell-phones. He is co-author of O'Reilly's bestselling "Programming Android" and Wiley's "Enterprise Android" and holds a degree in Mathematics and Computer Science from Dartmouth College. He currently lives in San Francisco Bay Area.

Contents

Preface xiii Chapter 1 Understanding Concurrency 1 Concurrency Made Hard 1 Concurrency in Software 2 Concurrency in Hardware 3 Concurrency Made Simple 4 Threads 4 Atomic Execution 5 Visibility 6 Summary 7 Chapter 2 Java Concurrency 9 Java Threads 9 The Thread Class 10 Runnables 11 Synchronization 11 Mutexes 12 Common Synchronization Errors 15 Volatile 17 Wait and Notify 20 Wait 20 Notify 22 The Concurrency Package 23 Safe Publication 23 Executors 25 Futures 26 Summary 27 Chapter 3 The Android Application Model 29 Lifecycles and Components 29 Process Priority 31 Component Lifecycles 33 Android Applications as Web Apps 35 The Android Process 36 Application Startup 36 The Android Main Thread 38 Summary 40 Chapter 4 Async Tasks and Loaders 41 Async Task Architecture 41 Async Task Basics 45 AsyncTask Execution 48 AsyncTask Completion 50 Using AsyncTasks 52 AsyncTask: Considered Dangerous 52 Getting It Right 58 Loaders and Cursor Loaders 59 AsyncTasks: What Went Wrong 67 Summary 68 Chapter 5 Looper/Handler 69 Introducing the Looper/Handler 69 Basic Looper/Handler 71 Delegating Execution 73 Some Gory Details 81 Handlers and Messages 81 Starting a Looper 84 The Native Looper 86 Scheduling and the Sync-Barrier 87 Summary 88 Chapter 6 Services, Processes, and Binder IPC 91 Service Basics 92 Started Service Essentials 93 Bound Service Essentials 95 Intents 96 The Intent Service 99 Bound Services 103 A Simple Bound Service 103 Binding A Service 105 Unbinding A Service 106 Binding Multiple Services 107 Service Lifecycle 109 Priorities and Flags 111 A Local Bound Service 112 Inter-Process Communication 114 Parcelables 116 Messengers 116 Using AIDL 120 Creating Processes 123 Binder, Considered Briefly 125 Binder Threads 125 Binder Data Transfer Limits 126 Binding to Death 126 Summary 126 Chapter 7 Periodic Tasks 127 Task Characteristics 127 Thread Safety 128 Lifecycle-Aware 128 Smart Use of Process Priority 128 Power-Thrifty 129 The Scorecard 130 Timer and TimerTask 130 Looper/Handler 130 Custom Service-based Scheduler 133 Alarm Manager and Intent Service 134 The Alarm Manager Service 135 Schedulable Tasks 139 Sync-Adapters 142 Defining a Sync-adapter 143 How Sync-adapters Work 145 Implementing the Sync-adapter 147 Scoring the Sync-adapter 152 The JobScheduler 155 Scheduling a Task 156 Running a Task 159 Task Implementation 161 Scoring the JobScheduler 165 Summary 166 Chapter 8 Concurrency Tools 167 Static Analysis 167 Android Studio 168 Findbugs 169 Annotations 177 JCIR Annotations 177 Support Library Annotations 178 Assertions 179 Conclusion and Best Practices 180 Bibliography 183 Index 185

Product Details

  • publication date: 24/06/2016
  • ISBN13: 9780134177434
  • Format: Paperback
  • Number Of Pages: 224
  • ID: 9780134177434
  • weight: 1000
  • ISBN10: 0134177436

Delivery Information

  • Saver Delivery: Yes
  • 1st Class Delivery: Yes
  • Courier Delivery: Yes
  • Store Delivery: Yes

Prices are for internet purchases only. Prices and availability in WHSmith Stores may vary significantly

Close