Chapter 13. Inter-Process Communication

Android is designed to host a variety of applications and to maximize user choice. The platform is intended to eliminate the duplication of functionality in different applications, to allow functionality to be discovered and invoked on the fly, and to let users replace applications with others that offer similar functionality. Applications must have as few dependencies as possible, and must be able to contract out operations to other applications that may change at the user’s discretion.

Inter-process communication (IPC) is thus the basis of key features of the Android programming model. The techniques we’ll look at in this chapter are:

Intents

These enable an application to select an Activity based on the action you want to invoke and the data on which they operate. In other words, you don’t need a hardcoded path to an application to use its functions and exchange data with it. Data can be passed in both directions using Intent objects, and this enables a convenient, high-level system of inter-process communication.

Remote methods

This feature resembles the remote procedure calls (RPCs) offered by other systems: it makes APIs accessible remotely. Remote objects allow you to make method calls that look “local” but are executed in another process. They involve the use of Android’s interface definition language (AIDL).

In this chapter, we will see how these features work and how they can be used in applications.

Android applications could avoid inter-process ...

Get Android Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.