UP | HOME
2017-02-20 | ../../ |

Concurrency in Android Apps

Table of Contents

1 Background

2 Concurrency in Android Examples

  1. ./concurrent-android-processes.html
  2. ./concurrent-android-threads.html
  3. ./concurrent-android-binder.html Binder, Android Framework component for IPC
  4. ./concurrent-android-streams.org
  5. ./concurrent-android-reactive.org

3 Standard Threads in Every Android APP

  1. The Application Main Thread. Handle the user interface events.
  2. Service threads. Should not "do UI". Toasts?
  3. Worker threads
  4. Asynchronous Task "performs the blocking operations in a worker thread and then publishes the results on the UI thread, without requiring you to handle threads and/or handlers yourself."

4 The UI Thread

  1. Every app has its own special thread that runs UI objects
  2. Background tasks do hard work and compute results.
  3. Give the results to UI elements.
  4. Thread handlers are part of the Android framework.

5 Interprocess Communication

  1. Local procedure/ method call: Local == Caller and Called method both in the same process.
  2. Remote Procedure Call (RPC) / Remote Method Invocation (RMI).
  3. Remote implies a different process. But, may be in the same machine/device. Or, may be not.
  4. Android uses bindService (android.content.Intent, android.content.ServiceConnection, int).

6 Exercises

  1. Communicating with the UI Thread has sample src code. Try it out.
  2. Android-Java-8-Stream-Example Uses Retrolambda and Lightweight-Stream-API 2016; Can now be updated to Java-8
  3. User Authentication in Java 8 "Stormpath" 2016
  4. BubbleUPnP Server Multiplatform, including Android. github

7 References

  1. https://developer.android.com/guide/components/processes-and-threads.html Overview of Processes and Threads in Android. Required Reading.
  2. https://developer.android.com/guide/components/services.html Services developer guide.
  3. https://developer.android.com/topic/performance/threads.html Android Threading Performance. Recommended Reading.

8 End


Copyright © 2017 www.wright.edu/~pmateti