چه کسانی این کتاب را می‌خوانند

دانشجوعلاقه‌مند یادگیری
کتابخوان حرفه‌ایلذت مطالعه
نویسندهالهام‌گیری

Asynchronous Android Programming - Second Edition

Helder Vasconcelos; Steve Liles

قیمت نهایی

۴۹٬۰۰۰ تومان

نسخه اصلی و اورجینال

بلافاصله پس از خرید، فایل کتاب روی دستگاه شما آمادهٔ دانلود است.

تحویل فوری
پرداخت امن
ضمانت فایل
پشتیبانی

مشخصات کتاب

سال انتشار
۲۰۱۶
فرمت
PDF
زبان
انگلیسی
تعداد صفحات
۵ صفحه
حجم فایل
۲٫۶ مگابایت
شابک
9781785883248، 9781785885518، 1785883240، 1785885510

دربارهٔ کتاب

About This Book Construct scalable and performant applications to take advantage of multi-thread asynchronous techniques Explore the high-level Android asynchronous constructs available on the Android SDK Choose the most appropriate asynchronous technique to implement your next outstanding feature Who This Book Is For This book is for Android developers who want to learn how to build multithreaded and reliable Android applications using high-level and advanced asynchronous techniques and concepts. What You Will Learn Get familiar with the Android process model and low-level concurrent and multithread constructs available on the Android SDK Use AsyncTask to load data in the background, delivering progress results in the meantime Enhance UI performance and responsiveness by sending work to a service running in the background Defer, schedule, and batch work on the Android system without compromising the battery life and user experience Use the JNI interface to execute concurrent work on native layer Pull and push data from your network servers using the Google GCM platform Create and compose tasks with RxJava to execute complex asynchronous work in a predictable way Get accustomed to the use of the Android Loader construct to deliver up-to-date results In Detail Asynchronous programming has acquired immense importance in Android programming, especially when we want to make use of the number of independent processing units (cores) available on the most recent Android devices. To start with, we will discuss the details of the Android process model and the Java low-level concurrent framework, delivered by the Android SDK. Next, we will discuss the creation of IntentServices, bound services, and external services, which can run in the background even when the user is not interacting with them. In a more advanced phase, you will create background tasks that are able to execute CPU-intensive tasks in native code–making use of the Android NDK. You will be then guided through the process of interacting with remote services asynchronously using the HTTP protocol or Google GCM Platform. Finally, we will introduce RxJava, a popular asynchronous Java framework used to compose work in a concise and reactive way. Cover 1 Copyright 3 Credits 4 About the Author 5 About the Reviewer 6 www.PacktPub.com 7 Table of Contents 8 Preface 14 Chapter 1: Asynchronous Programming in Android 20 Android software stack 21 Dalvik runtime 21 ART runtime 22 Memory sharing and Zygote 23 Android process model 24 Process ranks 24 Process sandboxing 25 Android thread model 25 The main thread 26 The Application Not Responding (ANR) dialog 28 Maintaining responsiveness 29 Concurrency in Android 31 Correctness issues in concurrent programs 33 Liveness issues in concurrent programs 35 Thread coordination 35 Concurrent package constructs 38 Executor framework 39 Android primary building blocks 40 Activity concurrent issues 40 Manipulating the user interface 42 Service concurrent issues 44 Started services issues 44 Bound services issues 45 Service in a separate process 46 Broadcast receiver concurrent issues 47 Android concurrency constructs 47 Summary 48 Chapter 2: Performing Work with Looper, Handler, and HandlerThread 50 Understanding Looper 51 Understanding Handler 53 Sending work to a Looper 56 Scheduling work with post 58 Using Handler to defer work 59 Leaking implicit references 60 Leaking explicit references 62 Updating the UI with Handler 64 Canceling a pending Runnable 65 Scheduling work with send 66 Cancelling pending messages 69 Composition versus inheritance 71 Multithreading with Handler and ThreadHandler 72 Looper message dispatching debugging 77 Sending messages versus posting runnables 78 Applications of Handler and HandlerThread 78 Summary 79 Chapter 3: Exploring the AsyncTask 80 Introducing AsyncTask 81 Declaring AsyncTask types 84 Executing AsyncTasks 86 Providing indeterministic progress feedback 88 Providing deterministic progress feedback 91 Canceling an AsyncTask 94 AsyncTask Execution State 97 Handling exceptions 98 Controlling the level of concurrency 100 Common AsyncTask issues 103 Fragmentation issues 103 Memory leaks 104 Activity lifecycle issues 104 Handling lifecycle issues with early cancellation 105 Handling lifecycle issues with retained headless fragments 106 Applications of AsyncTask 111 Summary 112 Chapter 4: Exploring the Loader 114 Introducing Loaders 115 Loader API 115 Loader 116 Loader Manager 117 LoaderManager.LoaderCallbacks 118 Loader lifecycle 119 Loading data with Loader 120 Building responsive apps with AsyncTaskLoader 126 Building responsive apps with CursorLoader 135 Combining Loaders 138 Applications of Loader 144 Summary 144 Chapter 5: Interacting with Services 146 Introducing Service 147 Started service 150 Building responsive apps with IntentService 155 Handling results 158 Posting results with PendingIntent 158 Posting results as system notifications 161 Applications of IntentService 162 HTTP uploads with IntentService 163 Reporting progress 165 Bound Service 168 Communicating with a Local Service 169 Broadcasting results with intents 177 Detecting unhandled broadcasts 179 Applications of Services 182 Summary 183 Chapter 6: Scheduling Work with AlarmManager 184 Introducing AlarmManager 185 Scheduling alarms with AlarmManager 186 Setting alarms in recent Android versions 188 Testing your alarms in Doze Mode 191 Setting a Window alarm 192 Debugging AlarmManager alarms 192 Canceling alarms 194 Scheduling repeating alarms 195 Scheduling an alarm clock 197 Handling alarms 198 Handling alarms with Activities 199 Handling alarms with BroadcastReceiver 200 Working with BroadcastReceiver 202 Asynchronous work with goAsync 205 Handling alarms with Services 206 Staying awake with WakeLocks 207 Resetting alarms after a system reboot 209 Applications of AlarmManager 211 Summary 211 Chapter 7: Exploring the JobScheduler API 214 Introduction to JobScheduler 215 Setting running criteria 216 Scheduling a job 219 Implementing the JobService 222 Listing pending jobs 227 Canceling a job 230 Scheduling a periodic job 230 Applications of the JobScheduler 231 Summary 232 Chapter 8: Interacting with the Network 234 Introducing Android HTTP clients 235 AndroidHttpClient 236 HttpURLConnection 237 Performing HTTP requests asynchronously 237 Retrieving a text response 244 Interacting with JSON web APIs 246 Converting Java objects to JSON 247 Interacting with XML web APIs 253 Converting Java objects to XML 254 Converting XML to Java objects 256 Customizing HTTP timeouts 260 Communicating securely over SSL sessions 262 Summary 270 Chapter 9: Asynchronous Work on the Native Layer 272 Introduction to JNI 273 Android NDK (Native Development Kit) 274 Calling C functions from Java code 275 Calling C++ functions from native code 279 Accessing Java objects from native code 281 Executing native background work on Java threads 284 Executing asynchronous work on a native thread 289 Attaching and detaching native threads from JVM 289 JNI references explained 295 Interacting with UI from native threads 296 Starting the native threads 298 Stopping the native threads 298 Handling Java exceptions in the native layer 299 Interacting with a Java monitor from native code 302 Wrapping native data objects 306 Summary 310 Chapter 10: Network Interactions with GCM 312 Introduction to GCM 313 Setting up and configuring GCM for your application 315 Registering the GCM Receiver 317 Setting up a registration service 317 InstanceID listener 319 Receiving downstream messages 321 Receiving messages from topic 325 Sending upstream messages 329 GcmListenerService delivery callbacks 333 Executing tasks with GCM Network Manager 334 Building a one shot task 335 Summary 339 Chapter 11: Exploring Bus-based Communications 340 Introduction to bus-based communication 341 EventBus library 342 Defining events 343 Submitting events 344 Registering sbscribers 345 Thread mode 346 Posting sticking events 353 Removing sticky events 357 Summary 358 Chapter 12: Asynchronous Programing with RxJava 360 Introduction to RxJava 361 Cold versus Hot Observable 363 RxJava setup 363 Creating Observables 363 Transforming Observables 366 Understanding Schedulers 368 Performing IO operations with Schedulers 370 Canceling subscriptions 373 Composing Observables 373 Monitoring the event stream 375 Combining Observables 378 Observing UI Events with RxJava 381 Working with Subjects 385 Summary 388 Index 390

قیمت نهایی

۴۹٬۰۰۰ تومان